Monday, October 8, 2007

Running a site on a Virtual Private Server with LAMP

Thought I'd jot a few notes on my experience running a site ( on a VPS.

My single biggest problem has been monitoring memory usage. VPSen throttle you on a) bandwidth, b) disk space, c) CPU, and d) memory. The first three are usually quite easy to monitor on graphs and also, I've found, hard to over-consume. Disk space is probably the easiest one of the bunch to off-site, via S3 and others. But memory. Man. Every so often I'll get pegged with a burst of traffic and apache sucks up that last bit of memory, and then wham - the VPS kernel starts trying to kill things - apache, mysql, etc.. but it doesn't work. Even when the traffic looks like it's come down again, the memory situation is still "stuck". Fortunately, because of Xen and GPLHost's awesome technology, it's real easy - and seems safe - to recycle the machine and then all is normal again. Granted, I'm running a memory-needy webapp on 256MB of RAM. I wish one of these folks (GPLHost, slicehost, etc.. ) would offer VPS where I could buy the pieces of the puzzle I need in increments. I think I could easily buy up more RAM and give back disk and CPU. Oh well.


Christopher J. Bottaro said...

Yeah man, tell me about it. I have the same problems. In a virtual server environment, they typically down allow swapping, which makes sense, you don't want one guy's app slowing the entire physical machine to a crawl. The down side is, when you run out of memory, your app typically crashes.

elsigh said...

Indeed. Recently we did some apache and mysql memory tuning along with telling the kernel to try to be less "swappy". Using atop it's easy to tell that things are improved.