2

I have a machine that is running with 3 cores and 7GB of RAM. On this machine we are running Nginx 1.4.2 and PHP-FPM. Each PHP-FPM process uses ~30MB of RAM.

So this is the pool configuration I have setup:

[www]
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
user = nginx
group = nginx
pm = dynamic
pm.max_children = 200 ; 200 x 30MB = 6000MB (leaving ~1.5GB for random stuff on the server)
pm.start_servers = 20 ; 20 + (35 - 20) / 2 (rounded to the nearest 5)
pm.min_spare_servers = 20
pm.max_spare_servers = 35
pm.max_requests = 500
slowlog = /var/log/php-fpm/www-slow.log
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session

I also have the following in my /etc/nginx/nginx.conf

user              nginx;
worker_processes  3;

events {
    worker_connections  4096;
    multi_accept on;
}

My question now is, I am seeing a few of these roll through the logs every now and then; which results in 110 (connection timed out) errors in Nginx.:

[24-Jul-2013 11:58:20] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 42 total children
[24-Jul-2013 11:58:21] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 50 total children
[24-Jul-2013 11:58:22] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 66 total children
[24-Jul-2013 11:58:23] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 86 total children
[24-Jul-2013 11:58:24] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 106 total children
[24-Jul-2013 11:58:25] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 17 idle, and 126 total children

Based on the CPU/RAM specs, what would be a safe number to set my pm.* values? I don't want to push them too high and cripple the machine anymore than it already is.

Andrew Ellis
  • 423
  • 1
  • 5
  • 14

0 Answers0