Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: default enableCPUAffinity to false #386

Open
lzxuan opened this issue Nov 2, 2022 · 0 comments
Open

change: default enableCPUAffinity to false #386

lzxuan opened this issue Nov 2, 2022 · 0 comments

Comments

@lzxuan
Copy link
Contributor

lzxuan commented Nov 2, 2022

Following the merged change at apache/apisix#8074.

NGINX gets the number of CPU cores via getconf _NPROCESSORS_ONLN, which in turn reads from /sys/devices/system/cpu/online. In a containerization environment, this is mounted directly from the host, and the cgroups doesn't have any effect on this value. As such, setting .nginx.enableCPUAffinity to true (worker_cpu_affinity auto; in NGINX config) by default will affect the behavior of APISIX, for instance, the performance degrades significantly when running multiple APISIX containers on the same host, as they (NGINX worker processes) are bound to the same CPU cores.

Additional note, due to the same reason, defaulting .nginx.workerProcesses to auto (worker_processes auto; in NGINX config) will also impact the performance, for example, when .apisix.resources.limits.cpu is configured.

A possible workaround is to set .nginx.enableCPUAffinity to false when installing APISIX as a deployment kind (which is the default), and set .nginx.workerProcesses to the same number of CPU cores specified in .apisix.resources.limits.cpu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant