From 79155e34b4a405b9766e09c556c1341698e51e6a Mon Sep 17 00:00:00 2001 From: kangkaisen Date: Sun, 27 Sep 2020 19:02:54 +0800 Subject: [PATCH] Fix mysqlslap hang under high concurrent --- docs/en/administrator-guide/config/fe_config.md | 8 ++++++++ docs/zh-CN/administrator-guide/config/fe_config.md | 6 ++++++ .../src/main/java/org/apache/doris/common/Config.java | 11 +++++++++-- .../java/org/apache/doris/mysql/nio/NMysqlServer.java | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/en/administrator-guide/config/fe_config.md b/docs/en/administrator-guide/config/fe_config.md index 3ec630157bf34d..8b18254ddfdc77 100644 --- a/docs/en/administrator-guide/config/fe_config.md +++ b/docs/en/administrator-guide/config/fe_config.md @@ -334,6 +334,14 @@ This variable is a dynamic configuration, and users can modify the configuration ### `http_backlog_num` +The backlog_num for netty http server, When you enlarge this backlog_num, +you should enlarge the value in the linux /proc/sys/net/core/somaxconn file at the same time + +### `mysql_nio_backlog_num` + +The backlog_num for mysql nio server, When you enlarge this backlog_num, +you should enlarge the value in the linux /proc/sys/net/core/somaxconn file at the same time + ### `http_port` HTTP bind port. Defaults to 8030. diff --git a/docs/zh-CN/administrator-guide/config/fe_config.md b/docs/zh-CN/administrator-guide/config/fe_config.md index 8898a3fb94933d..0eb2248060de1e 100644 --- a/docs/zh-CN/administrator-guide/config/fe_config.md +++ b/docs/zh-CN/administrator-guide/config/fe_config.md @@ -331,6 +331,12 @@ FE 的配置项有两种方式进行配置: ### `history_job_keep_max_second` ### `http_backlog_num` +Doris netty http server 的backlog_num 参数,当你增大该配置时,也需要同时 +增大 Linux /proc/sys/net/core/somaxconn 文件的值 + +### `mysql_nio_backlog_num` +Doris mysql nio server 的backlog_num 参数,当你增大该配置时,也需要同时 +增大 Linux /proc/sys/net/core/somaxconn 文件的值 ### `http_port` diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/Config.java b/fe/fe-core/src/main/java/org/apache/doris/common/Config.java index fb8271a5813639..0b06738534b901 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/Config.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/Config.java @@ -296,11 +296,18 @@ public class Config extends ConfigBase { /** * The backlog_num for netty http server - * When you enlarge this backlog_num, you should ensure it's value larger than - * the linux /proc/sys/net/core/somaxconn config + * When you enlarge this backlog_num, you should enlarge the value in + * the linux /proc/sys/net/core/somaxconn file at the same time */ @ConfField public static int http_backlog_num = 1024; + /** + * The backlog_num for mysql nio server + * When you enlarge this backlog_num, you should enlarge the value in + * the linux /proc/sys/net/core/somaxconn file at the same time + */ + @ConfField public static int mysql_nio_backlog_num = 1024; + /** * The connection timeout and socket timeout config for thrift server * The value for thrift_client_timeout_ms is set to be larger than zero to prevent diff --git a/fe/fe-core/src/main/java/org/apache/doris/mysql/nio/NMysqlServer.java b/fe/fe-core/src/main/java/org/apache/doris/mysql/nio/NMysqlServer.java index 964abaa045f9a4..e55ae845039d58 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mysql/nio/NMysqlServer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/nio/NMysqlServer.java @@ -64,7 +64,7 @@ public NMysqlServer(int port, ConnectScheduler connectScheduler) { public boolean start() { try { server = xnioWorker.createStreamConnectionServer(new InetSocketAddress(port), - acceptListener, OptionMap.create(Options.TCP_NODELAY, true)); + acceptListener, OptionMap.create(Options.TCP_NODELAY, true, Options.BACKLOG, Config.mysql_nio_backlog_num)); server.resumeAccepts(); running = true; LOG.info("Open mysql server success on {}", port);