Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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:

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

705 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