]> granicus.if.org Git - php/commit
Set FPM_BACKLOG_DEFAULT to 511
authorrenyongquan <renyongquan@360.cn>
Tue, 22 Jul 2014 08:16:22 +0000 (16:16 +0800)
committerrenyongquan <renyongquan@360.cn>
Tue, 22 Jul 2014 08:16:22 +0000 (16:16 +0800)
commitebf4ffc9354f316f19c839a114b26a564033708a
treeeb443f91fc2a527f95e95da546f3719c8c9e3e6d
parentb39f98cf81cce1eae9f665a5c7f82c93e218a577
Set FPM_BACKLOG_DEFAULT to 511

It is too large for php-fpm to set the listen backlog to 65535.
It is realy NOT a good idea to clog the accept queue especially
when the client or nginx has a timeout for this connection.

Assume that the php-fpm qps is 5000. It will take 13s to completely
consume the 65535 backloged connections. The connection maybe already
have been closed cause of timeout of nginx or clients. So when we accept
the 65535th socket, we get a broken pipe.

Even worse, if hundreds of php-fpm processes get a closed connection
they are just wasting time and resouces to run a heavy task and finally
get error when writing to the closed connection(error: Broken Pipe).

The really max accept queue size will be backlog+1(ie, 512 here).
We take 511 which is the same as nginx and redis.
sapi/fpm/fpm/fpm_sockets.h