For some reason, one of my clients wordpress blog is using 100% cpu on a php process per page load. To clarify, the first time you load the page it is very slow, and uses 100% cpu for the PHP process and then if you reload the page (while it is going slow) it loads very fast. After that is done the normal PHP usage per page load is roughly 1-4% if that.
I'm guessing something in the coding is looping, but I am unsure. What I do know is 100% cpu usage for one page view initially is insane.
Does anyone have any ideas on how to fix/resolve this issue?. Thank you!.
You generally see that behavior with caching. The first time you browse the php page the server has to run the PHP script directly (no opcode caching). So the CPU is pegged. The second time around, caching takes place and the opcode is used instead. You definitely need to dig through the PHP script coding issues.
Try switching to a quick-loading theme first (like Swift 2.1.4 by Satish Gandham) and test it to make sure it's not theming. IF it's not, disable all the plug-ins and add them back one at a time. You might use this as an opportunity to review your plug-ins to see if you really need them. So many people use lots of plug-ins that they don't really need. Try to keep it to ten or under at most, unless you can really strongly defend the extras.
And, hey, let us know what happens!!!