This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 7b0c2adbaf4 Support netty parameter ChannelOption.SO_BACKLOG
configurable (#17812) (#17876)
7b0c2adbaf4 is described below
commit 7b0c2adbaf45f452b485903f053da0673a750f7f
Author: galaxy <[email protected]>
AuthorDate: Mon May 23 19:08:13 2022 +0800
Support netty parameter ChannelOption.SO_BACKLOG configurable (#17812)
(#17876)
---
.../infra/config/props/ConfigurationPropertyKey.java | 7 ++++++-
.../apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
index 8366bac4aab..f7b1d3543b4 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
@@ -127,7 +127,12 @@ public enum ConfigurationPropertyKey implements
TypedPropertyKey {
/**
* Proxy default start port.
*/
- PROXY_DEFAULT_PORT("proxy-default-port", "3307", int.class, true);
+ PROXY_DEFAULT_PORT("proxy-default-port", "3307", int.class, true),
+
+ /**
+ * Proxy Netty backlog size.
+ */
+ PROXY_NETTY_BACKLOG("proxy-netty-backlog", "1024", int.class, false);
private final String key;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
index 86b580a1bac..69293727313 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
@@ -94,11 +94,13 @@ public final class ShardingSphereProxy {
}
private void initServerBootstrap(final ServerBootstrap bootstrap) {
+ Integer backLog =
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getProps().<Integer>getValue(ConfigurationPropertyKey.PROXY_NETTY_BACKLOG);
bootstrap.group(bossGroup, workerGroup)
.channel(Epoll.isAvailable() ? EpollServerSocketChannel.class
: NioServerSocketChannel.class)
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new
WriteBufferWaterMark(8 * 1024 * 1024, 16 * 1024 * 1024))
.option(ChannelOption.ALLOCATOR,
PooledByteBufAllocator.DEFAULT)
.option(ChannelOption.SO_REUSEADDR, true)
+ .option(ChannelOption.SO_BACKLOG, backLog)
.childOption(ChannelOption.ALLOCATOR,
PooledByteBufAllocator.DEFAULT)
.childOption(ChannelOption.TCP_NODELAY, true)
.handler(new LoggingHandler(LogLevel.INFO))