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 had a VPS with DirectAdmin running on CentOS 5.7 with 512 MB RAM with Apache and MySQL. The problem I was having with it was that it was using around 115 MB RAM upon boot and this was rising to 200 MB after a while. Every 3 or 4 days the VPS was crashing and when I looked at the system log I kept seeing out of memory issues and this is what was causing the crash so what I did yesterday was upgrade this to a 1024 MB package thinking 1 GB of memory should be enough.

But now it still starts with 115 MB but eventually rises to 700 MB. I don't understand why it's not going down? I am guessing it will continue to rise till it touches 1 GB and crash again.

My impression was that a web server would work as follows:

  1. Starts with x amount of memory
  2. Stays at x amount of memory
  3. A website request is made so the server fires up whatever is required to process this request and uses y amount of memory. Once the request has been served, it goes back to x amount of memory

But in my case, it seems once it reaches y amount of memory, it says there even if no requests are being made.

Would appreciate if anyone could point me to the right direction.

-=Edit=-

Hi. I looked into that but it doesn't seem to be the cause. I have kept an eye on this since yesterday and it doesn't look like this is being caused by apache or mysql. I think it's something else. Output of ps is here: http://pastebin.com/8jqTgETZ

Here is my analysis of the output:

pop3-login = 1.6% / 16.38 MB imap-login = 1.6% / 16.38 MB mysqld = 16% / 163.84 MB httpd = 3.3% / 33.79 MB

This basically remains consistent. So I don't understand what it is that's not consuming memory in the beginning for a while but is starting to eat memory afterwards.

Last night (12 hours back) before going to bed, the system was using around 500 MB of memory. Now it's using 900 MB. 100 MB more and it will again run out of memory.

share|improve this question
    
Try analyzing the "ps" output. Also, if you're using Apache with prefork, you may check you MaxSpareServers directives. –  Georgi Hristozov Jan 24 '12 at 10:05
    
Could you post the output of cat /proc/meminfo as well? –  the-wabbit Jan 25 '12 at 13:16
    
Hi syneticon-dj. You can find the output of /proc/meminfo here: pastebin.com/wScJHGQN Is there anything there that could point me in the right direction? –  Naif Amoodi Jan 25 '12 at 18:20

1 Answer 1

You might be seeing some kind of memory leak within your web services' code. Check the apache memory usage using ps, top or htop and if it keeps raising, consider lowering MaxRequestsPerChild in your apache configuration as a quick&dirty workaround.

share|improve this answer
    
Hi syn. Please read my reply. It's the part after '-=Edit=-'. I couldn't leave that as a comment because it was too long so I had to edit my original post. –  Naif Amoodi Jan 25 '12 at 13:11

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.