OpenVZ vs Xen Memory Usage

 Posted on 11 March 2012

1330235754 openvz vs xen OpenVZ vs Xen Memory Usage

So while waiting for Enotch Networks to deliver my Directadmin license (which never did arrive), I decide to play a bit with the OpenVZ container that I had. I was curious as to how many processes can be run on a 512mb compared to a Xen Hypervisor.As usual, some details up front

1. Applications are installed until the OpenVZ VPS runs out of memory (because my Xen VPS is a higher specced VPS).

2. The OpenVZ container is a Hades 512mb Dedicated RAM with 512mb Burst RAM from Enotch networks.

3. The Xen Hypervisor is a 768mb Dedicated RAM with 1536mb Swap from XenVZ.

4. Memory usage is calculated slightly different in an OpenVZ container where virtual memory is taken into account  instead of the actual used memory. That said an OpenVZ container will report higher memory consumption compared to a real dedicated server.

5. This test will give an idea of how much you can really use on a OpenVZ container when installing commonly used applications.

Step 1 – Basic 64bit Debian 5 Install

Initially I wanted to just install Virtualmin and see how much memory is taken to run an idle Virtualmin box but it wouldn’t install properly on the 512mb OpenVZ container, running out of memory halfway through the installation script. Not giving up, I decided to install things manually.First lets see the starting memory usage of a fresh debian 5 install with nothing but barebones processes running.

Virtualization OpenVZ Xen
Applications Minimal Debian 5 install
Free -m enotch:~# free -m
total used free shared buffers cached
Mem: 512 10 501 0 0 0
-/+ buffers/cache: 10 501
Swap: 0 0 0<
xenvz:~# free -m
total used free shared buffers cached
Mem: 768 62 705 0 2 12
-/+ buffers/cache: 47 720
Swap: 1535 0 1535
Memory Usage 10mb 47mb

Step 2 – Debian 5 + LAMP

Standard LAMP install with Apache, MySql and PHP5

Virtualization OpenVZ Xen
Applications Apache, MySql, PHP
Free -m enotch:/# free -m
total used free shared buffers cached
Mem: 512 150 361 0 0 0
-/+ buffers/cache: 150 361
Swap: 0 0 0
xenvz:~# free -m
total used free shared buffers cached
Mem: 768 472 295 0 14 365
-/+ buffers/cache: 92 675
Swap: 1535 0 1535
Memory Usage 150mb 92m

Step 3 – Debian 5 + LAMP + Email

Still quite a bit to go before maxing out 512mb, so lets add a mail stack in there along with virus scanning.

Virtualization OpenVZ Xen
Applications Apache, MySql, PHP, Postfix, Dovecot, Amavis, ClamAV
Free -m enotch:/# free -m
total used free shared buffers cached
Mem: 512 324 187 0 0 0
-/+ buffers/cache: 324 187
Swap: 0 0 0
xenvz:~# free -m
total used free shared buffers cached
Mem: 768 706 61 0 21 448
-/+ buffers/cache: 237 530
Swap: 1535 0 1535
Memory Usage 324mb 237mb

Step 4 – Debian 5 + LAMP + Email + Jabber/XMPP

Finally lets add an XMPP/Jabber server to fill it up, Spamassasin is also enabled at this point. The ejabberd installation did fail halfway through on the OpenVZ container so I had to stop a couple processes and re-attempt the installation. This completed without any errors so I proceeded to restart the previously killed processes.

Virtualization OpenVZ Xen
Applications Apache, MySql, PHP, Postfix, Dovecot, Spamassasin, Amavis, ClamAV,
ejabberd, Screen, Irssi, rtorrent
Free -m enotch:/# free -m
total used free shared buffers cached
Mem: 512 455 56 0 0 0
-/+ buffers/cache: 455 56
Swap: 0 0 0
xenvz:~# free -m
total used free shared buffers cached
Mem: 768 683 84 0 126 213
-/+ buffers/cache: 343 424
Swap: 1535 0 1535
Memory Usage 455mb 343mb

Total Memory Usage

Lets subtract the base memory from the fresh Debian 5 install from the final memory usage in step 4.

Total OpenVZ memory usage = 455 – 10 = 445mb

Total Xen memory usage = 343 – 47 = 296mb

Summary

So there you go, with the same suite of applications installed, the OpenVZ container recorded about 150mb more usage compared to the Xen Hypervisor. Looking at the numbers, a 512mb OpenVZ container with no burst memory can only use approximately 350mb of RAM and even lesser so if you run Java applications that tend to allocate large amounts of virtual memory.  A good provider would therefore need to allocate an appropriate amount of Burst memory (usually 1.5 to 2x of dedicated memory) to allow you to fully utilize the advertised 512mb, say 768mb Burst for a 512mb Dedicated OpenVZ container.

Share with your friends!
Published by dennis in Web Hosting

There are No comments yet, be the first!

Write a comment

YES you can use HTML code in comments.
NO you cannot leave spam or insult anyone.

Your coment will be moderated the first time. Later on it will not be moderated as long as you use the same contact info.