Background: I maintain a server for a client who has half a dozen Wordpress sites on. They all have the W3 Total Cache plugin installed and eAcellerator is installed (might be APC).
All the PHP sites run through a single batch of fastcgi php-cgi processes (it's actually php-fpm but I'm not sure if that makes a difference) and that feeds into nginx.
Problem: php-cgi's CPU usage is quite high. Not terminally high but high enough to raise an eyebrow. The client wants to add more sites in the future and I want to avoid becoming CPU limited if I can help it.
Question: Is there any way I can find the scripts or even just requests that are causing the high CPU. I realise I might not be able to do anything with the results but it would give me a chance.
you have many checks to have a chance before. first of all. any php programmer can find the reason of high cpu usage faster & better than you. unless you touch the code to debug.
here is some clues to understand that. it may caused by any Wordpress plugin installed. check every installation of WP's on server 1 by 1, to see which is to blamed if they are all different installations. Normally wordpress with default installation never uses high cpu. maybe more ram acording to hit. but not cpu. if they are similar installations check your EAccelerator thing. try without it. if not. check all php extensions activated on php by default via phpinfo() file. try to deactivate extensions you never need. you can see how much sources you gain by php-cli execution. http://php.net/manual/en/features.commandline.php...
if none of them works. you may debug the codes. some testing classes & suits are open source on net. you can find them easily.