CPU Spike

Today around 2PM MDT the CPU usage spiked up on my Linode and it had been like that till minutes ago. It only stopped after I reboot the node.

Using htop command, I could see it is the php running as the SuEXEC user using very high CPU.

Restarting Apache2 didn't seem to help.

Is there a way I can figure out what php is actually doing?

Thanks.

Max

9 Replies

Where's my crystal ball …

The problem continues…

The number of site visitors didn't change much and I haven't changed anything on the system.

Any ideas on how to find out the cause? I can see it is php that is consuming a lot resources but not sure why.

Thanks.

@OZ:

Where's my crystal ball …

Behind the fridge, things are almost always behind the fridge when you can't find them.

picmax: Check your apache access logs it'll let you know what pages are being accessed then you can check those scripts for resource intensive things.

This is a standard Wordpress installation. It has been running great upto the specific time. CPU average less than 10%.

There was no changes made to it and there isn't anything special I can see in the access log. It will be helpful If I can let php tell me what it is doing …

@obs:

@OZ:

Where's my crystal ball …

Behind the fridge, things are almost always behind the fridge when you can't find them.

picmax: Check your apache access logs it'll let you know what pages are being accessed then you can check those scripts for resource intensive things.

The access logs will point to a url which you can point to a script, read the script and it'll tell you what it does…even with wordpress' rewrite rules it's not that hard if your url has /category/ then it's showing you a category page so you check the files that display categories, if it's wp-admin/ you know it's the admin section etc etc

@obs:

picmax: Check your apache access logs it'll let you know what pages are being accessed then you can check those scripts for resource intensive things.

^^ that.

I've noticed CPU spikes on my wordpress installations as well; in those cases, the problem was that some misbehaved spider was trolling the site, using strange URL parameters in the query string that would bypass my caching. Found them in my apache access logs.

I checked and am checking. The requests are the normal stuff.

Again it all makes sense if this has happened earlier. My server has been running fine and the problem started suddenly without any changes made to it 2PM in the afternoon.

No traffic surge, etc, either.

I have reinstalled Wordpress. No difference.

Well clearly something has happened or you wouldn't be getting more cpu usage.

Are you sure you're looking at the right access logs? Virtual hosts often have their logs split one per host.

I used SuEXEC so each vhost uses seperate php running its own uid/gid.

A little bit after 8PM local time, the linode appears to have find its peace. Just like when it started, it ended with no reason.

I will keep an eye on it over the night.

Thanks.

@obs:

Well clearly something has happened or you wouldn't be getting more cpu usage.

Are you sure you're looking at the right access logs? Virtual hosts often have their logs split one per host.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct