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
|