I have web server that is getting around 25K visits a day up at yougetsignal.com. Sometimes the site feels a bit sluggish. I am hosting it on nginx with php5-fpm. Is there a way for me to see a list of all of the long running requests that are coming to the site?
I'd love to have a real-time list of all of the active requests that PHP is handling and how long they have been running. Kind of like top, but just for the web server. This would let me know how long requests are taking and which script is the culprit.
Anyone have any ideas on how I can do this?
In your PHP-FPM configuration file, for the Pool Definitions, you can enable a "slow log" that can provide more information on long-running PHP scripts:
Uncomment
slowlog
and set to a valid file name, and uncommentrequest_slowlog_timeout
and set to 10s or whatever value you think is too long, then reload/restart PHP-FPM.