From 17f72e3b4471d2325605a0bcc64cbb42d48c00db Mon Sep 17 00:00:00 2001 From: lvsi <15239928381@163.com> Date: Sun, 12 Feb 2023 16:00:03 +0800 Subject: [PATCH] fix: fix the bug of adjusting system parameters --- bin/ngxway | 9 +++------ conf/nginx/nginx.conf | 7 ++++--- scripts/adjust_system_param.sh | 18 ------------------ 3 files changed, 7 insertions(+), 27 deletions(-) delete mode 100644 scripts/adjust_system_param.sh diff --git a/bin/ngxway b/bin/ngxway index a11e150..9f137a8 100755 --- a/bin/ngxway +++ b/bin/ngxway @@ -42,17 +42,14 @@ function start(){ mkdir -p $localVolumeLogsDir && chmod -R 777 $localVolumeLogsDir # Run container. - docker run --name ngxwayContainer -d -p $ngxwayAddr:8090 -v $localVolumeLogsDir:/dist/logs/ ngxway + docker run --ulimit nofile=1048576:1048576 \ + --sysctl net.ipv4.ip_local_port_range="1024 65535" \ + --name ngxwayContainer -d -p $ngxwayAddr:8090 -v $localVolumeLogsDir:/dist/logs/ ngxway if [ $? -ne 0 ]; then echo -e ">>>>>>>>Start failure: failed to run<<<<<<<<" exit 1 fi - # Exec command: adjust the system parameters. - # docker run --sysctl net.ipv4.ip_local_port_range="32768 65535" \ - # --ulimit nofile=1024000:1024000 - # docker run -d --ulimit nofile=1024000:1024000 ngxway - # Exec command: start the go server. docker exec -d ngxwayContainer /dist/bin/goserver if [ $? -ne 0 ]; then diff --git a/conf/nginx/nginx.conf b/conf/nginx/nginx.conf index d13eed1..7aa8e6e 100644 --- a/conf/nginx/nginx.conf +++ b/conf/nginx/nginx.conf @@ -19,9 +19,10 @@ # Enables the use of JIT for regular expressions to speed-up their processing. pcre_jit on; -# worker_processes auto; -worker_processes 8; -worker_cpu_affinity 000 001 010 011 100 101 110 111; +# worker_processes 8; +# worker_cpu_affinity 000 001 010 011 100 101 110 111; +worker_processes auto; +worker_cpu_affinity auto; events { worker_connections 1024; diff --git a/scripts/adjust_system_param.sh b/scripts/adjust_system_param.sh deleted file mode 100644 index cb106c4..0000000 --- a/scripts/adjust_system_param.sh +++ /dev/null @@ -1,18 +0,0 @@ -# Go back to the root directory of ngxway. -ngxwayPath=$(cd `dirname $0`; cd ..; pwd) -cd $ngxwayPath - -# Require the common shell scripts. -. $ngxwayPath/scripts/common.sh - -# Check the system, only available for Linux and Unix series. -whichSystem=$(printWhichSystem) - -# Adjust system parameters to improve the performance of ngxway. -if [ "${whichSystem}" == "Linux" ] ; then - echo $systemParamTemplate1 >> ~/.bashrc - source ~/.bashrc -else - echo $systemParamTemplate1 >> ~/.bash_profile - source ~/.bash_profile -fi