Lack of RAM will kill your blog host virtual machine

9 years ago

I know what you are thinking: "Well, duh Pedro, how come you didn't know that?".

I'll explain: Recently i started having some service shortages on my blog. From times to times the CPU usage would just go rooftop and then nginx and apache both stopped serving requests. I am using Linode as my host, where i have a nice virtual machine (or node, as they call it) with some reasonable values in terms of CPU and bandwidth monthly usage. The weakest link was the RAM; it only had 386Mb.

A while back i developed Jumperr.com and i figured "hey, i already have the node, so i'll just host it there". Some time after deploying jumperr, i started noticing these shortages coming up maybe once a month, or every two weeks (i notice the pattern now, not then :)). At some point i even considered switching hosts (to slicehost, for example), but i never thought that memory could be the problem (after all they are not that accessed anyways). Looking at the system logs i just could not figure out what made the machine stop working just like that.

About one month ago, i decided to develop a stupid website that allows you to bomb countries using a Google maps interface. And then, surprise, the shortages became more and more frequent (sometimes 4 per day!). In one of these fails i decided to try to login to the node using Linode's ajax ssh interface on their dashboard. And that's when i saw it: a bunch of "out of memory" errors right on the boot list. Since when you connect normally via SSH you don't see the prompt on the remote end, i never saw these before.

So there you go, lesson learned. If it spikes, chances are you are out of memory :)

By the way, if you are a proper Linux/Unix admin, was there a log that might contain those errors that i missed?