Difference between revisions of "VSwap"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(no need to set any secondary parameters)
(Setting: added)
Line 20: Line 20:
 
swapping. Actual swap out occurs only if there is a global memory shortage
 
swapping. Actual swap out occurs only if there is a global memory shortage
 
on the system.
 
on the system.
 +
 +
== Setting ==
 +
 +
Since vzctl 3.0.30, you can use <code>--ram</code> and <code>--swap</code> parameters, like this:
 +
 +
vzctl set 777 --ram 512M --swap 1G --save
 +
 +
If you are converting an existing CT from old (non-vswap) configuration, you can either
 +
* leave all the other UBC parameters as-is,
 +
* or set those to 'unlimited',
 +
* or remove those from configuration file.
  
 
== See also ==
 
== See also ==

Revision as of 10:41, 10 January 2012

New RHEL6-based OpenVZ kernel has a new memory management model, which supersedes User beancounters. It is called VSwap.

Now you can set two primary parameters: physpages and swappages, while all the other beancounters become secondary and optional.

  • physpages
This parameter limits the physical memory (RAM) available to processes inside a container.
The barrier is ignored and should be set to 0, and the limit sets the limit.
Currently the user memory and the page cache are accounted into physpages.
  • swappages
This parameter limits the amount of swap space which can be used for processes inside a container.
The barrier is ignored and should be set to 0, and the limit sets the limit.

The sum of physpages.limit and swappages.limit limits the maximum amount of allocated memory which can be used by a container. When physpages limit is reached, memory pages belonging to the container are pushed out to so called virtual swap (vswap). The difference between normal swap and vswap is that with vswap no actual disk I/O usually occurs. Instead, a container is artificially slowed down, to emulate the effect of the real swapping. Actual swap out occurs only if there is a global memory shortage on the system.

Setting

Since vzctl 3.0.30, you can use --ram and --swap parameters, like this:

vzctl set 777 --ram 512M --swap 1G --save

If you are converting an existing CT from old (non-vswap) configuration, you can either

  • leave all the other UBC parameters as-is,
  • or set those to 'unlimited',
  • or remove those from configuration file.

See also