0

On our CentOS 6 server, we have now a lot of CPU overload, while our RAM is almost not used.

KeepAlive is set to "on" because we have some AJAX elements on your website and serving many files such as images, etc...

Do you have some recommend settings for me to reduce the apache CPU load? Like said, we have a lot of free RAM on this server, but the CPU power is weak.

lickmycode
  • 167
  • 3
  • 9
  • 1
    It's good that you recognize that it's important that RAM be *used*. I'd start out by undoing any tuning or tweaking that's already been done. You would be surprised by how often someone has tuned the machine to keep as much RAM free as possible -- the opposite of what you would want to do to improve performance. Look carefully at any "tweaks" to the OS's vm settings. – David Schwartz Apr 24 '14 at 20:05

3 Answers3

2

Would you accept "fix the programming or get adequate hardware"?

YOu can generally not relplace CPU with RAM - normally too little RAM means swapping which means little CPU utilization, but it does not work the other way.

For me it looks like "proper debugging and optimization based on competent developer knowledge and the use of a profiler" is in order now, this is not a sysadmin issue.

TomTom
  • 50,857
  • 7
  • 52
  • 134
0

I doubt that Apache is the one consuming all the CPU and I rather suspect that you are running something like PHP scripts using mod_php that do intense processing. If that's the case then switch to a more reliable way of running PHP, such as PHP-FPM and do some debugging on your PHP code.

Florin Asăvoaie
  • 6,932
  • 22
  • 35
0

Use caching at whatever level you can to use more RAM and less CPU (not guaranteed), for example front-facing caching with Varnish and database caching with memcache and/or more aggressive database cache settings; if you have spare RAM use it.

Also if you can't turn off KeepAlive perhaps you can still tune down its timeout value.

EDIT: Profiling what's causing the CPU usage and why would be the starting point

LinuxDevOps
  • 1,754
  • 9
  • 14
  • timeout value is set to 3, and for some unknown reasons, when activating memcache, the members can not login anymore. – lickmycode Apr 24 '14 at 20:20
  • what's your stack? lowest hanging fruit is cache settings in database for performance and less I/O (it may not affect CPU usage) – LinuxDevOps Apr 24 '14 at 20:22