You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2021/08/30 08:01:37 UTC

[iotdb] 01/01: [ISSUE-3865] Meaningless connection reset issues caused by low default value for SOMAXCONN

This is an automated email from the ASF dual-hosted git repository.

rong pushed a commit to branch issue-3865-0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 393477aa9977c678aa8224f9279d9937ee42e837
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Mon Aug 30 16:00:50 2021 +0800

    [ISSUE-3865] Meaningless connection reset issues caused by low default value for SOMAXCONN
---
 server/src/assembly/resources/conf/iotdb-env.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/server/src/assembly/resources/conf/iotdb-env.sh b/server/src/assembly/resources/conf/iotdb-env.sh
index fe37643..f4d4a05 100755
--- a/server/src/assembly/resources/conf/iotdb-env.sh
+++ b/server/src/assembly/resources/conf/iotdb-env.sh
@@ -30,6 +30,27 @@ if [ $max_num -le 65535 ]; then
     fi
 fi
 
+# Set somaxconn to a better value to avoid meaningless connection reset issues when the system is under high load.
+# The original somaxconn will be set back when the system reboots.
+# For more detail, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=19f92a030ca6d772ab44b22ee6a01378a8cb32d4
+SOMAXCONN=65535
+case "$(uname)" in
+    Linux)
+        somaxconn=$(sysctl net.core.somaxconn | awk '{print $2}')
+        if [ "$somaxconn" -le $SOMAXCONN ]; then
+            sudo sysctl -w net.core.somaxconn=$SOMAXCONN
+        fi
+        echo "somaxconn is set to $somaxconn."
+    ;;
+    FreeBSD | Darwin)
+        somaxconn=$(sysctl kern.ipc.somaxconn | awk '{print $2}')
+        if [ "$somaxconn" -le $SOMAXCONN ]; then
+            sudo sysctl -w kern.ipc.somaxconn=$SOMAXCONN
+        fi
+        echo "somaxconn is set to $somaxconn."
+    ;;
+esac
+
 calculate_heap_sizes()
 {
     case "`uname`" in