From 4d821a842c5e7802eb6d366724cba7b98b96c73b Mon Sep 17 00:00:00 2001 From: Vadim Kirilchuk Date: Mon, 3 Jun 2024 21:50:39 -0400 Subject: [PATCH 1/2] Make MonoSend.MAX_SIZE configurable by system property (#3255) --- .../src/main/java/reactor/netty/channel/MonoSend.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reactor-netty-core/src/main/java/reactor/netty/channel/MonoSend.java b/reactor-netty-core/src/main/java/reactor/netty/channel/MonoSend.java index b72f0410bc..a91a3f3c91 100644 --- a/reactor-netty-core/src/main/java/reactor/netty/channel/MonoSend.java +++ b/reactor-netty-core/src/main/java/reactor/netty/channel/MonoSend.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2023 VMware, Inc. or its affiliates, All Rights Reserved. + * Copyright (c) 2019-2024 VMware, Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,8 @@ static ToIntFunction defaultSizeOf() { return (ToIntFunction) SIZE_OF; } - static final int MAX_SIZE = 128; + static final int MAX_SIZE = + Integer.parseInt(System.getProperty("reactor.netty.channel.send.prefetch.maxSize", "128")); static final int REFILL_SIZE = MAX_SIZE / 2; From 274a6a211547273c76715db911865f4c53dd55b4 Mon Sep 17 00:00:00 2001 From: Vadim Kirilchuk Date: Fri, 7 Jun 2024 10:28:20 -0400 Subject: [PATCH 2/2] Rename max prefetch size property and move to appropriate class (#3255) --- .../src/main/java/reactor/netty/ReactorNetty.java | 7 ++++++- .../src/main/java/reactor/netty/channel/MonoSend.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/reactor-netty-core/src/main/java/reactor/netty/ReactorNetty.java b/reactor-netty-core/src/main/java/reactor/netty/ReactorNetty.java index 141649c642..87659e4804 100644 --- a/reactor-netty-core/src/main/java/reactor/netty/ReactorNetty.java +++ b/reactor-netty-core/src/main/java/reactor/netty/ReactorNetty.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2023 VMware, Inc. or its affiliates, All Rights Reserved. + * Copyright (c) 2011-2024 VMware, Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -198,6 +198,11 @@ public final class ReactorNetty { */ public static final ZoneId ZONE_ID_SYSTEM = ZoneId.systemDefault(); + /** + * Default prefetch size ({@link Subscription#request(long)}) for data stream Publisher, fallback to 128. + */ + public static final String REACTOR_NETTY_SEND_MAX_PREFETCH_SIZE = "reactor.netty.send.maxPrefetchSize"; + /** * Try to call {@link ReferenceCounted#release()} if the specified message implements {@link ReferenceCounted}. * If the specified message doesn't implement {@link ReferenceCounted} or it is already released, diff --git a/reactor-netty-core/src/main/java/reactor/netty/channel/MonoSend.java b/reactor-netty-core/src/main/java/reactor/netty/channel/MonoSend.java index a91a3f3c91..e18d3bc450 100644 --- a/reactor-netty-core/src/main/java/reactor/netty/channel/MonoSend.java +++ b/reactor-netty-core/src/main/java/reactor/netty/channel/MonoSend.java @@ -59,7 +59,7 @@ static ToIntFunction defaultSizeOf() { } static final int MAX_SIZE = - Integer.parseInt(System.getProperty("reactor.netty.channel.send.prefetch.maxSize", "128")); + Integer.parseInt(System.getProperty(ReactorNetty.REACTOR_NETTY_SEND_MAX_PREFETCH_SIZE, "128")); static final int REFILL_SIZE = MAX_SIZE / 2;