1

I currently have a dedicated server from which I provide shared hosting for some clients of mine.

Server specs

  • AMD Athlon(tm) 64 X2 Dual Core Processor 4000+
  • 4GB DDR RAM
  • 1x Seagate 1000GB

And I'm running Apache 2.2.24 on a CentOS 6.0 64-Bit OS.

In my Directadmin control panel I've been receiving notices that my load is too high (it goes over 100 sometimes) and since installing htop I've noticed it is mostly apache (httpd) causing the CPU peaks. These surges last a couple of minutes causing the CPU load to reach +90 %. The memory load is consistent with only 25% used.

I've never really optimized or tweaked an Apache server before and therefore I'm in dire need of advice. What settings should I modify in order to prevent/minimize the CPU load?

Thank you in advance!

Güney
  • 11
  • 2
  • 2
    This is **precisely** the reason professional linux sysadmins don't use GUI control panels. They act as a (completely unnecessary) crutch, preventing you from learning the skills necessary to admin, troubleshoot, optimize, etc. Hire someone to help you out this time, remove Directadmin, and you'll learn a ton in the process. – EEAA Feb 05 '14 at 03:18
  • Thank you for the fast response. I need directadmin for my customers otherwise I'd be using NGINX with no control panel. I've been hiring people all of the time so far. It is because I'm currently learning and understanding more and more, that I'd like to solve something like this myself for a change. If that is possible of course :). – Güney Feb 05 '14 at 03:21
  • 1
    The topic is too large for a bite sized answer. Read this for starters: http://httpd.apache.org/docs/2.2/misc/perf-tuning.html Then search Google for Apache optimization guides. – Lothar_Grimpsenbacher Feb 05 '14 at 07:20
  • Thank you for the answer. I'll try to be more precise than, I was in particular interested in points that were made on http://linuxstuffs.wordpress.com/apache-optimization/ and whether the practice of taking 4 times the RAM of your server was sufficient in order to improve the performance of the server. – Güney Feb 05 '14 at 13:49

1 Answers1

1

OK, three key points before I actually get to answering your question:

First, "CPU % Busy" is a crap metric. Ignore it.
If this value is less than 100% your server is under-utilized (the CPU is idle doing nothing).

Second, and similarly, "Load Average" isn't a great metric (though it's better than "CPU % Busy").
Load Average <= number of cores in the server is a good rule of thumb, but if the load average is 10000 and the system is performing well what do you care?

Third, DirectAdmin, cPanel, and all of their ilk are terrible. They're like keeping the training wheels on your bike forever: You'll never learn how to ride if you don't take them off.
You will likely not be able to really optimize your system while using DirectAdmin or any other "control panel" - start planning to get rid of it (or if you can't, at least turn off its nuisance alerting and implement proper monitoring software - something that alerts on performance rather than "Oh hey the server looks a little busy").


Bottom line: If your system is performing well enough to meet your needs don't mess with it.

If it isn't performing well (or you want to mess with it anyway) read the documentation that Lothar pointed you to and make sure you understand what each parameter you're changing does.
(The kind of cookbook cargo-cult system administration that "Linux Stuffs" article you linked to is perpetuating with their suggested values is wrongheaded: Most of the advice is generally good, but you need to go read the Apache Project's documentation for each of those parameters, thoroughly understand what they do, and determine what the right value is for your environment, otherwise you're not really being a sysadmin, you're just pushing buttons.)

You should also refer to this Server Fault question on capacity planning for web sites for some general guidance - Remember: the only way to know how a machine will perform under load is to test it.

voretaq7
  • 79,345
  • 17
  • 128
  • 213