How Do I Identify Cause of CPU Spikes

I'd like to know what web page and / or script is being executed to cause the spike.

htop shows apache as the culprit

/usr/sbin/apache2 -k start

This started on the 6th and the traffic to my wordpress site is down, so it's not a usage thing. Also no changes were made on or around the 6th

Nothing funny in the apache logs either.

Any help is appreciated!

Linode 2048

(Latest 3.0 (3.0.4-linode38))

6 Replies

are you using prefork and is your maxclients set too high?

prefork yes

maxclient, I figured was great, been running without issues since I moved to this bigger Linode, no issues with traffic it's down not UP right now.

# apache2 -V
Server version: Apache/2.2.14 (Ubuntu)
Server loaded:  APR 1.3.8, APR-Util 1.3.9
Compiled using: APR 1.3.8, APR-Util 1.3.9
Architecture:   32-bit
Server MPM:     Prefork
threaded:     no
forked:     yes (variable process count)

apach2.conf

Timeout 300
KeepAlive On
KeepAliveTimeout 5
 <ifmodule mpm_prefork_module="">StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          80
    MaxRequestsPerChild   0</ifmodule> 

Keep in mind I don't think the server is configured wrong…

I want to know how to identify the script or web page that is causing the CPU to jump… I do not think this is a max client type issue.

Many thanks

You could add the %D or %T format string to your Apache logs and see if certain requests are taking an inordinate amount of time to complete. Note that reasons other than being CPU-bound could increase those numbers, so further analysis will be required.

Thanks Vance

No luck so far and still dealing with issues since the 6th.. have no clue what happened on the 6th, no changes on my end.

@kutu:

Thanks Vance

No luck so far and still dealing with issues since the 6th.. have no clue what happened on the 6th, no changes on my end.

Try lowering your MaxClients. If your apache instances are taking up a lot of memory (ie lots of installed modules), 80 may be too many even on a 2048.

Have you seen a traffic spike since the 6th? It could be that you just weren't getting up to the MaxClients before that. That's how I got bit the first time with this issue. I was fine with low traffic, then a traffic spike actually caused my server to get up to the MaxClients. It was too high and I was screwed.

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