Wednesday, April 22, 2009

OpenVZ Burstable Memory

So I signed up for a new VPS server the other day and this time it was an OpenVZ based environment. The specs said it had 512MB of RAM burstable up to 768MB. These sounded like reasonable numbers, but at the time I didn't really think about what burstable means.

On a normal linux machine (and I assume other OS's work in a similar way), when your RAM is full you start using swap space (sometimes known as virtual memory), which is stored on the hard disk. It's pretty much the same as RAM, but reading off the HDD makes it slower. If your RAM is constantly full and you're always relying on SWAP you should buy more RAM, it's the easiest way to get a performance increase on your box.

Anyway, on this OpenVZ system it's a virtual server so you're sharing the actual RAM with a bunch of other VPS's on the same physical hardware. As far as the virtualised OS is concerned it just has 768MB, and no SWAP space. The problem is though, when it gets past 512MB it starts moving into the burstable area, which could simply just be renamed "Unreliable Memory" because at any point it could just disappear and crash your application because someone else's server is also using up a lot of memory.

So lets take a look at an example situation. Most of the time my memory use might stay below 512MB of RAM, but every now and then I need to repopulate the whole database from a backup (don't ask why), which may push the memory usage over the top. The burstable memory "might" cater for this if it only needs the memory for a minute or so but if it needs it for longer or the burstable memory isn't available because of other VPS's, my application will simply fail.

I need this for a production environment and the idea of having "Unreliable" memory just doesn't cut it. The performance might be a bit slower, but at least SWAP space wouldn't crash my application.

So it seems to me that OpenVZ is designed to rip-off the consumer, forcing me to upgrade to a guaranteed 768MB of RAM even though I only need more than 512 once in a blue moon. When my memory usage peaks, it's normally because an important process is running so I'd much prefer the application to use reliable, cheap but slightly slower SWAP space rather than burstable memory.

The moral of this story is... don't use OpenVZ, choose XEN virtualisation and setup swap space.

2 comments:

  1. You shouldn't blame the software. As you said "at the time I didn't really think about what burstable means.". For some situations burstable memory is what you want, but probably not in a shared hosting environment unless undersold to normally have spare capacity. So take issue with the hosting provider if their advertising was misleading or do more research before you buy.

    ReplyDelete
  2. This is true, OpenVZ isn't completely evil. From a Green IT (GIT) perspective it's actually pretty good because it's so efficient at making the most of resources it has. My cynical comments above were from a subscribers point of view, but from the pov of a provider burstable memory means you don't have resources wasted by subscribers who sign up for 512MB of RAM but rarely need more than 256MB.

    ReplyDelete