OpenVZ redefines RAM

December 25, 2006 Link to post  Permalink

My new hosting location is an OpenVZ VPS at Quantact. This is working out pretty well, except for one thing – Ram usage.

One of the things a VPS provides as part of the package is Ram. The usual definition of Ram is real memory, the sticks of chips you buy to put into a machine. OpenVZ defines Ram as something different. To OpenVZ, Ram is actually virtual memory.

This is a big deal, as a bunch of the things I want to run use very little real memory, but do take up a bunch of virtual memory. Here’s some examples:

MySQL (using a small configuration!):

- Resident memory for my application: 10MB
- Virtual memory applied to my account: 80MB

- Resident memory: 2MB
- Virtual memory: 45MB

These two applications put me at 130MB of Ram used before I start writing code. Since I’m writing Rails code, I need all the memory I can get. Two Mongrel processes running Typo can easily be 60MB each, putting us at 250MB for my blog!

There are all sorts of posts around the web about this issue, and the OpenVZ guys try to defend what they are doing, but the big problem is that they are using the wrong terminology for memory, and this will eventually make people grumpy. If you’re measuring virtual memory, tell people that the limits are for virtual memory, not ‘Ram’.

I think they do this to help make VPS hosting costs very competetive with Xen based systems. You only find out later that you actually need to buy twice as much memory as you thought you needed.

How about setting up some swap space, I hear you ask. Well, OpenVZ doesn’t allow swap space in the guest OS space. Swap is managed globally, so you have no control over this. This is an artifact of the virtualization technology used by OpenVZ. Xen does allow swap space, so doesn’t need as much Ram as an equivalent OpenVZ configuration.

The takeaway here is that, if you are looking at an OpenVZ VPS host, you should budget for more Ram than you think you need, as you will probably need it.

Tim of Quantact has put up a wiki page explaining a little about the OpenVZ Ram usage

Note: I believe Virtuozzo is the same basic code as OpenVZ, so the same issue applies.