I
I
Ivan Trofimov2015-12-16 12:04:02
PHP
Ivan Trofimov, 2015-12-16 12:04:02

How to optimally configure php5-fpm + nginx (pm.max_children)?

Ubuntu server has nginx + php5-fpm installed.
1 CPU, 512 Mb RAM, 1024 Mb swap (Digital Ocean).
Spinning one site on wordpress. The load is very small. But last week it started to periodically start to fall off, you have to restart php5-fpm. After the restart, it works again for a while, then falls off again. I sin on the wrong setting of pm values.
/var/log/nginx/error.log


2015/12/16 13:52:05 [error] 673#0: *5643 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: ###, server: ###, request: "POST /xmlrpc.php HTTP/1.0", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "## #"
2015/12/16 13:52:05 [error] 673#0: *5643 open() "/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client : ###, server: ###, request: "POST /xmlrpc.php HTTP/1.0", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "## #"

/var/log/php5-fpm.log

[16-Dec-2015 13:44:00] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

Do I understand correctly that you need to change the values ​​in /etc/php5/fpm/pool.d/www.conf ?

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
; pm.max_requests = 500 (originally commented)

How optimally to choose these values ​​is not quite understood.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
romy4, 2015-12-16
@romy4

Your server serves a maximum of 3*5 requests at the same time. It is logical that you need "pm.max_children setting (5), consider raising it"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question