Apache "httpd" process, utilizing all my servers memory

21,046

Solution 1

As HTTP500 said, you probably shouldn't worry about it unless the machine is actually choking. Take a look at Help! Linux Ate My RAM!. It's not quite an analogous situation, as you have processes rather than buffers using up the RAM, but it's not too far off: your machine's physical RAM is a resource to be used, either with kernel buffers or spare Apache worker processes to promptly handle incoming requests. If you're not using RAM, you've overpaid for the size of your box.

Anyway, if you want to play with MPM settings, the Apache documentation is http://httpd.apache.org/docs/current/mod/prefork.html

You can perhaps reduce the MinSpareServers, StartServers, etc., as you've stated that the site is low traffic. You will then have more free RAM to be consumed by kernel buffers for their nefarious purposes.

Solution 2

linux using all your memory is normal, memory which isn't in use otherwise is re-purposed as disk cache. see: linux ate my ram

You can verify this by looking at the output of free -m and expect to see something like this:

             total       used       free     shared    buffers     cached
Mem:          7889       6887        101          0        106       2307
-/+ buffers/cache:       5373       3416
Swap:         1903         17       1886

the +/- buffers/cache line is the one you want. It adds cached ram to free to give you a better picture of how much memory is really available. In this case, You want to pay attention to the 3416 number, not 101.

Share:
21,046

Related videos on Youtube

Amivit
Author by

Amivit

Updated on September 18, 2022

Comments

  • Amivit
    Amivit almost 2 years

    My small ec2 instance with 1.7 GB memory, running the Amazon AMI based off of CentOS, has an issue with Apache utilizing way too much memory than it should. If you take a look at the screenshot, the memory usage will be at 90-100% until I reboot the httpd service, where it will start over, increasing its way back up to 90+ %.

    enter image description here

    I would really appreciate some assistance on how to locate the issue. Is this perhaps "normal" apache behavior, to utilize all available memory? Or is there a possible leak I have to hunt down. At the moment I'm a bit perplexed as to what could be going on.

    We are using the Apache MPM prefork, and no sql or anything similar - just apache. The website is here.

    • HTTP500
      HTTP500 almost 12 years
      It doesn't appear to use any Swap so what's the problem?
    • Amivit
      Amivit almost 12 years
      Shouldn't the fact that its using so much memory be a concern? Excuse my novice experience, I guess it might be an incorrect assumption. Maybe it's normal behavior and that Apache is designed to use all the memory it can grab, despite being a low-traffic website?