diff --git a/conf/config-default.yaml b/conf/config-default.yaml index 642d4e89de41..d50f7a1c9ff0 100755 --- a/conf/config-default.yaml +++ b/conf/config-default.yaml @@ -167,7 +167,7 @@ nginx_config: # config for render the template to generate n error_log: logs/error.log error_log_level: warn # warn,error worker_processes: auto # if you want use multiple cores in container, you can inject the number of cpu as environment variable "APISIX_WORKER_PROCESSES" - enable_cpu_affinity: true # enable cpu affinity, this is just work well only on physical machine + enable_cpu_affinity: false # disable CPU affinity by default, if APISIX is deployed on a physical machine, it can be enabled and work well. worker_rlimit_nofile: 20480 # the number of files a worker process can open, should be larger than worker_connections worker_shutdown_timeout: 240s # timeout for a graceful shutdown of worker processes diff --git a/t/cli/test_main.sh b/t/cli/test_main.sh index ea54c53b8425..0b7a37bd7ff0 100755 --- a/t/cli/test_main.sh +++ b/t/cli/test_main.sh @@ -446,13 +446,13 @@ git checkout conf/config.yaml make init -grep -E "worker_cpu_affinity" conf/nginx.conf > /dev/null -if [ ! $? -eq 0 ]; then - echo "failed: nginx.conf file is missing worker_cpu_affinity configuration" +count=`grep -c "worker_cpu_affinity" conf/nginx.conf || true` +if [ $count -ne 0 ]; then + echo "failed: nginx.conf file found worker_cpu_affinity when disabling it" exit 1 fi -echo "passed: nginx.conf file contains worker_cpu_affinity configuration" +echo "passed: nginx.conf file disables cpu affinity" # check the 'worker_shutdown_timeout' in 'nginx.conf' . @@ -558,18 +558,18 @@ git checkout conf/config.yaml echo ' nginx_config: - enable_cpu_affinity: false + enable_cpu_affinity: true ' > conf/config.yaml make init -count=`grep -c "worker_cpu_affinity" conf/nginx.conf || true` -if [ $count -ne 0 ]; then - echo "failed: nginx.conf file found worker_cpu_affinity when disable it" +grep -E "worker_cpu_affinity" conf/nginx.conf > /dev/null +if [ ! $? -eq 0 ]; then + echo "failed: nginx.conf file is missing worker_cpu_affinity configuration" exit 1 fi -echo "passed: nginx.conf file disable cpu affinity" +echo "passed: nginx.conf file contains worker_cpu_affinity configuration" # set worker processes with env git checkout conf/config.yaml