From 8caea997bf61ec90ccfa85d292e05dadc814ec04 Mon Sep 17 00:00:00 2001 From: Jihun Cho Date: Wed, 6 May 2020 13:47:52 -0700 Subject: [PATCH] netty: enable auto flow control tuning by default --- .../src/main/java/io/grpc/netty/NettyChannelBuilder.java | 8 +++++--- netty/src/main/java/io/grpc/netty/NettyServerBuilder.java | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/netty/src/main/java/io/grpc/netty/NettyChannelBuilder.java b/netty/src/main/java/io/grpc/netty/NettyChannelBuilder.java index 31c5d64221d..84ee4f20dbf 100644 --- a/netty/src/main/java/io/grpc/netty/NettyChannelBuilder.java +++ b/netty/src/main/java/io/grpc/netty/NettyChannelBuilder.java @@ -84,7 +84,7 @@ public final class NettyChannelBuilder private ChannelFactory channelFactory = DEFAULT_CHANNEL_FACTORY; private ObjectPool eventLoopGroupPool = DEFAULT_EVENT_LOOP_GROUP_POOL; private SslContext sslContext; - private boolean autoFlowControl; + private boolean autoFlowControl = true; private int flowControlWindow = DEFAULT_FLOW_CONTROL_WINDOW; private int maxHeaderListSize = GrpcUtil.DEFAULT_MAX_HEADER_LIST_SIZE; private long keepAliveTimeNanos = KEEPALIVE_TIME_NANOS_DISABLED; @@ -250,7 +250,8 @@ public NettyChannelBuilder sslContext(SslContext sslContext) { /** * Sets the initial flow control window in bytes. Setting initial flow control window enables auto * flow control tuning using bandwidth-delay product algorithm. To disable auto flow control - * tuning, use {@link #flowControlWindow(int)}. + * tuning, use {@link #flowControlWindow(int)}. By default, auto flow control is enabled with + * initial flow control window size of {@link #DEFAULT_FLOW_CONTROL_WINDOW}. */ public NettyChannelBuilder initialFlowControlWindow(int initialFlowControlWindow) { checkArgument(initialFlowControlWindow > 0, "initialFlowControlWindow must be positive"); @@ -262,7 +263,8 @@ public NettyChannelBuilder initialFlowControlWindow(int initialFlowControlWindow /** * Sets the flow control window in bytes. Setting flowControlWindow disables auto flow control * tuning; use {@link #initialFlowControlWindow(int)} to enable auto flow control tuning. If not - * called, the default value is {@link #DEFAULT_FLOW_CONTROL_WINDOW}). + * called, the default value is {@link #DEFAULT_FLOW_CONTROL_WINDOW}) with auto flow control + * tuning. */ public NettyChannelBuilder flowControlWindow(int flowControlWindow) { checkArgument(flowControlWindow > 0, "flowControlWindow must be positive"); diff --git a/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java b/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java index 73d3e964364..4560d697da6 100644 --- a/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java +++ b/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java @@ -94,7 +94,7 @@ public final class NettyServerBuilder extends AbstractServerImplBuilder 0, "initialFlowControlWindow must be positive"); @@ -361,7 +362,8 @@ public NettyServerBuilder initialFlowControlWindow(int initialFlowControlWindow) /** * Sets the flow control window in bytes. Setting flowControlWindow disables auto flow control * tuning; use {@link #initialFlowControlWindow(int)} to enable auto flow control tuning. If not - * called, the default value is {@link #DEFAULT_FLOW_CONTROL_WINDOW}). + * called, the default value is {@link #DEFAULT_FLOW_CONTROL_WINDOW}) with auto flow control + * tuning. */ public NettyServerBuilder flowControlWindow(int flowControlWindow) { checkArgument(flowControlWindow > 0, "flowControlWindow must be positive: %s",