OpenVZ VE memory consumption (in Proxmox VE v1.0)

murat

Renowned Member
Dec 10, 2008
8
0
66
Hi,

I've read and heared lot about the low mem consumption of OpenVZ VE's. Stories about running 200 VE's (with only apache, and usual stuff) on 2GB of RAM.

When I have a look at mine machine I can tell you this is impossible!
If I execute the top command within the VE's each VE consumes at least 140MB of RAM.

One of the VE's is for example the debian-joomla template from proxmox (apache, php5, mysql, 512MB Ram assigned). This VE consumes (at idle) 140MB. When under little load (testing a simple php page on apache with ~50 concurrent users and ~10% cpu utilization) the mem consumption goes a little above 200MB.

If I assign 200MB of RAM to each comparable VE this means I can only have 10-12 VE's on a machine with 2GB RAM (host's mem consumption not taken into account).

200 vs. 12!

How can one have 200 VE's running on 2GB RAM??
Do I have to tune something to achieve lower mem consumptions?

Has anyone else running the debian-joomla template? What is your (idle) memory rate?

I've done some (simple) tests with different OpenVZ and KVM templates measuring the cpu and mem rates using simple Java app tests on Tomcat.

KVM VE's appeared to consume between 2-4 times more CPU then OpenVZ templates. Mem consumption was about the same BUT with each n'th test the mem usage kept increasing on KVM templates while OpenVZ templates stayed about the same after 3rd run. I can send my spreadsheet with the test data to anyone who is interested.

I'm using: pve-manager/1.0/3463 on a Quad Core Xeon with 12GB RAM.

Note: I don't have to deploy such high number of VE's running on my machine. It's just curiosity.
 
200 vs. 12!
How can one have 200 VE's running on 2GB RAM??

The joomla template uses apache2 and a full featured mysql database server!

Do I have to tune something to achieve lower mem consumptions?

Don't use a database server for example. But running 200 VMs with 2GB gives you 10MB per VM - this is too less for running apache.
 
Or, if your database needs are very low-end you can tweak mysql's configuration to use very little RAM. On a Debian system with mysql installed, check out /usr/share/doc/mysql-server-5.0/examples/my-small.cnf

Another way to conserve RAM is to use the Apache hybrid MPM and let it do some threads rather than using the standard default preforking MPM which generates many big fat children which eat tons of RAM. If you use PHP, run PHP using FastCGI rather than using it as an apache module.

The default most common way of doing things which is apache with preforking MPM and PHP as an Apache module uses an enormous amount of RAM. Each simultaneous connection served requires one (typically) 15MB-40MB process with usually at least 6 children spawned and kept in reserve. On a lightly-loaded web server with some actual clients fetching things from it you can easily get up to 40-80 of those big fat 15MB-40MB processes going.

You can avoid eating RAM unnecessarily, but you have to do things non-default.

All of this applies to what you're doing inside your containers, not to the host machine which you don't really want to mess with, they're using mod_perl for the Proxmox VE web interface and you should leave it alone.

And of course if you're using the Plesks and cPanels of the world or you're not willing or comfortable with setting up PHP with FastCGI and Apache with a different MPM worker you're kind of stuck and you should just drop in 8-16GB of RAM.

My initial buildout for my Proxmox VE box was 8GB of RAM, I'm considering going to 12 or 16GB, I have plenty of stuff going on including a couple of KVMs.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!