Go Premium for a chance to win a PS4. Enter to Win


Apache CPU Usage high - troubleshooting

Posted on 2011-02-18
Medium Priority
Last Modified: 2013-11-05
I have a dedicated server with the following hardware:
Dual Intel Xeon-Harpertown 5430-Quadcore [2.66GHz]
8c211052fa8       Adaptec \ 3405 \ SATA/SAS RAID
4 x dqa0p6500378       Fujitsu MAX3073 SAS MAX3073RC (Raid 10)

We recently moved to this dedicated solution as we outgrew our old VPS.  The new setup is running Plesk 10.1.1.  We have 2 domains on the server (1 very little traffic, the other doing about 1.5TB/month).

The server should be able to handle the load and it appears it is.  The CPU load average is around 1-1.10 at any given time, which is a lot lower than our old VPS. (screenshots included)

The problem though is that the new site is very slow and sluggish compared to the old server, yet this thing has 4 x the amount of RAM, faster hard drives, and a lot more proc power.  I have gone through and optimized the httpd.conf as much as I can.  I tried high values and low values for the prefork StartServers, MinSpareServers, MaxSpareServers, etc.  My current settings are:
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000

I think there is a problem with a script or something that is making the server keep httpd processes active.  We have httpd processes active for up to 25 minutes.  I want to know if there is a way to trace a process to its originating file so that I can trace it back to the script that is calling it.

Thanks for the help.
Question by:termlimit
  • 3
  • 2
LVL 27

Accepted Solution

Nopius earned 2000 total points
ID: 34934039

1) Enable extended server status in apache.
Open Apache's httpd.conf and add these lines:
ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from x.x.x.x y.y.y.y

Open in new window

Where x.x.x.x is IP address from which you will access /server-status page.

2) Restart apache.

3) When having big load average, open http://yourserver.com/server-status page

4) Find scripts, that have the most 'Req' and 'CPU' values - that's your problematic scripts. Review and profile them and find where the most time is spend. This php tool may help you: http://www.xdebug.org/docs/profiler

Hope this helps.

Author Comment

ID: 34934184

Thanks for that tip I am going to try that right now and I'll get back to you in a few hours.  I did install apachetop last night and that definitely pinpointed some scripts, but nothing that was out of the ordinary.  Most of the scripts it found were ones that were accessed a lot, which is normal.

Thanks though will check back in.

Author Comment

ID: 34934445

After further research it appears that the new Plesk Health Monitoring feature is not multi-processor aware.  Since this is the case the processor is actually only using about 5-10% of total CPU percentage.  Right now it is only showing the total CPU usage against 1 core, we have 8.

Thanks for the help and you can get the points, since that tool you provided is actually pretty nice.
LVL 27

Expert Comment

ID: 34934563
Thank you for accepting.

> Right now it is only showing the total CPU usage against 1 core, we have 8.

Load average shows CPU queue size, so on 8 cores LA 8.0 means 100% load. So even with a Plesk, that is not aware of multiple cores, you can see your load.

Also I recommend you you to increase some values in config:
MaxSpareServers   50
ServerLimit      512
MaxClients       512


Author Comment

ID: 34934587

I understand that part of Top from the command line.  The graphs I posted were part of the Health and Monitoring function of Plesk.  This is not accurately showing the Apache CPU Usage against 8 cores, I am not sure where they get this information, but as you can see from the graph above the Total System CPU usage is very low (currently around 10% or so).

I have asked this to the technicians at Plesk as they have no documentation on this.  I did conduct a test on a 4 core, 6 core, and 8 core system.  The load went up by 50% from 4-6, and 33% from 6-8.  This means that the system is basing itself off of 1 core and not the total number of cores.

I have changed those settings in httpd.conf, did that before I even posted this question.  That is why I posted the question, all the normal optimizations were not helping bring down the Apache CPU usage (not to be confused with what Top is showing).

Make sense?

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question