LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Linux VPS using up all available RAM (https://www.linuxquestions.org/questions/linux-server-73/linux-vps-using-up-all-available-ram-4175416334/)

SeSoX 07-12-2012 07:11 AM

Linux VPS using up all available RAM
 
Hi there,

I've got a vps online and I'm using apache + lighttpd for two websites on the internet. The problem is that apache seems to be using all the ram on the server which is 512MB.

The websites don't really have millions of visitors so I'm wondering if it maybe because of a misconfiguration issue in apache ? I don't know but with not many users it looks weird to me that apache is using so much ram.

Can anybody give me a hand with this ?

Thanks :)

zordrak 07-12-2012 07:36 AM

Can you provide some detailed RAM usage info?

To be honest with only 512MiB RAM I'm not totally surprised. You haven't mentioned which distro it is - some are configured to be much more RAM hungry than others by default and it's possible you have other system services running that you've no need for sitting in the background hogging extra space.

If apache really is using all that RAM then I would definitely start looking at your apache config - but also what else you may be using. Any PHP code? What's php been told about memory usage? etc.

snowday 07-12-2012 07:39 AM

Please provide the output of:

Code:

free -m
(use code tags to make it legible, please)

SeSoX 07-12-2012 09:32 AM

Thanks for the reply guys :)

The system is debian and here is a copy paste from top:

Quote:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
870 www-data 20 0 185m 14m 3892 S 3 2.9 0:00.94 apache2
724 www-data 20 0 189m 18m 4328 S 2 3.6 0:05.98 apache2
857 www-data 20 0 187m 17m 3880 S 2 3.3 0:00.67 apache2
806 www-data 20 0 190m 19m 4000 S 2 3.8 0:02.87 apache2
869 www-data 20 0 186m 15m 3660 S 2 3.1 0:00.81 apache2
And free sais:

Quote:

root@vps:~# free -m
total used free shared buffers cached
Mem: 512 185 326 0 0 108
-/+ buffers/cache: 76 435
Swap: 0 0 0

It seems that there were many users making request to apache at the same time and that's why it used all the ram, and it's not the first time, how can I fix this so it doesn't happen again, maybe with apache ?

snowday 07-12-2012 09:45 AM

More RAM and/or swap is my recommendation if your existing RAM is not sufficient to handle peak traffic. 512mb is on the small side, in my opinion.

That being said the data you posted above shows you have 435mb free. For help interpreting these numbers: http://linuxatemyram.com

SeSoX 07-12-2012 09:52 AM

in the previous message I meant that maybe it could be fixed with iptables ? (not with apache xD)

What happened could be considered more like a DoS attack than a peak really.


All times are GMT -5. The time now is 07:38 PM.