com php-src: Set FPM_BACKLOG_DEFAULT to 511: sapi/fpm/fpm/fpm_sockets.h
| From: | Stanislav Malyshev | Date: | Tue, 22 Jul 2014 08:16:22 +0000 |
| Subject: | com php-src: Set FPM_BACKLOG_DEFAULT to 511: sapi/fpm/fpm/fpm_sockets.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83969@lists.php.net to get a copy of this message | ||
Commit: ebf4ffc9354f316f19c839a114b26a564033708a
Author: renyongquan <renyongquan@360.cn> Tue, 22 Jul 2014 16:16:22 +0800
Parents: b39f98cf81cce1eae9f665a5c7f82c93e218a577
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ebf4ffc9354f316f19c839a114b26a564033708a
Log:
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.
Changed paths:
M sapi/fpm/fpm/fpm_sockets.h
Diff:
diff --git a/sapi/fpm/fpm/fpm_sockets.h b/sapi/fpm/fpm/fpm_sockets.h
index 121c016..64f32ba 100644
--- a/sapi/fpm/fpm/fpm_sockets.h
+++ b/sapi/fpm/fpm/fpm_sockets.h
@@ -19,7 +19,7 @@
#if (__FreeBSD__) || (__OpenBSD__)
#define FPM_BACKLOG_DEFAULT -1
#else
-#define FPM_BACKLOG_DEFAULT 65535
+#define FPM_BACKLOG_DEFAULT 511
#endif
enum fpm_address_domain fpm_sockets_domain_from_address(char *addr);