Tentando que os erros "pool parece ocupado" parassem com o php-fpm

2

Eu tenho uma máquina que está rodando com 3 núcleos e 7GB de RAM. Nesta máquina, estamos executando o Nginx 1.4.2 e o PHP-FPM. Cada processo do PHP-FPM usa ~ 30MB de RAM.

Então, esta é a configuração do pool que eu configurei:

[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

Eu também tenho o seguinte no meu /etc/nginx/nginx.conf

user              nginx;
worker_processes  3;

events {
    worker_connections  4096;
    multi_accept on;
}

A minha pergunta agora é: estou vendo algumas delas rolando pelos logs de vez em quando; que resulta em 110 (connection timed out) erros no 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

Com base nas especificações de CPU / RAM, qual seria um número seguro para definir meus valores pm.* ? Eu não quero empurrá-los muito alto e aleijar a máquina mais do que já é.

    
por Andrew Ellis 24.07.2013 / 18:54

0 respostas