Skip to content

Commit

Permalink
change: update the default value about enable_cpu_affinity (apache#8074)
Browse files Browse the repository at this point in the history
Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
  • Loading branch information
2 people authored and Liu-Junlin committed Nov 4, 2022
1 parent b650a83 commit 8a40a0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion conf/config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,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

Expand Down
18 changes: 9 additions & 9 deletions t/cli/test_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,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' .

Expand Down Expand Up @@ -525,18 +525,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
Expand Down

0 comments on commit 8a40a0c

Please sign in to comment.