Home » Computers » Apache httpd High CPU Usage Mystery Resolved

Apache httpd High CPU Usage Mystery Resolved

A few days ago I posted about how httpd on my VPS was experiencing a sudden increase in CPU utilization. At first I thought it was some sort of change in Jetpack for WordPress. Then I thought it was something to do with the Kadence ‘Virtue’ theme I am now using.

Yesterday afternoon I was tailing the Apache httpd access logs and when I would visit an uncached page, the browser would send the request, but httpd wouldn’t immediately throw a log that it’s serving out the page content. The lag time between the request and the start of page load the browser sees was actually being reflected in Apache logs.

I thought it might have been some sort of issue with the httpd configuration or perhaps some sort of lag time on the PHP to MySQL queries. But the fact that httpd was spiking to 97-99% between the time of browser request and start of page load seemed to indicate something was amiss in the transaction.

For some reason I was looking at the index.php that is in the document root. I have it setup such that WordPress is in its own subdirectory (like many people do their installs). All WordPress .php files are left open by default, meaning no closing ?> tags for the <?php opening tag, but I didn’t realize this at the time, and ended up closing the <?php tag in the index.php file and saving it. After that, WordPress and httpd were working like normal. Fast load times for uncached pages. No spike in CPU utilization upon a page request.

Linode_-_Graphs____ocabjnet_-_Last_24_Hours-600

Linode_-_Graphs____ocabjnet_-_Last_30_Days-600

I’m not sure why this made a difference, but it seems to have. I’ll have to keep a close eye on this, but it looks like everything is back to normal.

The mystery is resolved, but it remains a mystery.

Linode_-_Longview____ocabj_net-600

Follow Jonathan Ocab:
Owner and administrator of ocabj.net

Comment on this post

This site uses Akismet to reduce spam. Learn how your comment data is processed.