Difference between revisions of "VSwap"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
m (Updated to reflect recent blog post by Kir that kmemsize, dcachesize, and locked pages can be set to unlimited for kernel 042stable042 and later)
(no need to set any secondary parameters)
Line 1: Line 1:
 
New [[Download/kernel/rhel6|RHEL6-based OpenVZ]] kernel has a new memory management model, which supersedes [[UBC|User beancounters]]. It is called '''VSwap'''.
 
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>physpages</code> and <code>swappages</code>, while all the other beancounters become secondary.
+
Now you can set two primary parameters: <code>physpages</code> and <code>swappages</code>, while all the other beancounters become secondary and optional.
  
 
* '''physpages'''
 
* '''physpages'''
 
: This parameter limits the physical memory (RAM) available to processes inside a container.
 
: This parameter limits the physical memory (RAM) available to processes inside a container.
: The <code>barrier</code> is ignored, and the <code>limit</code> sets the limit.
+
: The <code>barrier</code> is ignored and should be set to 0, and the <code>limit</code> sets the limit.
 
: Currently the user memory and the page cache are accounted into <code>physpages</code>.
 
: Currently the user memory and the page cache are accounted into <code>physpages</code>.
  
 
* '''swappages'''
 
* '''swappages'''
 
: This parameter limits the amount of swap space which can be used for processes inside a container.
 
: This parameter limits the amount of swap space which can be used for processes inside a container.
: The <code>barrier</code> is ignored, and the <code>limit</code> sets the limit.
+
: The <code>barrier</code> is ignored and should be set to 0, and the <code>limit</code> sets the limit.
  
 
The sum of <code>physpages.limit</code> and <code>swappages.limit</code> limits the maximum amount
 
The sum of <code>physpages.limit</code> and <code>swappages.limit</code> limits the maximum amount
Line 21: Line 21:
 
on the system.
 
on the system.
  
=== Secondary parameters ===
+
== See also ==
'''Even though these settings are classed as secondary, they are still important settings!'''
+
* [http://openvz.livejournal.com/39765.html Recent improvements in VSwap].
 
 
In addition to <code>physpages</code> and <code>swappages</code> being set, it is ''currently'' recommended to:
 
 
 
* Set <code>kmemsize</code> to no more than 1/2 of <code>physpages</code>
 
* Set <code>dcachesize</code> to no more than 1/2 of <code>kmemsize</code>
 
* Set <code>lockedpages</code> to no more than 1/2 of <code>physpages</code>
 
 
 
VSwap CT config samples (like [http://git.openvz.org/?p=vzctl;a=blob;f=etc/conf/ve-vswap-256m.conf-sample ve-vswap-256m.conf-sample] that come with vzctl are currently implementing these recommendations.
 
 
 
{{Note|VSwap feature is still being worked on, so these recommendation might change in the future.}}
 
 
 
{{Note|As of 042stab042 and later kernels, you are not required to set kmemsize, dcachesize and lockedpages resources, so you can set those to unlimited.  For more information, see Kir's blog post on the subject [http://openvz.livejournal.com/39765.html].}}
 
  
 
[[Category: UBC]]
 
[[Category: UBC]]

Revision as of 10:36, 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.

See also