Question: High CPU usage by Nginx is shown in Health Monitor
Applicable to:Plesk Onyx for Linux
Symptoms- The high CPU usage by Nginx can be found in Plesk > Health Monitoring.
- Many Nginx processes as below can be found on the server:
# top -c
19296 nginx 20 0 318720 223848 2212 S 0.3 2.1 0:00.23 nginx: worker process
# top -c
19289 nginx 20 0 318720 223848 2212 S 0.3 2.1 0:00.23 nginx: worker process is shutting down
CauseIncorrect value of worker_connections directive.
Resolution
1.Log into the server via SSH.
2.Create a backup for Nginx configuration file:
# cp /etc/nginx/nginx.conf{,.orig}
3.Get the number of CPU cores (in the example below this value is equal to 4):
# cat /proc/cpuinfo | grep processor | wc -l
4
4.Using the vi text editor open the/etc/nginx/nginx.conf file and change the value for the worker_connections equals to
1024 * number of CPU cores:worker_connections 4096;5.Restart the Nginx service to apply changes:
# service nginx restart