OpenVZ Forum


Home » General » Support » How To Change the Amount of Memory It Takes to Run A Container? (Each container takes up 700,000kb to start)
icon9.gif  How To Change the Amount of Memory It Takes to Run A Container? [message #43130] Tue, 26 July 2011 18:44 Go to next message
imatwb is currently offline  imatwb
Messages: 11
Registered: June 2011
Junior Member
I know I can set the resource limits inside of a container using the following commands before starting the container:
vzctl set $CID --physpages 0P:10000P --save
vzctl set $CID --vmguarpages 0P:10000P --save
vzctl set $CID --oomguarpages 0P:10000P --save

This does indeed set the resource limits inside the container as shown:

Tasks:  16 total,   1 running,  15 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:     40000k total,    18220k used,    21780k free,        0k buffers
Swap:        0k total,        0k used,        0k free,     9516k cached


However, running the top command from the host (the guy in charge of starting all of the containers) reveals this:

Before starting the container:
Tasks: 526 total,   2 running, 524 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.8%us,  0.3%sy,  0.0%ni, 98.8%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  12156848k total,  3698000k used,  8458848k free,   978368k buffers
Swap:  2064376k total,        0k used,  2064376k free,  1661636k cached


After starting the container:
Tasks: 556 total,   1 running, 555 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.1%us,  0.1%sy,  0.0%ni, 97.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  12156848k total,  4392708k used,  7764140k free,   978368k buffers
Swap:  2064376k total,        0k used,  2064376k free,  2302080k cached


So the container takes up about 700,000kb of memory to run (and only 40,000kb of that is actually allocated for it to use)

Is there a way I can decrease the 700,000kb of memory the container needs to run? I want to start 200 containers, but I only have 12 gb of ram. So at 700,000kb each, that's limits me to just 17 containers running total. Please advise. Thanks.

[Updated on: Tue, 26 July 2011 18:45]

Report message to a moderator

Re: How To Change the Amount of Memory It Takes to Run A Container? [message #43131 is a reply to message #43130] Tue, 26 July 2011 20:37 Go to previous messageGo to next message
Ales is currently offline  Ales
Messages: 330
Registered: May 2009
Senior Member
If you keep your server running long enough, your free RAM will go towards zero pretty quickly whether you create a single VM on it or not. That's the way linux manages RAM - it puts it to good use, instead of keeping it empty.

In this particular case, I think you are misinterpreting the top output. 700000k was not used for a container.

If you look closely, you'll see that top output before starting the container shows "1661636k" as "cached" and top after starting the container shows "2302080k" as "cached".

I'm sure there are numerous articles on the internet on what this means and those will give you a much better and more detailed explanation than I could.
Re: How To Change the Amount of Memory It Takes to Run A Container? [message #43144 is a reply to message #43130] Thu, 28 July 2011 20:55 Go to previous message
imatwb is currently offline  imatwb
Messages: 11
Registered: June 2011
Junior Member
Solved. Just had to use a smaller openvz template.
Previous Topic: vzlist invalid value for DEVICES error message
Next Topic: 1 server 2 drives
Goto Forum:
  


Current Time: Tue Aug 13 23:35:01 GMT 2024

Total time taken to generate the page: 0.02872 seconds