Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have apache MaxMemFree 150 set in httpd.conf. However, when I use htop/top to look at the apache process, it still eat 648M shown below. Did I miss anything?

16514 apache     20   0 1157M  648M  7884 S  0.0  8.2  0:00.00 /usr/sbin/httpd
16546 apache     20   0 1157M  648M  7884 S  0.0  8.2  0:00.00 /usr/sbin/httpd
16513 apache     20   0 1157M  648M  7884 S  0.0  8.2  0:19.78 /usr/sbin/httpd
16524 apache     20   0 1124M  613M  7956 S  0.0  7.8  0:00.00 /usr/sbin/httpd
16544 apache     20   0 1124M  613M  7956 S  0.0  7.8  0:00.00 /usr/sbin/httpd
16520 apache     20   0 1124M  613M  7956 S  0.0  7.8  0:20.32 /usr/sbin/httpd
16524 apache     20   0 1122M  609M  7956 S  0.0  7.7  0:00.00 /usr/sbin/httpd
16544 apache     20   0 1122M  609M  7956 S  0.0  7.7  0:00.00 /usr/sbin/httpd

PS: I'm trying to troubleshoot a mod_perl app which may have some memory leak. However, I can't change the code. I'm thinking to have apache kill the process after a while to release the memory.

share|improve this question
    
MaxMemFree won't do anything to fix a leak. Memory that's leaked isn't free. –  David Schwartz Sep 27 '13 at 7:22
    
Any suggestion for killing those processes? It seems those processes become bigger and bigger and they are not being kill even if I set MaxRequestsPerChild for 1000, they are not being killed after it reaches 1000 (shown in server-status, unless I'm looking at wrong place.) The only work around right now is to restart apache to release the memory. –  compass Sep 27 '13 at 21:24

1 Answer 1

Linux ate your RAM -- have a look at this page on how Linux allocates memory.

Update:

Outside the obvious finding the source of the memory leak in the app and fixing, try the following:

  • Restart httpd at regular intervals using cron or scripts checking resource consumption. Parse the output of a Nagios script or something like [check_httpd_limits][2] and use it as a check. This is not a good long term option.

  • Tune your instance of apache httpd. The output of check_httpd_limits can be helpful in this regard.

  • Look at Control Groups to see if you can limit resource consumption. Be prepared for the possibility that your app and other components on your server may react 'aversely' to it.

You might be looking at a combination of things.

share|improve this answer
    
Thanks. I'm aware of disk cache. However, it don't believe this is the case. As httpd processes grow, they will eat all the swap space and eventually kill the processes. In Apache log, it shows out of memory. –  compass Sep 27 '13 at 21:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.