Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

VSwap

277 bytes added, 01:00, 18 June 2013
improved
'''New [[Download/kernel/rhel6|RHEL6-based OpenVZ]] kernel''' has a new memory management model, which supersedes [[UBC|User beancounters]]. It is called '''VSwap'''.
Now you can set two primary parameters: <code>ram</code> and <code>swap</code> (a.k.a. <code>physpages</code> and <code>swappages</code>), while all the other beancounters become secondary and optional.
* '''physpages'''
: This parameter limits sets the amount of fast physical memory (RAM) available to processes inside a container, in memory pages.
: The <code>barrier</code> is ignored and should be set to 0, and the <code>limit</code> sets the limit.
: Currently (as of >= 042stab042) the user memory, the kernel memory and the page cache are accounted into <code>physpages</code>.
 
* '''ram'''
: is an easy shortcut for physpages.limit, and is measured in bytes
* '''swappages'''
: This parameter limits sets the amount of swap space which can be used for "slower memory" (vswap) available to processes inside a container, in memory pages.
: The <code>barrier</code> is ignored and should be set to 0, and the <code>limit</code> sets the limit.
 
* '''swap'''
: is an easy shortcut for swappages.limit, and is measured in bytes
The sum of <code>physpages.limit</code> and <code>swappages.limit</code> 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
swapping. Actual swap out occurs only if there is a global memory shortage
on the system.
 
{{Note|swap used by a container can exceed <code>swappages.limit</code>, but is always within sum of <code>physpages.limit</code> and <code>swappages.limit</code>.}}
== Setting ==
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.
== Convert non-vswap CT to Vswap ==
== How to distinguish between vswap and non-vswap configs? ==
Both <code>vzctl</code> and the kernel treats a configuration file as vswap one if PHYSPAGES limit is '''not''' set to <code>unlimited</code> (a.k.a. [[LONG_MAX]]).You can also use the following command:   # vzlist -o vswap $CTID
In addition, vzctl checks if kernel support vswap, and refuses to start a vswap-enabled container on a non vswap capable kernel. The check is presence of <code>/proc/vz/vswap</code> file.