I have set up Nginx (nginx version: nginx/0.8.53) and php-fpm (PHP 5.3.4 (fpm-fcgi) (built: Dec 15 2010 13:35:25)) on Mac OSX 10.6.
Then I ran the following test: with siege started stressing a somewhat complicated PHP script (it connects to MySQL and also Memcache) on localhost. While the test ran, I did a
sudo kill -USR2 pid_of_php-fpm_master_process
in the instant I did the kill, siege reported a few 502 status responses:
[code]
HTTP/1.1 200 6.47 secs: 15624 bytes ==> /my_test_script
HTTP/1.1 200 8.09 secs: 15624 bytes ==> /my_test_script
HTTP/1.1 200 7.43 secs: 15624 bytes ==> /my_test_script
HTTP/1.1 502 6.42 secs: 173 bytes ==> /my_test_script
HTTP/1.1 502 6.19 secs: 173 bytes ==> /my_test_script
HTTP/1.1 502 12.50 secs: 173 bytes ==> /my_test_script
HTTP/1.1 200 13.76 secs: 15624 bytes ==> /my_test_script
HTTP/1.1 200 12.98 secs: 15624 bytes ==> /my_test_script
[/code]
Since I have set up automatic restarts for php-fpm on some production machines (to work around mysterious hang issues from php-fpm), this could affect some of my users, If they are (un)lucky enough. Is there anything I could adjust in php-fpm or nginx configuration, to avoid the 502's? php-fpm is configured with pm = dynamic on my machine, but the same happens on production machines (Centos 5.5, nginx and php are the same versions as on my mac) where it's set up as static