Linode Forum Index Linode Forum
Linode Community Forums
 


How Do I Identify Cause of CPU Spikes

Click here to go to the original topic

 
       Linode Forum Index -> Performance and Tuning
Author Message
kutu



Joined: 25 May 2011
Posts: 16

Posted: Thu Jan 12, 2012 3:03 pm    Post subject: 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))
Back to top  
glg



Joined: 09 Jan 2009
Posts: 505

Posted: Thu Jan 12, 2012 8:05 pm    Post subject:  

are you using prefork and is your maxclients set too high?
Back to top  
kutu



Joined: 25 May 2011
Posts: 16

Posted: Fri Jan 13, 2012 8:44 am    Post subject:  

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.


Code: # 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

Code:
Timeout 300
KeepAlive On
KeepAliveTimeout 5
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          80
    MaxRequestsPerChild   0
</IfModule>
Back to top  
kutu



Joined: 25 May 2011
Posts: 16

Posted: Fri Jan 13, 2012 3:16 pm    Post subject:  

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
Back to top  
Vance



Joined: 18 Jan 2009
Posts: 355

Posted: Fri Jan 13, 2012 10:32 pm    Post subject:  

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.
Back to top  
kutu



Joined: 25 May 2011
Posts: 16

Posted: Sun Jan 22, 2012 11:23 pm    Post subject:  

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.
Back to top  
glg



Joined: 09 Jan 2009
Posts: 505

Posted: Sun Jan 22, 2012 11:46 pm    Post subject:  

kutu wrote: 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.
Back to top  
 
       Linode Forum Index -> Performance and Tuning
Page 1 of 1