I'm designing a chat application in PHP. I use nginx with php-fpm environment. The problem is, that after several clients connected, PHP scripts are getting very slow.
I have just several (5-10) clients connected and the long poll is set to 30 seconds. Nginx serves static content like images or styles instantly, but for PHP scripts it takes almost 5 seconds to load. I used XDebug to profile the code, but it tells me, that script which loaded 5 seconds took only 100ms, which is confusing.
I think that php5-fpm queues incoming requests, which causes such delays. Is there something I should know about php5-fpm configuration when using long poll? I'd like to emphasize, that it gets very, very slow when ~5 clients are using the chat.
Similiar issue: http://forum.nginx.org/read.php?3,198958 (one long-running PHP script blocks all other PHP requests)
This also might be connected: http://www.matt-knight.co.uk/2011/concurrent-php-sessions/