A
A
anton4eg2015-04-23 12:10:02
linux
anton4eg, 2015-04-23 12:10:02

Process limit (nginx + php-fpm)?

Colleagues good afternoon
Given:
Server 12 cores, 128GB RAM, nginx, php-fpm
PHP-FPM
config to spin on one pool
listen = /var/run/php5-fpm.sock
pm = dynamic
pm.max_children = 48
pm.start_servers = 12
pm.min_spare_servers = 2
pm.max_spare_servers = 24
status php-fpm
pool: www
process manager: dynamic
start time: 23/Apr/2015:11:10:29 +0300
start since: 3116
accepted conn: 21591
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 24
active processes: 17
total processes: 41
max active processes: 48
max children reached: 2
slow requests: 0
nginx settings
user nginx;
worker_processes 12;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
}
PROBLEM
The server starts returning a 504 error when TOP shows the following:
LA < 1.3
Tasks 1483, 3 running, 1480 sleeping
In nginx logs
2602#0: *37902 upstream timed out (110: Connection timed out) while reading response header from upstream,
This behavior starts when the number of processes > 1300
In the main script, exec() is called, when there are more than 1300 processes, exec() is executed before the timeout and the script terminates with a 504 error. It seems that some kind of restriction does not allow running a new script through exec and it is in the queue.
The question is, what needs to be tightened up?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Puma Thailand, 2015-04-23
@opium

504 is a timeout, it is logical that the scripts do not have time to work out the
correct strategy to see what happens to the scripts
temporary fix increase all timeouts in nginx and php

Z
zorruch, 2015-04-23
@zorruch

The logs cannot be all clean. See nginx error log

A
ajaxtelamonid, 2015-04-27
@ajaxtelamonid

I had this once. Increase the number of php-fpm workers. They are sorely lacking. UPD saw the comment about cli. This is no longer my case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question