Not enough memory to be famous

Hi everybody,

With your help, my web server is finally up and runs not too bad (better than my english probably). But my website sometime is visited by a some people at the same time and my server has only 1G of memory with no swap (not enough money to take more…). When I’m looking at the “top” command, I see a lot of connexions taking a lot of memory and when there is no more memory, the server take a breathe for a while and launch a cleanup that generate some errors 500.

I read the page about apache processes (set up min and max values to 2 and 3) but the server still encounters the same problems. So I wondered if there was a way to slow down visitor queries into a sort of stack in order to limit the memory access. I mean when there is enough memory, the server respond within 0.2 sec. but I prefer wait 1 or 2 sec before giving a response instead of having an error 500. I really hope it’s clear enough to understand.

Do you know if it’s possible?

Your best bet would probably be to setup a swap partition for any overflow from the 1 gigabyte of RAM.

How much free space do you have on your hard drives?

Even just a 2 or 4 GB swap should resolve this issue for you if you have been getting along ok with only 1 GB of RAM.

Do you have any extra slots on your board for RAM? RAM is pretty cheap if you are out of hard drive space.

If you have an extra PCIe slot on your board, you could go as far as getting a PCIe card that is an SSD hard drive that you could use for swap. You get the quickness of a SSD hard drive along with the PCIe direct bus to the CPU. The only problem with this is that SSD’s have a finite amount of writes and using them as swap would use up the write count quickly as RAM and swap are frequently overwritten.


www.ryanelders.com

I don’t think swap is possible here because most proably the user is running a (low budget) openvz VPS.

You could check the “low memory guide” in the virtualmin documentation. or you could also consider to switch from Apache to Nginx (which has a quite smaller memory footprint - I heard).