<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nathanhaigh</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nathanhaigh"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Nathanhaigh"/>
	<updated>2026-05-15T13:46:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Proc/user_beancounters&amp;diff=10805</id>
		<title>Proc/user beancounters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Proc/user_beancounters&amp;diff=10805"/>
		<updated>2011-08-15T23:28:21Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: /* Reading */ fixed a typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
{{DISPLAYTITLE:/proc/user_beancounters}}&lt;br /&gt;
The proc filesystem entry showing resource control information is &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; file. An example content of &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; is shown below.&lt;br /&gt;
&lt;br /&gt;
{{Note|This article describes an old interface. This is kept for compatibility and [[BC proc entries|new one]] will be used since &amp;lt;code&amp;gt;028test008&amp;lt;/code&amp;gt; kernel}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /proc/user_beancounters&lt;br /&gt;
Version: 2.5&lt;br /&gt;
       uid  resource           held    maxheld    barrier      limit    failcnt&lt;br /&gt;
       123: kmemsize         836919    1005343    2752512    2936012          0&lt;br /&gt;
            lockedpages           0          0         32         32          0&lt;br /&gt;
            privvmpages        4587       7289      49152      53575          0&lt;br /&gt;
            shmpages             39         39       8192       8192          0&lt;br /&gt;
            dummy                 0          0          0          0          0&lt;br /&gt;
            numproc              20         26         65         65          0&lt;br /&gt;
            physpages          2267       2399          0 2147483647          0&lt;br /&gt;
            vmguarpages           0          0       6144 2147483647          0&lt;br /&gt;
            oomguarpages       2267       2399       6144 2147483647          0&lt;br /&gt;
            numtcpsock            3          3         80         80          0&lt;br /&gt;
            numflock              3          4        100        110          0&lt;br /&gt;
            numpty                1          1         16         16          0&lt;br /&gt;
            numsiginfo            0          1        256        256          0&lt;br /&gt;
            tcpsndbuf             0          0     319488     524288          0&lt;br /&gt;
            tcprcvbuf             0          0     319488     524288          0&lt;br /&gt;
            othersockbuf       6684       7888     132096     336896          0&lt;br /&gt;
            dgramrcvbuf           0       8372     132096     132096          0&lt;br /&gt;
            numothersock          8         10         80         80          0&lt;br /&gt;
            dcachesize        87672      92168    1048576    1097728          0&lt;br /&gt;
            numfile             238        306       2048       2048          0&lt;br /&gt;
            dummy                 0          0          0          0          0&lt;br /&gt;
            dummy                 0          0          0          0          0&lt;br /&gt;
            dummy                 0          0          0          0          0&lt;br /&gt;
            numiptent            10         16        128        128          0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
&lt;br /&gt;
The field '''&amp;lt;code&amp;gt;uid&amp;lt;/code&amp;gt;''' is a numeric identifier of the container&amp;lt;ref&amp;gt;The name “uid” is related to the fact that OpenVZ Resource Management can be used without virtualization and containers.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For accountable parameters, the field '''&amp;lt;code&amp;gt;held&amp;lt;/code&amp;gt;''' shows the current counter for the container (resource “usage”), and the field '''&amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt;''' shows the counter's maximum for the last accounting period. The accounting period is usually the lifetime of the container&amp;lt;ref&amp;gt;The lifetime of a container is the period from the start of the container till the time all processes in the container exited and all resources used by these processes are freed. Usually, the lifetime is just the time between the start and the stop of the container.&amp;lt;/ref&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The field '''&amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt;''' shows the number of refused “resource allocations” for the whole lifetime of the process group.&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;''' and '''&amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;''' fields are resource control settings. For some&lt;br /&gt;
parameters, only one of them may be used, for some parameters — both.&lt;br /&gt;
These fields may specify limits or guarantees, and the exact meaning of&lt;br /&gt;
them is parameter-specific. Description of each parameter in [[UBC parameters]]&lt;br /&gt;
contains information about the difference between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and&lt;br /&gt;
the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the parameter.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
{{Main|UBC parameter units}}&lt;br /&gt;
&lt;br /&gt;
== Settings ==&lt;br /&gt;
&lt;br /&gt;
General notes about parameters and their barrier and limit settings&lt;br /&gt;
are provided in [[UBC parameters]]. Parameters not having limit setting have&lt;br /&gt;
[[LONG_MAX]] in the corresponding field.&lt;br /&gt;
&lt;br /&gt;
== Reading ==&lt;br /&gt;
&lt;br /&gt;
{{Note|It's easier to use [[BC proc entries|the new &amp;lt;code&amp;gt;/proc/bc&amp;lt;/code&amp;gt; interface]], i.e. &amp;lt;code&amp;gt;cat /proc/bc/$CTID/resources&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
If you want to print UBC values for a specific container, the following construct can be helpful&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;egrep -A23 &amp;quot;${CTID}:&amp;quot; /proc/user_beancounters&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or with headers, though slightly harder to remember:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;sed -nr &amp;quot;1,2p;/${CTID}:/,+23p&amp;quot; /proc/user_beancounters&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;${CTID}&amp;lt;/code&amp;gt; is the ID of the container you are interested in.&lt;br /&gt;
&lt;br /&gt;
In case you want to print UBC values for a few containers at once, set CTID to something like &amp;lt;code&amp;gt;(101|102|103)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Proc/user_beancounters&amp;diff=10804</id>
		<title>Proc/user beancounters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Proc/user_beancounters&amp;diff=10804"/>
		<updated>2011-08-15T23:24:45Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: /* Units */ Link directly to the main article for ease of maintenance&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
{{DISPLAYTITLE:/proc/user_beancounters}}&lt;br /&gt;
The proc filesystem entry showing resource control information is &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; file. An example content of &amp;lt;code&amp;gt;/proc/user_beancounters&amp;lt;/code&amp;gt; is shown below.&lt;br /&gt;
&lt;br /&gt;
{{Note|This article describes an old interface. This is kept for compatibility and [[BC proc entries|new one]] will be used since &amp;lt;code&amp;gt;028test008&amp;lt;/code&amp;gt; kernel}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /proc/user_beancounters&lt;br /&gt;
Version: 2.5&lt;br /&gt;
       uid  resource           held    maxheld    barrier      limit    failcnt&lt;br /&gt;
       123: kmemsize         836919    1005343    2752512    2936012          0&lt;br /&gt;
            lockedpages           0          0         32         32          0&lt;br /&gt;
            privvmpages        4587       7289      49152      53575          0&lt;br /&gt;
            shmpages             39         39       8192       8192          0&lt;br /&gt;
            dummy                 0          0          0          0          0&lt;br /&gt;
            numproc              20         26         65         65          0&lt;br /&gt;
            physpages          2267       2399          0 2147483647          0&lt;br /&gt;
            vmguarpages           0          0       6144 2147483647          0&lt;br /&gt;
            oomguarpages       2267       2399       6144 2147483647          0&lt;br /&gt;
            numtcpsock            3          3         80         80          0&lt;br /&gt;
            numflock              3          4        100        110          0&lt;br /&gt;
            numpty                1          1         16         16          0&lt;br /&gt;
            numsiginfo            0          1        256        256          0&lt;br /&gt;
            tcpsndbuf             0          0     319488     524288          0&lt;br /&gt;
            tcprcvbuf             0          0     319488     524288          0&lt;br /&gt;
            othersockbuf       6684       7888     132096     336896          0&lt;br /&gt;
            dgramrcvbuf           0       8372     132096     132096          0&lt;br /&gt;
            numothersock          8         10         80         80          0&lt;br /&gt;
            dcachesize        87672      92168    1048576    1097728          0&lt;br /&gt;
            numfile             238        306       2048       2048          0&lt;br /&gt;
            dummy                 0          0          0          0          0&lt;br /&gt;
            dummy                 0          0          0          0          0&lt;br /&gt;
            dummy                 0          0          0          0          0&lt;br /&gt;
            numiptent            10         16        128        128          0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fields ==&lt;br /&gt;
&lt;br /&gt;
The field '''&amp;lt;code&amp;gt;uid&amp;lt;/code&amp;gt;''' is a numeric identifier of the container&amp;lt;ref&amp;gt;The name “uid” is related to the fact that OpenVZ Resource Management can be used without virtualization and containers.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For accountable parameters, the field '''&amp;lt;code&amp;gt;held&amp;lt;/code&amp;gt;''' shows the current counter for the container (resource “usage”), and the field '''&amp;lt;code&amp;gt;maxheld&amp;lt;/code&amp;gt;''' shows the counter's maximum for the last accounting period. The accounting period is usually the lifetime of the container&amp;lt;ref&amp;gt;The lifetime of a container is the period from the start of the container till the time all processes in the container exited and all resources used by these processes are freed. Usually, the lifetime is just the time between the start and the stop of the container.&amp;lt;/ref&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The field '''&amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt;''' shows the number of refused “resource allocations” for the whole lifetime of the process group.&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;''' and '''&amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;''' fields are resource control settings. For some&lt;br /&gt;
parameters, only one of them may be used, for some parameters — both.&lt;br /&gt;
These fields may specify limits or guarantees, and the exact meaning of&lt;br /&gt;
them is parameter-specific. Description of each parameter in [[UBC parameters]]&lt;br /&gt;
contains information about the difference between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and&lt;br /&gt;
the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the parameter.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
{{Main|UBC parameter units}}&lt;br /&gt;
&lt;br /&gt;
== Settings ==&lt;br /&gt;
&lt;br /&gt;
General notes about parameters and their barrier and limit settings&lt;br /&gt;
are provided in [[UBC parameters]]. Parameters not having limit setting have&lt;br /&gt;
[[LONG_MAX]] in the corresponding field.&lt;br /&gt;
&lt;br /&gt;
== Reading ==&lt;br /&gt;
&lt;br /&gt;
{{Note|It's easier to use [[BC proc entries|the new &amp;lt;code&amp;gt;/proc/bc&amp;lt;/code&amp;gt; interface]], i.e. &amp;lt;code&amp;gt;cat /proc/bc/$CTID/resources&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
If you want to print UBC values for a specific container, the following construct can be helpful&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;egrep -A23 &amp;quot;${CTID}:&amp;quot; /proc/user_beancounters&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or with headers, though slightly harder to remember:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;sed -nr &amp;quot;1,2p;/${CTID}:/,+23p' /proc/user_beancounters&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;${CTID}&amp;lt;/code&amp;gt; is the ID of the container you are interested in.&lt;br /&gt;
&lt;br /&gt;
In case you want to print UBC values for a few containers at once, set CTID to something like &amp;lt;code&amp;gt;(101|102|103)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_auxiliary_parameters&amp;diff=10803</id>
		<title>UBC auxiliary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_auxiliary_parameters&amp;diff=10803"/>
		<updated>2011-08-15T23:13:19Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: /* Units */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
Configuration of primary and secondary resource control parameters is&lt;br /&gt;
important for security and stability of the whole system. Auxiliary&lt;br /&gt;
parameters differ much from primary and secondary parameters in this respect.&lt;br /&gt;
&lt;br /&gt;
The primary functions of auxiliary parameters are the following.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;These parameters improve application's handling of errors and resource&lt;br /&gt;
consumption limitations.&lt;br /&gt;
&lt;br /&gt;
Without these auxiliary parameters, possible bugs in applications (such&lt;br /&gt;
as forgetting to unlock locked files or forgetting to collect signals) will&lt;br /&gt;
cause slowdown and, after some time, killing of the applications because&lt;br /&gt;
of memory exhaustion. In presence of these parameters, applications&lt;br /&gt;
will notice the problem (because, for example, attempts to create new&lt;br /&gt;
file locks start to fail) and show an appropriate message helping to&lt;br /&gt;
debug the problem.&lt;br /&gt;
&lt;br /&gt;
Another example. Each object such as opened file or established network&lt;br /&gt;
connection consume certain resources. When the container&lt;br /&gt;
is close to exhaustion of the resources allowed to him, it is&lt;br /&gt;
usually better to refuse creation of new object than to allow it but deny&lt;br /&gt;
memory allocation or terminate (in case of complete exhaustion of the&lt;br /&gt;
resources) an already running application.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
These parameters improve fault isolation between applications in the&lt;br /&gt;
same container. Failures or misbehavior of one application&lt;br /&gt;
inside a container is more likely to cause hitting a&lt;br /&gt;
limit on some auxiliary parameter and normal termination of this mis-&lt;br /&gt;
behaving application, rather than abnormal termination of some other&lt;br /&gt;
long-running application inside the same container.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
These parameters may be used to impose some administrative limits&lt;br /&gt;
on the container (for example, to not allow the user to run&lt;br /&gt;
database servers by limiting the amount of [[shmpages]], or limiting the&lt;br /&gt;
number of simultaneous shell sessions through [[numpty]]).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, auxiliary parameters play a role similar to limits imposed by&lt;br /&gt;
&amp;lt;code&amp;gt;setrlimit(2)&amp;lt;/code&amp;gt; interface and limits configurable by&lt;br /&gt;
&amp;lt;code&amp;gt;sysctl(8)&amp;lt;/code&amp;gt; in standard&lt;br /&gt;
Linux installations.&lt;br /&gt;
&lt;br /&gt;
Because of this helper role in resource control, system management software&lt;br /&gt;
may show auxiliary parameters only in advanced mode for experienced&lt;br /&gt;
administrators and hide them in “basic” management modes.&lt;br /&gt;
&lt;br /&gt;
== UBC Auxiliary Parameters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== lockedpages ===&lt;br /&gt;
Process pages not allowed to be swapped out (pages locked by &amp;lt;code&amp;gt;mlock(2)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The size of these pages is also accounted into &amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; may be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; or may allow&lt;br /&gt;
some gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, depending&lt;br /&gt;
on the nature of applications using memory locking features.&lt;br /&gt;
&lt;br /&gt;
Note that typical server applications like Web, FTP, mail servers&lt;br /&gt;
do not use memory locking features.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
=== shmpages ===&lt;br /&gt;
The total size of shared memory (IPC, shared anonymous mappings and&lt;br /&gt;
&amp;lt;code&amp;gt;tmpfs&amp;lt;/code&amp;gt; objects).&lt;br /&gt;
&lt;br /&gt;
These pages are also accounted into &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
=== physpages ===&lt;br /&gt;
Total number of RAM pages used by processes in a container.&lt;br /&gt;
&lt;br /&gt;
For memory pages used by several different containers (mappings of&lt;br /&gt;
shared libraries, for example), only a fraction of a page is charged to each&lt;br /&gt;
container.&lt;br /&gt;
The sum of the &amp;lt;code&amp;gt;physpages&amp;lt;/code&amp;gt; usage for all containers&lt;br /&gt;
corresponds to the total number of pages used in the system by all&lt;br /&gt;
containers.&lt;br /&gt;
&lt;br /&gt;
For [[VSwap]]-enabled kernels, the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to 0,&lt;br /&gt;
and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; limits the total size of RAM used by a container.&lt;br /&gt;
&lt;br /&gt;
For older kernels, &amp;lt;code&amp;gt;physpages&amp;lt;/code&amp;gt; is an accounting-only parameter.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; and the&lt;br /&gt;
&amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; to 'unlimited' ([[LONG_MAX]]).&lt;br /&gt;
&lt;br /&gt;
=== numfile ===&lt;br /&gt;
Number of open files.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
Note: actually currently adjusting the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; will change the kernel behaviour on &amp;quot;pre-charging&amp;quot; the numfile resource. If you change one you will most likely not notice any changes in container behaviour at all. This ability was added for researching purposes purely.&lt;br /&gt;
&lt;br /&gt;
=== numflock ===&lt;br /&gt;
Number of file locks.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter should have a&lt;br /&gt;
gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, as illustrated in&lt;br /&gt;
[[UBC configuration examples]].&lt;br /&gt;
&lt;br /&gt;
Very high limits on &amp;lt;code&amp;gt;numflock&amp;lt;/code&amp;gt; parameters and the big number&lt;br /&gt;
of file locks in the system may cause certain slowdown of&lt;br /&gt;
the whole system (but not fatal).&lt;br /&gt;
So, the limits on this parameter should be reasonable, depending&lt;br /&gt;
on the real requirements of the applications.&lt;br /&gt;
&lt;br /&gt;
=== numpty ===&lt;br /&gt;
Number of pseudo-terminals.&lt;br /&gt;
&lt;br /&gt;
This parameter is usually used to limit the number of simultaneous shell&lt;br /&gt;
sessions.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
However, in OpenVZ systems, the actual number of pseudo-terminals allowed&lt;br /&gt;
for one container is limited to &amp;lt;code&amp;gt;256&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== numsiginfo ===&lt;br /&gt;
Number of &amp;lt;code&amp;gt;siginfo&amp;lt;/code&amp;gt; structures.&lt;br /&gt;
&lt;br /&gt;
The size of the structure is also accounted into &amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
The default installations of stand-alone Linux systems limit this number&lt;br /&gt;
to &amp;lt;code&amp;gt;1024&amp;lt;/code&amp;gt; for the whole system.&lt;br /&gt;
In OpenVZ installations, &amp;lt;code&amp;gt;numsiginfo&amp;lt;/code&amp;gt; limit applies to each&lt;br /&gt;
container individually.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
Very high settings of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of this parameter may reduce&lt;br /&gt;
responsiveness of the system.&lt;br /&gt;
It is unlikely that any container will need the limit greater than&lt;br /&gt;
the Linux default — &amp;lt;code&amp;gt;1024&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== dcachesize ===&lt;br /&gt;
The total size of &amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;inode&amp;lt;/code&amp;gt; structures locked in memory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dcachesize&amp;lt;/code&amp;gt; parameter controls filesystem-related caches, such as&lt;br /&gt;
directory entry (&amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt;) and inode caches.&lt;br /&gt;
The value accounted into &amp;lt;code&amp;gt;dcachesize&amp;lt;/code&amp;gt; is also included into&lt;br /&gt;
&amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dcachesize&amp;lt;/code&amp;gt; exists as a separate parameter to impose a limit causing&lt;br /&gt;
file operations to sense memory shortage and return an error to applications,&lt;br /&gt;
protecting from memory shortages during critical operations that shouldn't&lt;br /&gt;
fail.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter should have a&lt;br /&gt;
gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, as illustrated in&lt;br /&gt;
[[UBC configuration examples]].&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
=== numiptent ===&lt;br /&gt;
The number of NETFILTER (IP packet filtering) entries.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
There is a restriction on the total number of &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt;.&lt;br /&gt;
It depends on the amount of other allocations in so called “vmalloc”&lt;br /&gt;
memory area and constitutes about &amp;lt;code&amp;gt;250000&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
Violation of this restriction may cause failures of operations with&lt;br /&gt;
IP packet filter tables (execution of &amp;lt;code&amp;gt;iptables(8)&amp;lt;/code&amp;gt;)&lt;br /&gt;
in any container or the host system,&lt;br /&gt;
or failures of container starts.&lt;br /&gt;
&lt;br /&gt;
Also, large &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt; cause considerable slowdown of processing&lt;br /&gt;
of network packets.  It is not recommended to allow containers&lt;br /&gt;
to create more than 200–300 &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== swappages ===&lt;br /&gt;
&lt;br /&gt;
The amount of swap space to show in container.&lt;br /&gt;
&lt;br /&gt;
{{Note|this parameter is only available in RHEL5-based kernel since version 028stab060.2, in 2.6.27 since kiprensky.}}&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration only affects the way OpenVZ kernel reports about&lt;br /&gt;
available swap in a container. This is needed for some applications&lt;br /&gt;
which refuse to run inside a container unless the kernel&lt;br /&gt;
report that no less than some specific amount of swap is available.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; is set, its value is reported as the amount&lt;br /&gt;
of total swap space in a container.&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; is set to [[LONG_MAX]] (which is the&lt;br /&gt;
in-kernel default for this parameter), all the swap space values&lt;br /&gt;
parameters (total, used, free) are reported as 0.&lt;br /&gt;
&lt;br /&gt;
The value of &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; for this beancounter is ignored.&lt;br /&gt;
&lt;br /&gt;
The value of &amp;lt;code&amp;gt;held&amp;lt;/code&amp;gt; shows how much swap space&lt;br /&gt;
is currently being used for this container.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
{{Main|UBC parameter units}}&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10802</id>
		<title>UBC secondary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10802"/>
		<updated>2011-08-15T23:13:03Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: /* Units */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
'''Secondary (dependant) UBC parameters''' are directly connected&lt;br /&gt;
to the [[UBC primary parameters|primary ones]] and can't be configured arbitrarily.&lt;br /&gt;
&lt;br /&gt;
== UBC Secondary Parameters ==&lt;br /&gt;
=== kmemsize ===&lt;br /&gt;
Size of unswappable memory in bytes, allocated by the operating system kernel.&lt;br /&gt;
&lt;br /&gt;
It includes all the kernel internal data structures associated with the&lt;br /&gt;
container's processes, except the network buffers discussed below.&lt;br /&gt;
These data structures reside in the first gigabyte of the computer's RAM,&lt;br /&gt;
so called [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
This parameter is related to the number of processes ([[numproc]]).&lt;br /&gt;
Each process consumes certain amount of kernel memory —&lt;br /&gt;
24 kilobytes at minimum, 30–60 KB typically.&lt;br /&gt;
Very large processes may consume much more than that.&lt;br /&gt;
&lt;br /&gt;
It is important to have a certain safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and&lt;br /&gt;
the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
(for example, 10%, as in [[UBC configuration examples]]).  Equal &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of&lt;br /&gt;
the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter may lead to the situation where the kernel will&lt;br /&gt;
need to kill container's applications to keep the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt;&lt;br /&gt;
usage under the limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Kmemsize&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the socket buffer space (see below) is limited by the&lt;br /&gt;
hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== tcpsndbuf ===&lt;br /&gt;
The total size of buffers used to send data over TCP network connections.&lt;br /&gt;
These socket buffers reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcpsndbuf_{lim} - tcpsndbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may silently stall, being unable to transmit data.&lt;br /&gt;
&lt;br /&gt;
Setting high values for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
may, but doesn't necessarily, increase performance of network communications.&lt;br /&gt;
Note that, unlike most other parameters, hitting &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
&lt;br /&gt;
If you use rtorrent in a container, a low value for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; may cause rtorrent to take unusual amount of cpu. In this case, you must put a higher value. Also watch the number of failcnt in /proc/user_beancounters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== tcprcvbuf ===&lt;br /&gt;
The total size of buffers used to temporary store the data coming from TCP network connections.&lt;br /&gt;
These socket buffers also reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcprcvbuf_{lim} - tcprcvbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may stall, being unable to receive data, and will be terminated&lt;br /&gt;
after a couple of minutes.&lt;br /&gt;
&lt;br /&gt;
Similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, setting high values for &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
parameter may, but doesn't necessarily, increase performance of network&lt;br /&gt;
communications.&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
However, staying above the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
for a long time is less harmless than for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;.&lt;br /&gt;
Long periods of exceeding the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; may cause termination&lt;br /&gt;
of some connections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== othersockbuf ===&lt;br /&gt;
The total size of buffers used by local (UNIX-domain) connections between&lt;br /&gt;
processes inside the system (such as connections to a local database server)&lt;br /&gt;
and send buffers of UDP and other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; parameter depends on number of non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; configuration should satisfy&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;othersockbuf_{lim} - othersockbuf_{bar} \ge 2.5KB \cdot numothersock.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Increased limit for &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; is necessary for high performance of&lt;br /&gt;
communications through local (UNIX-domain) sockets.&lt;br /&gt;
However, similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, hitting &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; affects&lt;br /&gt;
the communication performance only and does not affect the functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== dgramrcvbuf ===&lt;br /&gt;
The total size of buffers used to temporary store the incoming packets of UDP and&lt;br /&gt;
other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; parameters depend on number of&lt;br /&gt;
non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits usually don't need to be high.&lt;br /&gt;
Only if the containers needs to send and receive very large&lt;br /&gt;
datagrams, the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;s for both &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; parameters should be raised.&lt;br /&gt;
&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; means that some datagrams are dropped, which may&lt;br /&gt;
or may not be important for application functionality.&lt;br /&gt;
UDP is a protocol with not guaranteed delivery, so even if the buffers&lt;br /&gt;
permit, the datagrams may be as well dropped later on any stage of the&lt;br /&gt;
processing, and applications should be prepared for it.&lt;br /&gt;
&lt;br /&gt;
Unlike other socket buffer parameters, for &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== oomguarpages ===&lt;br /&gt;
The guaranteed amount of memory for the case the memory is “over-booked”&lt;br /&gt;
(out-of-memory kill guarantee).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Oomguarpages&amp;lt;/code&amp;gt; parameter is related to &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
If applications start to consume more memory than the computer has,&lt;br /&gt;
the system faces an out-of-memory condition.&lt;br /&gt;
In this case the operating system will start to kill container's&lt;br /&gt;
processes to free some memory and prevent the total death&lt;br /&gt;
of the system.  Although it happens very rarely in typical system loads,&lt;br /&gt;
killing processes in out-of-memory situations is a normal reaction of the&lt;br /&gt;
system, and it is built into every Linux kernel&amp;lt;ref&amp;gt;The possible reasons of out-of-memory situations are the excess of total &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees the available physical resources or high memory consumption by system processes.  Also, the kernel might allow some containers to allocate memory above their &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees when the system had a lot of free memory, and later, when other containers claim their guarantees, the system will experience the memory shortage.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Oomguarpages]]&amp;lt;/code&amp;gt; parameter accounts the total amount of&lt;br /&gt;
memory and swap space used by the processes of a particular&lt;br /&gt;
container.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is the out-of-memory&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
If the current usage of memory and swap space&lt;br /&gt;
(the value of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt;) plus the amount of used kernel memory&lt;br /&gt;
(&amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;) and socket buffers is below the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;,&lt;br /&gt;
processes in this container are guaranteed not to be killed in&lt;br /&gt;
out-of-memory situations.&lt;br /&gt;
If the system is in out-of-memory situation and there are several&lt;br /&gt;
containers with &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; excess, applications in the&lt;br /&gt;
container with the biggest excess will be killed first.&lt;br /&gt;
The &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; counter of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
increases when a process in this container is killed because&lt;br /&gt;
of out-of-memory situation.&lt;br /&gt;
&lt;br /&gt;
If the administrator needs to make sure that some application won't be&lt;br /&gt;
forcedly killed regardless of the application's behavior,&lt;br /&gt;
setting the &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt; limit to a value not greater than the&lt;br /&gt;
&amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee significantly reduce the likelihood of&lt;br /&gt;
the application being killed,&lt;br /&gt;
and setting it to a half of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee completely&lt;br /&gt;
prevents it.&lt;br /&gt;
Such configurations are not popular because they significantly reduce&lt;br /&gt;
the utilization of the hardware.&lt;br /&gt;
&lt;br /&gt;
The meaning of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is&lt;br /&gt;
unspecified in the current version.&lt;br /&gt;
&lt;br /&gt;
The total out-of-memory guarantees given to the containers should&lt;br /&gt;
not exceed the physical capacity of the computer, as discussed in [[UBC systemwide configuration#Memory and swap space]].&lt;br /&gt;
If guarantees are given for more than the system has, in out-of-memory&lt;br /&gt;
situations applications in containers with guaranteed level of&lt;br /&gt;
service and system daemons may be killed.&lt;br /&gt;
&lt;br /&gt;
=== privvmpages ===&lt;br /&gt;
Memory allocation limit in [[Memory_page|pages]] (which are typically 4096 bytes in size).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
allows controlling the amount of memory allocated by applications.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
control the upper boundary of the total size of allocated memory.&lt;br /&gt;
Note that this upper boundary doesn't guarantee that the container&lt;br /&gt;
will be able to allocate that much memory, neither does it guarantee that&lt;br /&gt;
other containers will be able to allocate their fair share of&lt;br /&gt;
memory.&lt;br /&gt;
The primary mechanism to control memory allocation is the &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter accounts allocated (but, possibly,&lt;br /&gt;
not used yet) memory.&lt;br /&gt;
The accounted value is an estimation how much memory will be really consumed&lt;br /&gt;
when the container's applications start to use the allocated&lt;br /&gt;
memory.&lt;br /&gt;
Consumed memory is accounted into &amp;lt;code&amp;gt;[[oomguarpages]]&amp;lt;/code&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Since the memory accounted into &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; may not be actually used,&lt;br /&gt;
the sum of current &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; values for all containers&lt;br /&gt;
may exceed the RAM and swap size of the computer.&lt;br /&gt;
&lt;br /&gt;
There should be a safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;&lt;br /&gt;
for &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter to reduce the number of memory allocation&lt;br /&gt;
failures that the application is unable to handle.&lt;br /&gt;
This gap will be used for “high-priority” memory allocations, such&lt;br /&gt;
as process stack expansion.&lt;br /&gt;
Normal priority allocations will fail when the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; is reached.&lt;br /&gt;
&lt;br /&gt;
Total &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; should correlate with the physical resources of the&lt;br /&gt;
computer.&lt;br /&gt;
Also, it is important not to allow any container to allocate a&lt;br /&gt;
significant portion of all system RAM to avoid serious service level&lt;br /&gt;
degradation for other containers.&lt;br /&gt;
Both these configuration requirements are discussed in [[UBC systemwide configuration#Allocated memory]].&lt;br /&gt;
&lt;br /&gt;
There's also an article describing how [[user pages accounting]] works.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
{{Main|UBC parameter units}}&lt;br /&gt;
&lt;br /&gt;
== System-wide limits ==&lt;br /&gt;
All secondary parameters are related to memory.&lt;br /&gt;
Total limits on memory-related parameters must not exceed the physical&lt;br /&gt;
resources of the computer.&lt;br /&gt;
The restrictions on the configuration of memory-related parameters are listed&lt;br /&gt;
in [[UBC systemwide configuration]].&lt;br /&gt;
Those restrictions are very important, because their violation may&lt;br /&gt;
allow any container cause the whole system to hang.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_primary_parameters&amp;diff=10801</id>
		<title>UBC primary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_primary_parameters&amp;diff=10801"/>
		<updated>2011-08-15T23:12:31Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: /* Units */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
The most important parameters determining the resources available to&lt;br /&gt;
container are explained below. The meaning of the parameters&lt;br /&gt;
is illustrated assuming that the container runs some network&lt;br /&gt;
server applications.&lt;br /&gt;
&lt;br /&gt;
== UBC Primary Parameters ==&lt;br /&gt;
&lt;br /&gt;
=== numproc ===&lt;br /&gt;
Maximum number of processes and kernel-level threads allowed for this container.&lt;br /&gt;
&lt;br /&gt;
Many server applications (like Apache Web server, FTP and mail servers)&lt;br /&gt;
spawn a process to handle each client, so the limit on number of processes&lt;br /&gt;
defines how many clients the application will be able to handle in parallel.&lt;br /&gt;
However, the number of processes doesn't limit how “heavy” the application is&lt;br /&gt;
and whether the server will be able to serve heavy requests from clients.&lt;br /&gt;
&lt;br /&gt;
Configuring resource control system, it is important to estimate both&lt;br /&gt;
the maximum number of processes and the average number of processes&lt;br /&gt;
(referred to as &amp;lt;code&amp;gt;avnumproc&amp;lt;/code&amp;gt; later). Other (dependent) resource&lt;br /&gt;
control parameters may depend both on the limit and the average number (see [[UBC consistency check]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;numproc&amp;lt;/code&amp;gt; doesn't provide additional control and should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
There is a restriction on the total number of processes in the system.&lt;br /&gt;
More than about 16000 processes start to cause poor responsiveness of&lt;br /&gt;
the system, worsening when the number grows. Total number of processes&lt;br /&gt;
exceeding 32000 is very likely to cause hang of the system.&lt;br /&gt;
&lt;br /&gt;
Note that in practice the number of processes is usually less. Each&lt;br /&gt;
process consumes some memory, and the available memory and the&lt;br /&gt;
&amp;quot;low memory&amp;quot; (see [[UBC systemwide configuration#“Low memory”|“Low memory”]]) limit the number of processes to lower&lt;br /&gt;
values. With typical processes, it is normal to be able to run only up&lt;br /&gt;
to 8000 processes in a system.&lt;br /&gt;
&lt;br /&gt;
=== numtcpsock ===&lt;br /&gt;
Maximum number of TCP sockets.&lt;br /&gt;
&lt;br /&gt;
This parameter limits the&lt;br /&gt;
number of TCP connections and, thus, the number of clients the server&lt;br /&gt;
application can handle in parallel.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of this parameter should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If each container has it's own set of IP addresses (which is&lt;br /&gt;
the only way a OpenVZ system can be configured), there are no direct&lt;br /&gt;
limits on the total number of TCP sockets in the system. The number&lt;br /&gt;
of sockets needs to be controlled because each socket needs certain&lt;br /&gt;
amount of memory for receive and transmit buffers (see descriptions&lt;br /&gt;
of &amp;lt;code&amp;gt;[[tcpsndbuf]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[tcprcvbuf]]&amp;lt;/code&amp;gt;), and&lt;br /&gt;
the memory is a limited resource.&lt;br /&gt;
&lt;br /&gt;
=== numothersock ===&lt;br /&gt;
Maximum number of non-TCP sockets (local sockets, UDP and other types of sockets).&lt;br /&gt;
&lt;br /&gt;
Local (UNIX-domain) sockets are used for communications inside the&lt;br /&gt;
system. Multi-tier applications (for example, a Web application with a&lt;br /&gt;
database server as a back-end) may need one or multiple local sockets&lt;br /&gt;
to serve each client. Straightforward applications (for example, most&lt;br /&gt;
mail servers, with the exception of Postfix) do not use local sockets.&lt;br /&gt;
&lt;br /&gt;
UDP sockets are used for Domain Name Service (DNS) queries, but&lt;br /&gt;
the number of such sockets opened simultaneously is low. UDP and&lt;br /&gt;
other sockets may also be used in some very special applications&lt;br /&gt;
(SNMP agents and others).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of this parameter should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The number of local sockets in a system is not limited. The number of&lt;br /&gt;
UDP sockets in a system, similarly to TCP sockets, is not limited in&lt;br /&gt;
OpenVZ systems.&lt;br /&gt;
&lt;br /&gt;
Similarly to &amp;lt;code&amp;gt;numtcpsock&amp;lt;/code&amp;gt; parameter discussed above, the number of&lt;br /&gt;
non-TCP sockets needs to be controlled because each socket needs certain&lt;br /&gt;
amount of memory for its buffers, and the memory is a limited&lt;br /&gt;
resource.&lt;br /&gt;
&lt;br /&gt;
=== vmguarpages ===&lt;br /&gt;
Memory allocation guarantee.&lt;br /&gt;
&lt;br /&gt;
This parameter controls how much memory is available to the Virtual&lt;br /&gt;
Environment (i.e. how much memory its applications can allocate by&lt;br /&gt;
&amp;lt;code&amp;gt;malloc(3)&amp;lt;/code&amp;gt; or other standard Linux memory allocation mechanisms).&lt;br /&gt;
The more clients are served or the more “heavy” the application is, the&lt;br /&gt;
more memory it needs.&lt;br /&gt;
&lt;br /&gt;
The amount of memory that container's applications are&lt;br /&gt;
guaranteed to be able to allocate is specified as the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt; parameter. The current amount of allocated memory space&lt;br /&gt;
is accounted into &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter, and &amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt;&lt;br /&gt;
parameter does not have its own accounting. The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter impose an upper limit on the memory allocations&lt;br /&gt;
(see [[privvmpages]]). The meaning of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the&lt;br /&gt;
&amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt; parameter is unspecified in the current version and should be set&lt;br /&gt;
to the maximal allowed value ([[LONG_MAX]]).&lt;br /&gt;
&lt;br /&gt;
If the current amount of allocated memory space does not exceed the&lt;br /&gt;
guaranteed amount (the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt;),&lt;br /&gt;
memory allocations of container's applications always succeed.&lt;br /&gt;
If the current amount of allocated memory space exceeds the guarantee but below&lt;br /&gt;
the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt;, allocations may or may not succeed,&lt;br /&gt;
depending on the total amount of available memory in the system.&lt;br /&gt;
&lt;br /&gt;
Starting from the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt;,&lt;br /&gt;
normal priority allocations and, starting from the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;&lt;br /&gt;
of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt;, all memory allocations&lt;br /&gt;
made by the applications fail.&lt;br /&gt;
The memory allocation guarantee (&amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt;) is a primary tool for&lt;br /&gt;
controlling the memory available to containers, because&lt;br /&gt;
it allows administrators to provide Service Level Agreements — agreements&lt;br /&gt;
guaranteeing certain quality of service, certain amount of resources&lt;br /&gt;
and general availability of the service. The unit of measurement&lt;br /&gt;
of vmguarpages values is memory pages (4KB on x86 and x86_64 processors).&lt;br /&gt;
The total memory allocation guarantees given to containers&lt;br /&gt;
are limited by the physical resources of the computer — the size of RAM&lt;br /&gt;
and the swap space — as discussed in [[UBC systemwide configuration]].&lt;br /&gt;
&lt;br /&gt;
There is a ''pseudo-graphical'' tool - &amp;lt;code&amp;gt;[http://en.dklab.ru/lib/dklab_vzmem/ vzmem]&amp;lt;/code&amp;gt; - which allows you to distribute physical memory among all VEs consistently. It shows all physical memory blocks graphically in &amp;lt;code&amp;gt;/etc/vz/conf/MEM-MAP&amp;lt;/code&amp;gt; text file and lets you to move these blocks from one VE to another to redistribute the memory. Also you may specify &amp;quot;additional&amp;quot; memory personally for each VE: such memory will be obtained from system's free memory or swap (it is reflected as modifying of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
{{Main|UBC parameter units}}&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_auxiliary_parameters&amp;diff=10800</id>
		<title>UBC auxiliary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_auxiliary_parameters&amp;diff=10800"/>
		<updated>2011-08-15T22:44:42Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: Indented parameters by another heading level so toc is easier to follow. linked units subheading to the UBC parameter units page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
Configuration of primary and secondary resource control parameters is&lt;br /&gt;
important for security and stability of the whole system. Auxiliary&lt;br /&gt;
parameters differ much from primary and secondary parameters in this respect.&lt;br /&gt;
&lt;br /&gt;
The primary functions of auxiliary parameters are the following.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;These parameters improve application's handling of errors and resource&lt;br /&gt;
consumption limitations.&lt;br /&gt;
&lt;br /&gt;
Without these auxiliary parameters, possible bugs in applications (such&lt;br /&gt;
as forgetting to unlock locked files or forgetting to collect signals) will&lt;br /&gt;
cause slowdown and, after some time, killing of the applications because&lt;br /&gt;
of memory exhaustion. In presence of these parameters, applications&lt;br /&gt;
will notice the problem (because, for example, attempts to create new&lt;br /&gt;
file locks start to fail) and show an appropriate message helping to&lt;br /&gt;
debug the problem.&lt;br /&gt;
&lt;br /&gt;
Another example. Each object such as opened file or established network&lt;br /&gt;
connection consume certain resources. When the container&lt;br /&gt;
is close to exhaustion of the resources allowed to him, it is&lt;br /&gt;
usually better to refuse creation of new object than to allow it but deny&lt;br /&gt;
memory allocation or terminate (in case of complete exhaustion of the&lt;br /&gt;
resources) an already running application.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
These parameters improve fault isolation between applications in the&lt;br /&gt;
same container. Failures or misbehavior of one application&lt;br /&gt;
inside a container is more likely to cause hitting a&lt;br /&gt;
limit on some auxiliary parameter and normal termination of this mis-&lt;br /&gt;
behaving application, rather than abnormal termination of some other&lt;br /&gt;
long-running application inside the same container.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
These parameters may be used to impose some administrative limits&lt;br /&gt;
on the container (for example, to not allow the user to run&lt;br /&gt;
database servers by limiting the amount of [[shmpages]], or limiting the&lt;br /&gt;
number of simultaneous shell sessions through [[numpty]]).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, auxiliary parameters play a role similar to limits imposed by&lt;br /&gt;
&amp;lt;code&amp;gt;setrlimit(2)&amp;lt;/code&amp;gt; interface and limits configurable by&lt;br /&gt;
&amp;lt;code&amp;gt;sysctl(8)&amp;lt;/code&amp;gt; in standard&lt;br /&gt;
Linux installations.&lt;br /&gt;
&lt;br /&gt;
Because of this helper role in resource control, system management software&lt;br /&gt;
may show auxiliary parameters only in advanced mode for experienced&lt;br /&gt;
administrators and hide them in “basic” management modes.&lt;br /&gt;
&lt;br /&gt;
== UBC Auxiliary Parameters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== lockedpages ===&lt;br /&gt;
Process pages not allowed to be swapped out (pages locked by &amp;lt;code&amp;gt;mlock(2)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The size of these pages is also accounted into &amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; may be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; or may allow&lt;br /&gt;
some gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, depending&lt;br /&gt;
on the nature of applications using memory locking features.&lt;br /&gt;
&lt;br /&gt;
Note that typical server applications like Web, FTP, mail servers&lt;br /&gt;
do not use memory locking features.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
=== shmpages ===&lt;br /&gt;
The total size of shared memory (IPC, shared anonymous mappings and&lt;br /&gt;
&amp;lt;code&amp;gt;tmpfs&amp;lt;/code&amp;gt; objects).&lt;br /&gt;
&lt;br /&gt;
These pages are also accounted into &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
=== physpages ===&lt;br /&gt;
Total number of RAM pages used by processes in a container.&lt;br /&gt;
&lt;br /&gt;
For memory pages used by several different containers (mappings of&lt;br /&gt;
shared libraries, for example), only a fraction of a page is charged to each&lt;br /&gt;
container.&lt;br /&gt;
The sum of the &amp;lt;code&amp;gt;physpages&amp;lt;/code&amp;gt; usage for all containers&lt;br /&gt;
corresponds to the total number of pages used in the system by all&lt;br /&gt;
containers.&lt;br /&gt;
&lt;br /&gt;
For [[VSwap]]-enabled kernels, the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to 0,&lt;br /&gt;
and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; limits the total size of RAM used by a container.&lt;br /&gt;
&lt;br /&gt;
For older kernels, &amp;lt;code&amp;gt;physpages&amp;lt;/code&amp;gt; is an accounting-only parameter.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; and the&lt;br /&gt;
&amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; to 'unlimited' ([[LONG_MAX]]).&lt;br /&gt;
&lt;br /&gt;
=== numfile ===&lt;br /&gt;
Number of open files.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
Note: actually currently adjusting the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; will change the kernel behaviour on &amp;quot;pre-charging&amp;quot; the numfile resource. If you change one you will most likely not notice any changes in container behaviour at all. This ability was added for researching purposes purely.&lt;br /&gt;
&lt;br /&gt;
=== numflock ===&lt;br /&gt;
Number of file locks.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter should have a&lt;br /&gt;
gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, as illustrated in&lt;br /&gt;
[[UBC configuration examples]].&lt;br /&gt;
&lt;br /&gt;
Very high limits on &amp;lt;code&amp;gt;numflock&amp;lt;/code&amp;gt; parameters and the big number&lt;br /&gt;
of file locks in the system may cause certain slowdown of&lt;br /&gt;
the whole system (but not fatal).&lt;br /&gt;
So, the limits on this parameter should be reasonable, depending&lt;br /&gt;
on the real requirements of the applications.&lt;br /&gt;
&lt;br /&gt;
=== numpty ===&lt;br /&gt;
Number of pseudo-terminals.&lt;br /&gt;
&lt;br /&gt;
This parameter is usually used to limit the number of simultaneous shell&lt;br /&gt;
sessions.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
However, in OpenVZ systems, the actual number of pseudo-terminals allowed&lt;br /&gt;
for one container is limited to &amp;lt;code&amp;gt;256&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== numsiginfo ===&lt;br /&gt;
Number of &amp;lt;code&amp;gt;siginfo&amp;lt;/code&amp;gt; structures.&lt;br /&gt;
&lt;br /&gt;
The size of the structure is also accounted into &amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
The default installations of stand-alone Linux systems limit this number&lt;br /&gt;
to &amp;lt;code&amp;gt;1024&amp;lt;/code&amp;gt; for the whole system.&lt;br /&gt;
In OpenVZ installations, &amp;lt;code&amp;gt;numsiginfo&amp;lt;/code&amp;gt; limit applies to each&lt;br /&gt;
container individually.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
Very high settings of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of this parameter may reduce&lt;br /&gt;
responsiveness of the system.&lt;br /&gt;
It is unlikely that any container will need the limit greater than&lt;br /&gt;
the Linux default — &amp;lt;code&amp;gt;1024&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== dcachesize ===&lt;br /&gt;
The total size of &amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;inode&amp;lt;/code&amp;gt; structures locked in memory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dcachesize&amp;lt;/code&amp;gt; parameter controls filesystem-related caches, such as&lt;br /&gt;
directory entry (&amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt;) and inode caches.&lt;br /&gt;
The value accounted into &amp;lt;code&amp;gt;dcachesize&amp;lt;/code&amp;gt; is also included into&lt;br /&gt;
&amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dcachesize&amp;lt;/code&amp;gt; exists as a separate parameter to impose a limit causing&lt;br /&gt;
file operations to sense memory shortage and return an error to applications,&lt;br /&gt;
protecting from memory shortages during critical operations that shouldn't&lt;br /&gt;
fail.&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter should have a&lt;br /&gt;
gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;, as illustrated in&lt;br /&gt;
[[UBC configuration examples]].&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration affects functionality and resource shortage reaction&lt;br /&gt;
of applications in the given container only.&lt;br /&gt;
&lt;br /&gt;
=== numiptent ===&lt;br /&gt;
The number of NETFILTER (IP packet filtering) entries.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
There is a restriction on the total number of &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt;.&lt;br /&gt;
It depends on the amount of other allocations in so called “vmalloc”&lt;br /&gt;
memory area and constitutes about &amp;lt;code&amp;gt;250000&amp;lt;/code&amp;gt; entries.&lt;br /&gt;
Violation of this restriction may cause failures of operations with&lt;br /&gt;
IP packet filter tables (execution of &amp;lt;code&amp;gt;iptables(8)&amp;lt;/code&amp;gt;)&lt;br /&gt;
in any container or the host system,&lt;br /&gt;
or failures of container starts.&lt;br /&gt;
&lt;br /&gt;
Also, large &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt; cause considerable slowdown of processing&lt;br /&gt;
of network packets.  It is not recommended to allow containers&lt;br /&gt;
to create more than 200–300 &amp;lt;code&amp;gt;numiptent&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== swappages ===&lt;br /&gt;
&lt;br /&gt;
The amount of swap space to show in container.&lt;br /&gt;
&lt;br /&gt;
{{Note|this parameter is only available in RHEL5-based kernel since version 028stab060.2, in 2.6.27 since kiprensky.}}&lt;br /&gt;
&lt;br /&gt;
The configuration of this parameter doesn't affect security and&lt;br /&gt;
stability of the whole system or isolation between containers.&lt;br /&gt;
Its configuration only affects the way OpenVZ kernel reports about&lt;br /&gt;
available swap in a container. This is needed for some applications&lt;br /&gt;
which refuse to run inside a container unless the kernel&lt;br /&gt;
report that no less than some specific amount of swap is available.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; is set, its value is reported as the amount&lt;br /&gt;
of total swap space in a container.&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; is set to [[LONG_MAX]] (which is the&lt;br /&gt;
in-kernel default for this parameter), all the swap space values&lt;br /&gt;
parameters (total, used, free) are reported as 0.&lt;br /&gt;
&lt;br /&gt;
The value of &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; for this beancounter is ignored.&lt;br /&gt;
&lt;br /&gt;
The value of &amp;lt;code&amp;gt;held&amp;lt;/code&amp;gt; shows how much swap space&lt;br /&gt;
is currently being used for this container.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
For full article, see: [[UBC parameter units]]&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_primary_parameters&amp;diff=10799</id>
		<title>UBC primary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_primary_parameters&amp;diff=10799"/>
		<updated>2011-08-15T22:40:32Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: Indented parameters by another heading level so toc is easier to follow. linked units subheading to the UBC parameter units page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
The most important parameters determining the resources available to&lt;br /&gt;
container are explained below. The meaning of the parameters&lt;br /&gt;
is illustrated assuming that the container runs some network&lt;br /&gt;
server applications.&lt;br /&gt;
&lt;br /&gt;
== UBC Primary Parameters ==&lt;br /&gt;
&lt;br /&gt;
=== numproc ===&lt;br /&gt;
Maximum number of processes and kernel-level threads allowed for this container.&lt;br /&gt;
&lt;br /&gt;
Many server applications (like Apache Web server, FTP and mail servers)&lt;br /&gt;
spawn a process to handle each client, so the limit on number of processes&lt;br /&gt;
defines how many clients the application will be able to handle in parallel.&lt;br /&gt;
However, the number of processes doesn't limit how “heavy” the application is&lt;br /&gt;
and whether the server will be able to serve heavy requests from clients.&lt;br /&gt;
&lt;br /&gt;
Configuring resource control system, it is important to estimate both&lt;br /&gt;
the maximum number of processes and the average number of processes&lt;br /&gt;
(referred to as &amp;lt;code&amp;gt;avnumproc&amp;lt;/code&amp;gt; later). Other (dependent) resource&lt;br /&gt;
control parameters may depend both on the limit and the average number (see [[UBC consistency check]]).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;numproc&amp;lt;/code&amp;gt; doesn't provide additional control and should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
There is a restriction on the total number of processes in the system.&lt;br /&gt;
More than about 16000 processes start to cause poor responsiveness of&lt;br /&gt;
the system, worsening when the number grows. Total number of processes&lt;br /&gt;
exceeding 32000 is very likely to cause hang of the system.&lt;br /&gt;
&lt;br /&gt;
Note that in practice the number of processes is usually less. Each&lt;br /&gt;
process consumes some memory, and the available memory and the&lt;br /&gt;
&amp;quot;low memory&amp;quot; (see [[UBC systemwide configuration#“Low memory”|“Low memory”]]) limit the number of processes to lower&lt;br /&gt;
values. With typical processes, it is normal to be able to run only up&lt;br /&gt;
to 8000 processes in a system.&lt;br /&gt;
&lt;br /&gt;
=== numtcpsock ===&lt;br /&gt;
Maximum number of TCP sockets.&lt;br /&gt;
&lt;br /&gt;
This parameter limits the&lt;br /&gt;
number of TCP connections and, thus, the number of clients the server&lt;br /&gt;
application can handle in parallel.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of this parameter should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If each container has it's own set of IP addresses (which is&lt;br /&gt;
the only way a OpenVZ system can be configured), there are no direct&lt;br /&gt;
limits on the total number of TCP sockets in the system. The number&lt;br /&gt;
of sockets needs to be controlled because each socket needs certain&lt;br /&gt;
amount of memory for receive and transmit buffers (see descriptions&lt;br /&gt;
of &amp;lt;code&amp;gt;[[tcpsndbuf]]&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;[[tcprcvbuf]]&amp;lt;/code&amp;gt;), and&lt;br /&gt;
the memory is a limited resource.&lt;br /&gt;
&lt;br /&gt;
=== numothersock ===&lt;br /&gt;
Maximum number of non-TCP sockets (local sockets, UDP and other types of sockets).&lt;br /&gt;
&lt;br /&gt;
Local (UNIX-domain) sockets are used for communications inside the&lt;br /&gt;
system. Multi-tier applications (for example, a Web application with a&lt;br /&gt;
database server as a back-end) may need one or multiple local sockets&lt;br /&gt;
to serve each client. Straightforward applications (for example, most&lt;br /&gt;
mail servers, with the exception of Postfix) do not use local sockets.&lt;br /&gt;
&lt;br /&gt;
UDP sockets are used for Domain Name Service (DNS) queries, but&lt;br /&gt;
the number of such sockets opened simultaneously is low. UDP and&lt;br /&gt;
other sockets may also be used in some very special applications&lt;br /&gt;
(SNMP agents and others).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of this parameter should be set equal to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
The number of local sockets in a system is not limited. The number of&lt;br /&gt;
UDP sockets in a system, similarly to TCP sockets, is not limited in&lt;br /&gt;
OpenVZ systems.&lt;br /&gt;
&lt;br /&gt;
Similarly to &amp;lt;code&amp;gt;numtcpsock&amp;lt;/code&amp;gt; parameter discussed above, the number of&lt;br /&gt;
non-TCP sockets needs to be controlled because each socket needs certain&lt;br /&gt;
amount of memory for its buffers, and the memory is a limited&lt;br /&gt;
resource.&lt;br /&gt;
&lt;br /&gt;
=== vmguarpages ===&lt;br /&gt;
Memory allocation guarantee.&lt;br /&gt;
&lt;br /&gt;
This parameter controls how much memory is available to the Virtual&lt;br /&gt;
Environment (i.e. how much memory its applications can allocate by&lt;br /&gt;
&amp;lt;code&amp;gt;malloc(3)&amp;lt;/code&amp;gt; or other standard Linux memory allocation mechanisms).&lt;br /&gt;
The more clients are served or the more “heavy” the application is, the&lt;br /&gt;
more memory it needs.&lt;br /&gt;
&lt;br /&gt;
The amount of memory that container's applications are&lt;br /&gt;
guaranteed to be able to allocate is specified as the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt; parameter. The current amount of allocated memory space&lt;br /&gt;
is accounted into &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter, and &amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt;&lt;br /&gt;
parameter does not have its own accounting. The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter impose an upper limit on the memory allocations&lt;br /&gt;
(see [[privvmpages]]). The meaning of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the&lt;br /&gt;
&amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt; parameter is unspecified in the current version and should be set&lt;br /&gt;
to the maximal allowed value ([[LONG_MAX]]).&lt;br /&gt;
&lt;br /&gt;
If the current amount of allocated memory space does not exceed the&lt;br /&gt;
guaranteed amount (the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt;),&lt;br /&gt;
memory allocations of container's applications always succeed.&lt;br /&gt;
If the current amount of allocated memory space exceeds the guarantee but below&lt;br /&gt;
the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt;, allocations may or may not succeed,&lt;br /&gt;
depending on the total amount of available memory in the system.&lt;br /&gt;
&lt;br /&gt;
Starting from the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt;,&lt;br /&gt;
normal priority allocations and, starting from the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;&lt;br /&gt;
of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt;, all memory allocations&lt;br /&gt;
made by the applications fail.&lt;br /&gt;
The memory allocation guarantee (&amp;lt;code&amp;gt;vmguarpages&amp;lt;/code&amp;gt;) is a primary tool for&lt;br /&gt;
controlling the memory available to containers, because&lt;br /&gt;
it allows administrators to provide Service Level Agreements — agreements&lt;br /&gt;
guaranteeing certain quality of service, certain amount of resources&lt;br /&gt;
and general availability of the service. The unit of measurement&lt;br /&gt;
of vmguarpages values is memory pages (4KB on x86 and x86_64 processors).&lt;br /&gt;
The total memory allocation guarantees given to containers&lt;br /&gt;
are limited by the physical resources of the computer — the size of RAM&lt;br /&gt;
and the swap space — as discussed in [[UBC systemwide configuration]].&lt;br /&gt;
&lt;br /&gt;
There is a ''pseudo-graphical'' tool - &amp;lt;code&amp;gt;[http://en.dklab.ru/lib/dklab_vzmem/ vzmem]&amp;lt;/code&amp;gt; - which allows you to distribute physical memory among all VEs consistently. It shows all physical memory blocks graphically in &amp;lt;code&amp;gt;/etc/vz/conf/MEM-MAP&amp;lt;/code&amp;gt; text file and lets you to move these blocks from one VE to another to redistribute the memory. Also you may specify &amp;quot;additional&amp;quot; memory personally for each VE: such memory will be obtained from system's free memory or swap (it is reflected as modifying of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
For full article, see: [[UBC parameter units]]&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10798</id>
		<title>UBC secondary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10798"/>
		<updated>2011-08-15T22:37:43Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: Indented parameters by another heading level so toc is easier to follow&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
'''Secondary (dependant) UBC parameters''' are directly connected&lt;br /&gt;
to the [[UBC primary parameters|primary ones]] and can't be configured arbitrarily.&lt;br /&gt;
&lt;br /&gt;
== UBC Secondary Parameters ==&lt;br /&gt;
=== kmemsize ===&lt;br /&gt;
Size of unswappable memory in bytes, allocated by the operating system kernel.&lt;br /&gt;
&lt;br /&gt;
It includes all the kernel internal data structures associated with the&lt;br /&gt;
container's processes, except the network buffers discussed below.&lt;br /&gt;
These data structures reside in the first gigabyte of the computer's RAM,&lt;br /&gt;
so called [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
This parameter is related to the number of processes ([[numproc]]).&lt;br /&gt;
Each process consumes certain amount of kernel memory —&lt;br /&gt;
24 kilobytes at minimum, 30–60 KB typically.&lt;br /&gt;
Very large processes may consume much more than that.&lt;br /&gt;
&lt;br /&gt;
It is important to have a certain safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and&lt;br /&gt;
the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
(for example, 10%, as in [[UBC configuration examples]]).  Equal &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of&lt;br /&gt;
the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter may lead to the situation where the kernel will&lt;br /&gt;
need to kill container's applications to keep the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt;&lt;br /&gt;
usage under the limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Kmemsize&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the socket buffer space (see below) is limited by the&lt;br /&gt;
hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== tcpsndbuf ===&lt;br /&gt;
The total size of buffers used to send data over TCP network connections.&lt;br /&gt;
These socket buffers reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcpsndbuf_{lim} - tcpsndbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may silently stall, being unable to transmit data.&lt;br /&gt;
&lt;br /&gt;
Setting high values for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
may, but doesn't necessarily, increase performance of network communications.&lt;br /&gt;
Note that, unlike most other parameters, hitting &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
&lt;br /&gt;
If you use rtorrent in a container, a low value for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; may cause rtorrent to take unusual amount of cpu. In this case, you must put a higher value. Also watch the number of failcnt in /proc/user_beancounters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== tcprcvbuf ===&lt;br /&gt;
The total size of buffers used to temporary store the data coming from TCP network connections.&lt;br /&gt;
These socket buffers also reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcprcvbuf_{lim} - tcprcvbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may stall, being unable to receive data, and will be terminated&lt;br /&gt;
after a couple of minutes.&lt;br /&gt;
&lt;br /&gt;
Similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, setting high values for &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
parameter may, but doesn't necessarily, increase performance of network&lt;br /&gt;
communications.&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
However, staying above the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
for a long time is less harmless than for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;.&lt;br /&gt;
Long periods of exceeding the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; may cause termination&lt;br /&gt;
of some connections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== othersockbuf ===&lt;br /&gt;
The total size of buffers used by local (UNIX-domain) connections between&lt;br /&gt;
processes inside the system (such as connections to a local database server)&lt;br /&gt;
and send buffers of UDP and other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; parameter depends on number of non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; configuration should satisfy&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;othersockbuf_{lim} - othersockbuf_{bar} \ge 2.5KB \cdot numothersock.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Increased limit for &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; is necessary for high performance of&lt;br /&gt;
communications through local (UNIX-domain) sockets.&lt;br /&gt;
However, similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, hitting &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; affects&lt;br /&gt;
the communication performance only and does not affect the functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== dgramrcvbuf ===&lt;br /&gt;
The total size of buffers used to temporary store the incoming packets of UDP and&lt;br /&gt;
other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; parameters depend on number of&lt;br /&gt;
non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits usually don't need to be high.&lt;br /&gt;
Only if the containers needs to send and receive very large&lt;br /&gt;
datagrams, the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;s for both &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; parameters should be raised.&lt;br /&gt;
&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; means that some datagrams are dropped, which may&lt;br /&gt;
or may not be important for application functionality.&lt;br /&gt;
UDP is a protocol with not guaranteed delivery, so even if the buffers&lt;br /&gt;
permit, the datagrams may be as well dropped later on any stage of the&lt;br /&gt;
processing, and applications should be prepared for it.&lt;br /&gt;
&lt;br /&gt;
Unlike other socket buffer parameters, for &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
=== oomguarpages ===&lt;br /&gt;
The guaranteed amount of memory for the case the memory is “over-booked”&lt;br /&gt;
(out-of-memory kill guarantee).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Oomguarpages&amp;lt;/code&amp;gt; parameter is related to &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
If applications start to consume more memory than the computer has,&lt;br /&gt;
the system faces an out-of-memory condition.&lt;br /&gt;
In this case the operating system will start to kill container's&lt;br /&gt;
processes to free some memory and prevent the total death&lt;br /&gt;
of the system.  Although it happens very rarely in typical system loads,&lt;br /&gt;
killing processes in out-of-memory situations is a normal reaction of the&lt;br /&gt;
system, and it is built into every Linux kernel&amp;lt;ref&amp;gt;The possible reasons of out-of-memory situations are the excess of total &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees the available physical resources or high memory consumption by system processes.  Also, the kernel might allow some containers to allocate memory above their &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees when the system had a lot of free memory, and later, when other containers claim their guarantees, the system will experience the memory shortage.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Oomguarpages]]&amp;lt;/code&amp;gt; parameter accounts the total amount of&lt;br /&gt;
memory and swap space used by the processes of a particular&lt;br /&gt;
container.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is the out-of-memory&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
If the current usage of memory and swap space&lt;br /&gt;
(the value of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt;) plus the amount of used kernel memory&lt;br /&gt;
(&amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;) and socket buffers is below the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;,&lt;br /&gt;
processes in this container are guaranteed not to be killed in&lt;br /&gt;
out-of-memory situations.&lt;br /&gt;
If the system is in out-of-memory situation and there are several&lt;br /&gt;
containers with &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; excess, applications in the&lt;br /&gt;
container with the biggest excess will be killed first.&lt;br /&gt;
The &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; counter of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
increases when a process in this container is killed because&lt;br /&gt;
of out-of-memory situation.&lt;br /&gt;
&lt;br /&gt;
If the administrator needs to make sure that some application won't be&lt;br /&gt;
forcedly killed regardless of the application's behavior,&lt;br /&gt;
setting the &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt; limit to a value not greater than the&lt;br /&gt;
&amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee significantly reduce the likelihood of&lt;br /&gt;
the application being killed,&lt;br /&gt;
and setting it to a half of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee completely&lt;br /&gt;
prevents it.&lt;br /&gt;
Such configurations are not popular because they significantly reduce&lt;br /&gt;
the utilization of the hardware.&lt;br /&gt;
&lt;br /&gt;
The meaning of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is&lt;br /&gt;
unspecified in the current version.&lt;br /&gt;
&lt;br /&gt;
The total out-of-memory guarantees given to the containers should&lt;br /&gt;
not exceed the physical capacity of the computer, as discussed in [[UBC systemwide configuration#Memory and swap space]].&lt;br /&gt;
If guarantees are given for more than the system has, in out-of-memory&lt;br /&gt;
situations applications in containers with guaranteed level of&lt;br /&gt;
service and system daemons may be killed.&lt;br /&gt;
&lt;br /&gt;
=== privvmpages ===&lt;br /&gt;
Memory allocation limit in [[Memory_page|pages]] (which are typically 4096 bytes in size).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
allows controlling the amount of memory allocated by applications.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
control the upper boundary of the total size of allocated memory.&lt;br /&gt;
Note that this upper boundary doesn't guarantee that the container&lt;br /&gt;
will be able to allocate that much memory, neither does it guarantee that&lt;br /&gt;
other containers will be able to allocate their fair share of&lt;br /&gt;
memory.&lt;br /&gt;
The primary mechanism to control memory allocation is the &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter accounts allocated (but, possibly,&lt;br /&gt;
not used yet) memory.&lt;br /&gt;
The accounted value is an estimation how much memory will be really consumed&lt;br /&gt;
when the container's applications start to use the allocated&lt;br /&gt;
memory.&lt;br /&gt;
Consumed memory is accounted into &amp;lt;code&amp;gt;[[oomguarpages]]&amp;lt;/code&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Since the memory accounted into &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; may not be actually used,&lt;br /&gt;
the sum of current &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; values for all containers&lt;br /&gt;
may exceed the RAM and swap size of the computer.&lt;br /&gt;
&lt;br /&gt;
There should be a safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;&lt;br /&gt;
for &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter to reduce the number of memory allocation&lt;br /&gt;
failures that the application is unable to handle.&lt;br /&gt;
This gap will be used for “high-priority” memory allocations, such&lt;br /&gt;
as process stack expansion.&lt;br /&gt;
Normal priority allocations will fail when the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; is reached.&lt;br /&gt;
&lt;br /&gt;
Total &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; should correlate with the physical resources of the&lt;br /&gt;
computer.&lt;br /&gt;
Also, it is important not to allow any container to allocate a&lt;br /&gt;
significant portion of all system RAM to avoid serious service level&lt;br /&gt;
degradation for other containers.&lt;br /&gt;
Both these configuration requirements are discussed in [[UBC systemwide configuration#Allocated memory]].&lt;br /&gt;
&lt;br /&gt;
There's also an article describing how [[user pages accounting]] works.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
&lt;br /&gt;
For full article, see: [[UBC parameter units]]&lt;br /&gt;
&lt;br /&gt;
== System-wide limits ==&lt;br /&gt;
All secondary parameters are related to memory.&lt;br /&gt;
Total limits on memory-related parameters must not exceed the physical&lt;br /&gt;
resources of the computer.&lt;br /&gt;
The restrictions on the configuration of memory-related parameters are listed&lt;br /&gt;
in [[UBC systemwide configuration]].&lt;br /&gt;
Those restrictions are very important, because their violation may&lt;br /&gt;
allow any container cause the whole system to hang.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10797</id>
		<title>UBC secondary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10797"/>
		<updated>2011-08-15T22:34:10Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: /* Units */ linked units subheading to the UBC parameter units page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
'''Secondary (dependant) UBC parameters''' are directly connected&lt;br /&gt;
to the [[UBC primary parameters|primary ones]] and can't be configured arbitrarily.&lt;br /&gt;
&lt;br /&gt;
== kmemsize ==&lt;br /&gt;
Size of unswappable memory in bytes, allocated by the operating system kernel.&lt;br /&gt;
&lt;br /&gt;
It includes all the kernel internal data structures associated with the&lt;br /&gt;
container's processes, except the network buffers discussed below.&lt;br /&gt;
These data structures reside in the first gigabyte of the computer's RAM,&lt;br /&gt;
so called [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
This parameter is related to the number of processes ([[numproc]]).&lt;br /&gt;
Each process consumes certain amount of kernel memory —&lt;br /&gt;
24 kilobytes at minimum, 30–60 KB typically.&lt;br /&gt;
Very large processes may consume much more than that.&lt;br /&gt;
&lt;br /&gt;
It is important to have a certain safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and&lt;br /&gt;
the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
(for example, 10%, as in [[UBC configuration examples]]).  Equal &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of&lt;br /&gt;
the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter may lead to the situation where the kernel will&lt;br /&gt;
need to kill container's applications to keep the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt;&lt;br /&gt;
usage under the limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Kmemsize&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the socket buffer space (see below) is limited by the&lt;br /&gt;
hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== tcpsndbuf ==&lt;br /&gt;
The total size of buffers used to send data over TCP network connections.&lt;br /&gt;
These socket buffers reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcpsndbuf_{lim} - tcpsndbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may silently stall, being unable to transmit data.&lt;br /&gt;
&lt;br /&gt;
Setting high values for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
may, but doesn't necessarily, increase performance of network communications.&lt;br /&gt;
Note that, unlike most other parameters, hitting &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
&lt;br /&gt;
If you use rtorrent in a container, a low value for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; may cause rtorrent to take unusual amount of cpu. In this case, you must put a higher value. Also watch the number of failcnt in /proc/user_beancounters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== tcprcvbuf ==&lt;br /&gt;
The total size of buffers used to temporary store the data coming from TCP network connections.&lt;br /&gt;
These socket buffers also reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcprcvbuf_{lim} - tcprcvbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may stall, being unable to receive data, and will be terminated&lt;br /&gt;
after a couple of minutes.&lt;br /&gt;
&lt;br /&gt;
Similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, setting high values for &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
parameter may, but doesn't necessarily, increase performance of network&lt;br /&gt;
communications.&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
However, staying above the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
for a long time is less harmless than for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;.&lt;br /&gt;
Long periods of exceeding the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; may cause termination&lt;br /&gt;
of some connections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== othersockbuf ==&lt;br /&gt;
The total size of buffers used by local (UNIX-domain) connections between&lt;br /&gt;
processes inside the system (such as connections to a local database server)&lt;br /&gt;
and send buffers of UDP and other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; parameter depends on number of non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; configuration should satisfy&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;othersockbuf_{lim} - othersockbuf_{bar} \ge 2.5KB \cdot numothersock.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Increased limit for &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; is necessary for high performance of&lt;br /&gt;
communications through local (UNIX-domain) sockets.&lt;br /&gt;
However, similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, hitting &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; affects&lt;br /&gt;
the communication performance only and does not affect the functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== dgramrcvbuf ==&lt;br /&gt;
The total size of buffers used to temporary store the incoming packets of UDP and&lt;br /&gt;
other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; parameters depend on number of&lt;br /&gt;
non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits usually don't need to be high.&lt;br /&gt;
Only if the containers needs to send and receive very large&lt;br /&gt;
datagrams, the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;s for both &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; parameters should be raised.&lt;br /&gt;
&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; means that some datagrams are dropped, which may&lt;br /&gt;
or may not be important for application functionality.&lt;br /&gt;
UDP is a protocol with not guaranteed delivery, so even if the buffers&lt;br /&gt;
permit, the datagrams may be as well dropped later on any stage of the&lt;br /&gt;
processing, and applications should be prepared for it.&lt;br /&gt;
&lt;br /&gt;
Unlike other socket buffer parameters, for &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== oomguarpages ==&lt;br /&gt;
The guaranteed amount of memory for the case the memory is “over-booked”&lt;br /&gt;
(out-of-memory kill guarantee).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Oomguarpages&amp;lt;/code&amp;gt; parameter is related to &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
If applications start to consume more memory than the computer has,&lt;br /&gt;
the system faces an out-of-memory condition.&lt;br /&gt;
In this case the operating system will start to kill container's&lt;br /&gt;
processes to free some memory and prevent the total death&lt;br /&gt;
of the system.  Although it happens very rarely in typical system loads,&lt;br /&gt;
killing processes in out-of-memory situations is a normal reaction of the&lt;br /&gt;
system, and it is built into every Linux kernel&amp;lt;ref&amp;gt;The possible reasons of out-of-memory situations are the excess of total &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees the available physical resources or high memory consumption by system processes.  Also, the kernel might allow some containers to allocate memory above their &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees when the system had a lot of free memory, and later, when other containers claim their guarantees, the system will experience the memory shortage.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Oomguarpages]]&amp;lt;/code&amp;gt; parameter accounts the total amount of&lt;br /&gt;
memory and swap space used by the processes of a particular&lt;br /&gt;
container.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is the out-of-memory&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
If the current usage of memory and swap space&lt;br /&gt;
(the value of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt;) plus the amount of used kernel memory&lt;br /&gt;
(&amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;) and socket buffers is below the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;,&lt;br /&gt;
processes in this container are guaranteed not to be killed in&lt;br /&gt;
out-of-memory situations.&lt;br /&gt;
If the system is in out-of-memory situation and there are several&lt;br /&gt;
containers with &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; excess, applications in the&lt;br /&gt;
container with the biggest excess will be killed first.&lt;br /&gt;
The &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; counter of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
increases when a process in this container is killed because&lt;br /&gt;
of out-of-memory situation.&lt;br /&gt;
&lt;br /&gt;
If the administrator needs to make sure that some application won't be&lt;br /&gt;
forcedly killed regardless of the application's behavior,&lt;br /&gt;
setting the &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt; limit to a value not greater than the&lt;br /&gt;
&amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee significantly reduce the likelihood of&lt;br /&gt;
the application being killed,&lt;br /&gt;
and setting it to a half of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee completely&lt;br /&gt;
prevents it.&lt;br /&gt;
Such configurations are not popular because they significantly reduce&lt;br /&gt;
the utilization of the hardware.&lt;br /&gt;
&lt;br /&gt;
The meaning of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is&lt;br /&gt;
unspecified in the current version.&lt;br /&gt;
&lt;br /&gt;
The total out-of-memory guarantees given to the containers should&lt;br /&gt;
not exceed the physical capacity of the computer, as discussed in [[UBC systemwide configuration#Memory and swap space]].&lt;br /&gt;
If guarantees are given for more than the system has, in out-of-memory&lt;br /&gt;
situations applications in containers with guaranteed level of&lt;br /&gt;
service and system daemons may be killed.&lt;br /&gt;
&lt;br /&gt;
== privvmpages ==&lt;br /&gt;
Memory allocation limit in [[Memory_page|pages]] (which are typically 4096 bytes in size).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
allows controlling the amount of memory allocated by applications.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
control the upper boundary of the total size of allocated memory.&lt;br /&gt;
Note that this upper boundary doesn't guarantee that the container&lt;br /&gt;
will be able to allocate that much memory, neither does it guarantee that&lt;br /&gt;
other containers will be able to allocate their fair share of&lt;br /&gt;
memory.&lt;br /&gt;
The primary mechanism to control memory allocation is the &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter accounts allocated (but, possibly,&lt;br /&gt;
not used yet) memory.&lt;br /&gt;
The accounted value is an estimation how much memory will be really consumed&lt;br /&gt;
when the container's applications start to use the allocated&lt;br /&gt;
memory.&lt;br /&gt;
Consumed memory is accounted into &amp;lt;code&amp;gt;[[oomguarpages]]&amp;lt;/code&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Since the memory accounted into &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; may not be actually used,&lt;br /&gt;
the sum of current &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; values for all containers&lt;br /&gt;
may exceed the RAM and swap size of the computer.&lt;br /&gt;
&lt;br /&gt;
There should be a safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;&lt;br /&gt;
for &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter to reduce the number of memory allocation&lt;br /&gt;
failures that the application is unable to handle.&lt;br /&gt;
This gap will be used for “high-priority” memory allocations, such&lt;br /&gt;
as process stack expansion.&lt;br /&gt;
Normal priority allocations will fail when the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; is reached.&lt;br /&gt;
&lt;br /&gt;
Total &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; should correlate with the physical resources of the&lt;br /&gt;
computer.&lt;br /&gt;
Also, it is important not to allow any container to allocate a&lt;br /&gt;
significant portion of all system RAM to avoid serious service level&lt;br /&gt;
degradation for other containers.&lt;br /&gt;
Both these configuration requirements are discussed in [[UBC systemwide configuration#Allocated memory]].&lt;br /&gt;
&lt;br /&gt;
There's also an article describing how [[user pages accounting]] works.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
&lt;br /&gt;
For full article, see: [[UBC parameter units]]&lt;br /&gt;
&lt;br /&gt;
== System-wide limits ==&lt;br /&gt;
All secondary parameters are related to memory.&lt;br /&gt;
Total limits on memory-related parameters must not exceed the physical&lt;br /&gt;
resources of the computer.&lt;br /&gt;
The restrictions on the configuration of memory-related parameters are listed&lt;br /&gt;
in [[UBC systemwide configuration]].&lt;br /&gt;
Those restrictions are very important, because their violation may&lt;br /&gt;
allow any container cause the whole system to hang.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Setting_UBC_parameters&amp;diff=10745</id>
		<title>Talk:Setting UBC parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Setting_UBC_parameters&amp;diff=10745"/>
		<updated>2011-08-03T06:42:27Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: Suggested refactoring of this page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I don't find summerising discussions/threads to be all that enlightening for a new user as myself. It's much better to summarise the main points in a succinct way. If you must use Q+A, couldn't they go into an FAQ. I came here thinking I might actually learn how to set the UBC parameters. Only after seeing vzctl on the [[Resource shortage]] page did I actually find what I need.&lt;br /&gt;
&lt;br /&gt;
Unless there are screems of &amp;quot;NOoooooo&amp;quot;, I'll refactor this page over the coming weeks. --[[User:Nathanhaigh|Nathanhaigh]] 06:42, 3 August 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_parameters_table&amp;diff=10743</id>
		<title>UBC parameters table</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_parameters_table&amp;diff=10743"/>
		<updated>2011-08-01T23:11:03Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: Updated some descriptions to come in line with what's show on UBC_primary_parameters, UBC_secondary_parameters etc&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | [[UBC primary parameters|Primary parameters]]&lt;br /&gt;
|-&lt;br /&gt;
| [[numproc]]        || Maximum number of processes and kernel-level threads allowed for this container.&lt;br /&gt;
|-&lt;br /&gt;
| [[numtcpsock]]     || Maximum number of TCP sockets.&lt;br /&gt;
|-&lt;br /&gt;
| [[numothersock]]   || Maximum number of non-TCP sockets (local sockets, UDP and other types of sockets).&lt;br /&gt;
|-&lt;br /&gt;
| [[vmguarpages]]    || Memory allocation guarantee.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | [[UBC secondary parameters|Secondary parameters]]&lt;br /&gt;
|-&lt;br /&gt;
| [[kmemsize]]       || Size of unswappable kernel memory, allocated allocated for processes in this [[container]].&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpsndbuf]]      || Total size of buffers used to send data over TCP network connections.&lt;br /&gt;
|-&lt;br /&gt;
| [[tcprcvbuf]]      || Total size of buffers used to temporary store the data coming from TCP network connections.&lt;br /&gt;
|-&lt;br /&gt;
| [[othersockbuf]]   || Total size of UNIX-domain socket buffers, UDP and other datagram protocol send buffers.&lt;br /&gt;
|-&lt;br /&gt;
| [[dgramrcvbuf]]    || Receive buffers of UDP and other datagram protocols.&lt;br /&gt;
|-&lt;br /&gt;
| [[oomguarpages]]   || The guaranteed amount of memory for the case the memory is “over-booked” (out-of-memory kill guarantee).&lt;br /&gt;
|-&lt;br /&gt;
| [[privvmpages]]    || Memory allocation limit, in pages.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | [[UBC auxiliary parameters|Auxiliary parameters]]&lt;br /&gt;
|-&lt;br /&gt;
| [[lockedpages]]    || Process pages not allowed to be swapped out (pages locked by &amp;lt;code&amp;gt;mlock(2)&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| [[shmpages]]       || Total size of shared memory (IPC, shared anonymous mappings and &amp;lt;code&amp;gt;tmpfs&amp;lt;/code&amp;gt; objects), in pages.&lt;br /&gt;
|-&lt;br /&gt;
| [[physpages]]      || Total number of RAM pages used by processes.&lt;br /&gt;
|-&lt;br /&gt;
| [[numfile]]        || Number of open files.&lt;br /&gt;
|-&lt;br /&gt;
| [[numflock]]       || Number of file locks.&lt;br /&gt;
|-&lt;br /&gt;
| [[numpty]]         || Number of pseudo-terminals.&lt;br /&gt;
|-&lt;br /&gt;
| [[numsiginfo]]     || Number of &amp;lt;code&amp;gt;siginfo&amp;lt;/code&amp;gt; structures.&lt;br /&gt;
|-&lt;br /&gt;
| [[dcachesize]]     || Total size of &amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;inode&amp;lt;/code&amp;gt; structures locked in memory.&lt;br /&gt;
|-&lt;br /&gt;
| [[numiptent]]      || Number of NETFILTER (IP packet filtering) entries.&lt;br /&gt;
|-&lt;br /&gt;
| [[swappages]]      || Amount of swap space to show in container.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_parameters_table&amp;diff=10742</id>
		<title>UBC parameters table</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_parameters_table&amp;diff=10742"/>
		<updated>2011-08-01T23:04:05Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: Link primary, secondary and auxiliary to their own pages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | [[UBC primary parameters|Primary parameters]]&lt;br /&gt;
|-&lt;br /&gt;
| [[numproc]]        || Number of processes and threads.&lt;br /&gt;
|-&lt;br /&gt;
| [[numtcpsock]]     || Number of TCP sockets.&lt;br /&gt;
|-&lt;br /&gt;
| [[numothersock]]   || Number of sockets other than TCP.&lt;br /&gt;
|-&lt;br /&gt;
| [[vmguarpages]]    || Memory allocation guarantee, in pages.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | [[UBC secondary parameters|Secondary parameters]]&lt;br /&gt;
|-&lt;br /&gt;
| [[kmemsize]]       || Size of unswappable kernel memory, allocated for processes in this [[container]].&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpsndbuf]]      || Total size of TCP send buffers.&lt;br /&gt;
|-&lt;br /&gt;
| [[tcprcvbuf]]      || Total size of TCP receive buffers.&lt;br /&gt;
|-&lt;br /&gt;
| [[othersockbuf]]   || Total size of UNIX-domain socket buffers, UDP and other datagram protocol send buffers.&lt;br /&gt;
|-&lt;br /&gt;
| [[dgramrcvbuf]]    || Receive buffers of UDP and other datagram protocols.&lt;br /&gt;
|-&lt;br /&gt;
| [[oomguarpages]]   || The guaranteed amount of memory for the case the memory is “over-booked” (out-of-memory kill guarantee), in pages.&lt;br /&gt;
|-&lt;br /&gt;
| [[privvmpages]]    || Memory allocation limit, in pages.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | [[UBC auxiliary parameters|Auxiliary parameters]]&lt;br /&gt;
|-&lt;br /&gt;
| [[lockedpages]]    || Process pages not allowed to be swapped out (pages locked by &amp;lt;code&amp;gt;mlock(2)&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| [[shmpages]]       || Total size of shared memory (IPC, shared anonymous mappings and &amp;lt;code&amp;gt;tmpfs&amp;lt;/code&amp;gt; objects), in pages.&lt;br /&gt;
|-&lt;br /&gt;
| [[physpages]]      || Total number of RAM pages used by processes.&lt;br /&gt;
|-&lt;br /&gt;
| [[numfile]]        || Number of open files.&lt;br /&gt;
|-&lt;br /&gt;
| [[numflock]]       || Number of file locks.&lt;br /&gt;
|-&lt;br /&gt;
| [[numpty]]         || Number of pseudo-terminals.&lt;br /&gt;
|-&lt;br /&gt;
| [[numsiginfo]]     || Number of &amp;lt;code&amp;gt;siginfo&amp;lt;/code&amp;gt; structures.&lt;br /&gt;
|-&lt;br /&gt;
| [[dcachesize]]     || Total size of &amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;inode&amp;lt;/code&amp;gt; structures locked in memory.&lt;br /&gt;
|-&lt;br /&gt;
| [[numiptent]]      || Number of NETFILTER (IP packet filtering) entries.&lt;br /&gt;
|-&lt;br /&gt;
| [[swappages]]      || Amount of swap space to show in container.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_parameters_table&amp;diff=10741</id>
		<title>UBC parameters table</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_parameters_table&amp;diff=10741"/>
		<updated>2011-08-01T23:02:21Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: Link each parameter to the details page of each parameter&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | Primary parameters&lt;br /&gt;
|-&lt;br /&gt;
| [[numproc]]        || Number of processes and threads.&lt;br /&gt;
|-&lt;br /&gt;
| [[numtcpsock]]     || Number of TCP sockets.&lt;br /&gt;
|-&lt;br /&gt;
| [[numothersock]]   || Number of sockets other than TCP.&lt;br /&gt;
|-&lt;br /&gt;
| [[vmguarpages]]    || Memory allocation guarantee, in pages.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | Secondary parameters&lt;br /&gt;
|-&lt;br /&gt;
| [[kmemsize]]       || Size of unswappable kernel memory, allocated for processes in this [[container]].&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpsndbuf]]      || Total size of TCP send buffers.&lt;br /&gt;
|-&lt;br /&gt;
| [[tcprcvbuf]]      || Total size of TCP receive buffers.&lt;br /&gt;
|-&lt;br /&gt;
| [[othersockbuf]]   || Total size of UNIX-domain socket buffers, UDP and other datagram protocol send buffers.&lt;br /&gt;
|-&lt;br /&gt;
| [[dgramrcvbuf]]    || Receive buffers of UDP and other datagram protocols.&lt;br /&gt;
|-&lt;br /&gt;
| [[oomguarpages]]   || The guaranteed amount of memory for the case the memory is “over-booked” (out-of-memory kill guarantee), in pages.&lt;br /&gt;
|-&lt;br /&gt;
| [[privvmpages]]    || Memory allocation limit, in pages.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot; | Auxiliary parameters&lt;br /&gt;
|-&lt;br /&gt;
| [[lockedpages]]    || Process pages not allowed to be swapped out (pages locked by &amp;lt;code&amp;gt;mlock(2)&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| [[shmpages]]       || Total size of shared memory (IPC, shared anonymous mappings and &amp;lt;code&amp;gt;tmpfs&amp;lt;/code&amp;gt; objects), in pages.&lt;br /&gt;
|-&lt;br /&gt;
| [[physpages]]      || Total number of RAM pages used by processes.&lt;br /&gt;
|-&lt;br /&gt;
| [[numfile]]        || Number of open files.&lt;br /&gt;
|-&lt;br /&gt;
| [[numflock]]       || Number of file locks.&lt;br /&gt;
|-&lt;br /&gt;
| [[numpty]]         || Number of pseudo-terminals.&lt;br /&gt;
|-&lt;br /&gt;
| [[numsiginfo]]     || Number of &amp;lt;code&amp;gt;siginfo&amp;lt;/code&amp;gt; structures.&lt;br /&gt;
|-&lt;br /&gt;
| [[dcachesize]]     || Total size of &amp;lt;code&amp;gt;dentry&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;inode&amp;lt;/code&amp;gt; structures locked in memory.&lt;br /&gt;
|-&lt;br /&gt;
| [[numiptent]]      || Number of NETFILTER (IP packet filtering) entries.&lt;br /&gt;
|-&lt;br /&gt;
| [[swappages]]      || Amount of swap space to show in container.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_parameter_units&amp;diff=10740</id>
		<title>UBC parameter units</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_parameter_units&amp;diff=10740"/>
		<updated>2011-08-01T23:00:42Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: Reformatted for easier reading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[User Beancounters]] have default units which are used when viewing and setting the parameter values. When setting the values for some parameters, you are able to specify [[#Overriding Default Units|different units]] thereby avoiding the need to do manual conversion of units and making life a little easier!&lt;br /&gt;
&lt;br /&gt;
{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
&lt;br /&gt;
Parameters which have the suffix &amp;quot;page&amp;quot; are measured in numbers of [[memory page|pages]]. These include:&lt;br /&gt;
&lt;br /&gt;
* [[UBC primary parameters|Primary Parameters]]&lt;br /&gt;
** &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[UBC secondary parameters|Secondary Parameters]]&lt;br /&gt;
** &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[oomguarpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[UBC auxiliary parameters|Auxiliary Parameters]]&lt;br /&gt;
** &amp;lt;code&amp;gt;[[lockedpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[shmpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[physpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[swappages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When using [[vzctl]] to set these beancounter parameters, you can override the default units of &amp;quot;pages&amp;quot; by using a [[#Overriding Default Units|valid suffix]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Numbers of Items ==&lt;br /&gt;
&lt;br /&gt;
Parameters with the prefix &amp;quot;num&amp;quot; are measured in numbers of items:&lt;br /&gt;
&lt;br /&gt;
* [[UBC primary parameters|Primary Parameters]]&lt;br /&gt;
** &amp;lt;code&amp;gt;[[numproc]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[numtcpsock]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[UBC secondary parameters|Secondary Parameters]]&lt;br /&gt;
** None&lt;br /&gt;
&lt;br /&gt;
* [[UBC auxiliary parameters|Auxiliary Parameters]]&lt;br /&gt;
** &amp;lt;code&amp;gt;[[numfile]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[numflock]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[numpty]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[numsiginfo]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[numiptent]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Bytes ==&lt;br /&gt;
&lt;br /&gt;
Other parameters are measured in bytes:&lt;br /&gt;
&lt;br /&gt;
* [[UBC primary parameters|Primary Parameters]]&lt;br /&gt;
** None&lt;br /&gt;
&lt;br /&gt;
* [[UBC secondary parameters|Secondary Parameters]]&lt;br /&gt;
** &amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[tcprcvbuf]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[tcpsndbuf]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[othersockbuf]]&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;[[dgramrcvbuf]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[UBC auxiliary parameters|Auxiliary Parameters]]&lt;br /&gt;
** &amp;lt;code&amp;gt;[[dcachesize]]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When using [[vzctl]] to set these beancounter parameters, you can override the default units of &amp;quot;bytes&amp;quot; by using a [[#Overriding Default Units|valid suffix]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Overriding Default Units ==&lt;br /&gt;
&lt;br /&gt;
When using [[vzctl]] to set beancounter parameters which use &amp;quot;Pages&amp;quot; or &amp;quot;Bytes&amp;quot; as the default units, alternative units may be specified using one of the following suffixes:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Suffix&lt;br /&gt;
! Alternative Suffix&lt;br /&gt;
! Units&lt;br /&gt;
|-&lt;br /&gt;
| g || G || gigabytes&lt;br /&gt;
|-&lt;br /&gt;
| m || M || megabytes&lt;br /&gt;
|-&lt;br /&gt;
| k || K || kilobytes&lt;br /&gt;
|-&lt;br /&gt;
| p || P || [[memory page|pages]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
The following are some examples to demonstrate the use of different units when specifying the value of a parameter. Where &amp;lt;code&amp;gt;$CTID&amp;lt;/code&amp;gt; is the container ID.&lt;br /&gt;
&lt;br /&gt;
* Set &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; limit to 512 Kb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# vzctl set $CTID --kmemsize 512k&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Set &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; limit to 256 Mb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# vzctl set $CTID --privvmpages 256m&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Set &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; limit to 1000 pages (totals to almost 4 Mb on x86)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# vzctl set $CTID --tcprcvbuf 1000p&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10737</id>
		<title>UBC secondary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10737"/>
		<updated>2011-08-01T04:57:12Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: /* privvmpages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
'''Secondary (dependant) UBC parameters''' are directly connected&lt;br /&gt;
to the [[UBC primary parameters|primary ones]] and can't be configured arbitrarily.&lt;br /&gt;
&lt;br /&gt;
== kmemsize ==&lt;br /&gt;
Size of unswappable memory in bytes, allocated by the operating system kernel.&lt;br /&gt;
&lt;br /&gt;
It includes all the kernel internal data structures associated with the&lt;br /&gt;
container's processes, except the network buffers discussed below.&lt;br /&gt;
These data structures reside in the first gigabyte of the computer's RAM,&lt;br /&gt;
so called [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
This parameter is related to the number of processes ([[numproc]]).&lt;br /&gt;
Each process consumes certain amount of kernel memory —&lt;br /&gt;
24 kilobytes at minimum, 30–60 KB typically.&lt;br /&gt;
Very large processes may consume much more than that.&lt;br /&gt;
&lt;br /&gt;
It is important to have a certain safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and&lt;br /&gt;
the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
(for example, 10%, as in [[UBC configuration examples]]).  Equal &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of&lt;br /&gt;
the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter may lead to the situation where the kernel will&lt;br /&gt;
need to kill container's applications to keep the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt;&lt;br /&gt;
usage under the limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Kmemsize&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the socket buffer space (see below) is limited by the&lt;br /&gt;
hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== tcpsndbuf ==&lt;br /&gt;
The total size of buffers used to send data over TCP network connections.&lt;br /&gt;
These socket buffers reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcpsndbuf_{lim} - tcpsndbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may silently stall, being unable to transmit data.&lt;br /&gt;
&lt;br /&gt;
Setting high values for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
may, but doesn't necessarily, increase performance of network communications.&lt;br /&gt;
Note that, unlike most other parameters, hitting &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
&lt;br /&gt;
If you use rtorrent in a container, a low value for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; may cause rtorrent to take unusual amount of cpu. In this case, you must put a higher value. Also watch the number of failcnt in /proc/user_beancounters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== tcprcvbuf ==&lt;br /&gt;
The total size of buffers used to temporary store the data coming from TCP network connections.&lt;br /&gt;
These socket buffers also reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcprcvbuf_{lim} - tcprcvbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may stall, being unable to receive data, and will be terminated&lt;br /&gt;
after a couple of minutes.&lt;br /&gt;
&lt;br /&gt;
Similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, setting high values for &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
parameter may, but doesn't necessarily, increase performance of network&lt;br /&gt;
communications.&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
However, staying above the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
for a long time is less harmless than for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;.&lt;br /&gt;
Long periods of exceeding the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; may cause termination&lt;br /&gt;
of some connections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== othersockbuf ==&lt;br /&gt;
The total size of buffers used by local (UNIX-domain) connections between&lt;br /&gt;
processes inside the system (such as connections to a local database server)&lt;br /&gt;
and send buffers of UDP and other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; parameter depends on number of non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; configuration should satisfy&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;othersockbuf_{lim} - othersockbuf_{bar} \ge 2.5KB \cdot numothersock.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Increased limit for &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; is necessary for high performance of&lt;br /&gt;
communications through local (UNIX-domain) sockets.&lt;br /&gt;
However, similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, hitting &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; affects&lt;br /&gt;
the communication performance only and does not affect the functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== dgramrcvbuf ==&lt;br /&gt;
The total size of buffers used to temporary store the incoming packets of UDP and&lt;br /&gt;
other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; parameters depend on number of&lt;br /&gt;
non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits usually don't need to be high.&lt;br /&gt;
Only if the containers needs to send and receive very large&lt;br /&gt;
datagrams, the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;s for both &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; parameters should be raised.&lt;br /&gt;
&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; means that some datagrams are dropped, which may&lt;br /&gt;
or may not be important for application functionality.&lt;br /&gt;
UDP is a protocol with not guaranteed delivery, so even if the buffers&lt;br /&gt;
permit, the datagrams may be as well dropped later on any stage of the&lt;br /&gt;
processing, and applications should be prepared for it.&lt;br /&gt;
&lt;br /&gt;
Unlike other socket buffer parameters, for &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== oomguarpages ==&lt;br /&gt;
The guaranteed amount of memory for the case the memory is “over-booked”&lt;br /&gt;
(out-of-memory kill guarantee).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Oomguarpages&amp;lt;/code&amp;gt; parameter is related to &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
If applications start to consume more memory than the computer has,&lt;br /&gt;
the system faces an out-of-memory condition.&lt;br /&gt;
In this case the operating system will start to kill container's&lt;br /&gt;
processes to free some memory and prevent the total death&lt;br /&gt;
of the system.  Although it happens very rarely in typical system loads,&lt;br /&gt;
killing processes in out-of-memory situations is a normal reaction of the&lt;br /&gt;
system, and it is built into every Linux kernel&amp;lt;ref&amp;gt;The possible reasons of out-of-memory situations are the excess of total &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees the available physical resources or high memory consumption by system processes.  Also, the kernel might allow some containers to allocate memory above their &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees when the system had a lot of free memory, and later, when other containers claim their guarantees, the system will experience the memory shortage.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Oomguarpages]]&amp;lt;/code&amp;gt; parameter accounts the total amount of&lt;br /&gt;
memory and swap space used by the processes of a particular&lt;br /&gt;
container.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is the out-of-memory&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
If the current usage of memory and swap space&lt;br /&gt;
(the value of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt;) plus the amount of used kernel memory&lt;br /&gt;
(&amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;) and socket buffers is below the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;,&lt;br /&gt;
processes in this container are guaranteed not to be killed in&lt;br /&gt;
out-of-memory situations.&lt;br /&gt;
If the system is in out-of-memory situation and there are several&lt;br /&gt;
containers with &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; excess, applications in the&lt;br /&gt;
container with the biggest excess will be killed first.&lt;br /&gt;
The &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; counter of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
increases when a process in this container is killed because&lt;br /&gt;
of out-of-memory situation.&lt;br /&gt;
&lt;br /&gt;
If the administrator needs to make sure that some application won't be&lt;br /&gt;
forcedly killed regardless of the application's behavior,&lt;br /&gt;
setting the &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt; limit to a value not greater than the&lt;br /&gt;
&amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee significantly reduce the likelihood of&lt;br /&gt;
the application being killed,&lt;br /&gt;
and setting it to a half of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee completely&lt;br /&gt;
prevents it.&lt;br /&gt;
Such configurations are not popular because they significantly reduce&lt;br /&gt;
the utilization of the hardware.&lt;br /&gt;
&lt;br /&gt;
The meaning of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is&lt;br /&gt;
unspecified in the current version.&lt;br /&gt;
&lt;br /&gt;
The total out-of-memory guarantees given to the containers should&lt;br /&gt;
not exceed the physical capacity of the computer, as discussed in [[UBC systemwide configuration#Memory and swap space]].&lt;br /&gt;
If guarantees are given for more than the system has, in out-of-memory&lt;br /&gt;
situations applications in containers with guaranteed level of&lt;br /&gt;
service and system daemons may be killed.&lt;br /&gt;
&lt;br /&gt;
== privvmpages ==&lt;br /&gt;
Memory allocation limit in [[Memory_page|pages]] (which are typically 4096 bytes in size).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
allows controlling the amount of memory allocated by applications.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
control the upper boundary of the total size of allocated memory.&lt;br /&gt;
Note that this upper boundary doesn't guarantee that the container&lt;br /&gt;
will be able to allocate that much memory, neither does it guarantee that&lt;br /&gt;
other containers will be able to allocate their fair share of&lt;br /&gt;
memory.&lt;br /&gt;
The primary mechanism to control memory allocation is the &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter accounts allocated (but, possibly,&lt;br /&gt;
not used yet) memory.&lt;br /&gt;
The accounted value is an estimation how much memory will be really consumed&lt;br /&gt;
when the container's applications start to use the allocated&lt;br /&gt;
memory.&lt;br /&gt;
Consumed memory is accounted into &amp;lt;code&amp;gt;[[oomguarpages]]&amp;lt;/code&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Since the memory accounted into &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; may not be actually used,&lt;br /&gt;
the sum of current &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; values for all containers&lt;br /&gt;
may exceed the RAM and swap size of the computer.&lt;br /&gt;
&lt;br /&gt;
There should be a safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;&lt;br /&gt;
for &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter to reduce the number of memory allocation&lt;br /&gt;
failures that the application is unable to handle.&lt;br /&gt;
This gap will be used for “high-priority” memory allocations, such&lt;br /&gt;
as process stack expansion.&lt;br /&gt;
Normal priority allocations will fail when the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; is reached.&lt;br /&gt;
&lt;br /&gt;
Total &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; should correlate with the physical resources of the&lt;br /&gt;
computer.&lt;br /&gt;
Also, it is important not to allow any container to allocate a&lt;br /&gt;
significant portion of all system RAM to avoid serious service level&lt;br /&gt;
degradation for other containers.&lt;br /&gt;
Both these configuration requirements are discussed in [[UBC systemwide configuration#Allocated memory]].&lt;br /&gt;
&lt;br /&gt;
There's also an article describing how [[user pages accounting]] works.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
&amp;lt;code&amp;gt;Oomguarpages&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt;&lt;br /&gt;
values are measured in [[memory page]]s.&lt;br /&gt;
For other secondary parameters, the values are in bytes.&lt;br /&gt;
&lt;br /&gt;
== System-wide limits ==&lt;br /&gt;
All secondary parameters are related to memory.&lt;br /&gt;
Total limits on memory-related parameters must not exceed the physical&lt;br /&gt;
resources of the computer.&lt;br /&gt;
The restrictions on the configuration of memory-related parameters are listed&lt;br /&gt;
in [[UBC systemwide configuration]].&lt;br /&gt;
Those restrictions are very important, because their violation may&lt;br /&gt;
allow any container cause the whole system to hang.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10736</id>
		<title>UBC secondary parameters</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=UBC_secondary_parameters&amp;diff=10736"/>
		<updated>2011-08-01T04:56:09Z</updated>

		<summary type="html">&lt;p&gt;Nathanhaigh: /* privvmpages */ specified number of bytes per page for ease of accounting on beancounter stats&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{UBC toc}}&lt;br /&gt;
&lt;br /&gt;
'''Secondary (dependant) UBC parameters''' are directly connected&lt;br /&gt;
to the [[UBC primary parameters|primary ones]] and can't be configured arbitrarily.&lt;br /&gt;
&lt;br /&gt;
== kmemsize ==&lt;br /&gt;
Size of unswappable memory in bytes, allocated by the operating system kernel.&lt;br /&gt;
&lt;br /&gt;
It includes all the kernel internal data structures associated with the&lt;br /&gt;
container's processes, except the network buffers discussed below.&lt;br /&gt;
These data structures reside in the first gigabyte of the computer's RAM,&lt;br /&gt;
so called [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
This parameter is related to the number of processes ([[numproc]]).&lt;br /&gt;
Each process consumes certain amount of kernel memory —&lt;br /&gt;
24 kilobytes at minimum, 30–60 KB typically.&lt;br /&gt;
Very large processes may consume much more than that.&lt;br /&gt;
&lt;br /&gt;
It is important to have a certain safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and&lt;br /&gt;
the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
(for example, 10%, as in [[UBC configuration examples]]).  Equal &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of&lt;br /&gt;
the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; parameter may lead to the situation where the kernel will&lt;br /&gt;
need to kill container's applications to keep the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt;&lt;br /&gt;
usage under the limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Kmemsize&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the socket buffer space (see below) is limited by the&lt;br /&gt;
hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== tcpsndbuf ==&lt;br /&gt;
The total size of buffers used to send data over TCP network connections.&lt;br /&gt;
These socket buffers reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcpsndbuf_{lim} - tcpsndbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may silently stall, being unable to transmit data.&lt;br /&gt;
&lt;br /&gt;
Setting high values for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
may, but doesn't necessarily, increase performance of network communications.&lt;br /&gt;
Note that, unlike most other parameters, hitting &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
&lt;br /&gt;
If you use rtorrent in a container, a low value for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; may cause rtorrent to take unusual amount of cpu. In this case, you must put a higher value. Also watch the number of failcnt in /proc/user_beancounters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcpsndbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== tcprcvbuf ==&lt;br /&gt;
The total size of buffers used to temporary store the data coming from TCP network connections.&lt;br /&gt;
These socket buffers also reside in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; parameter depends on number of TCP&lt;br /&gt;
sockets ([[numtcpsock]]) and should allow for some minimal amount of&lt;br /&gt;
socket buffer memory for each socket, as discussed in [[UBC consistency check]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;tcprcvbuf_{lim} - tcprcvbuf_{bar} \ge 2.5KB \cdot numtcpsock \rm.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If this restriction is not satisfied, some network connections&lt;br /&gt;
may stall, being unable to receive data, and will be terminated&lt;br /&gt;
after a couple of minutes.&lt;br /&gt;
&lt;br /&gt;
Similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, setting high values for &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
parameter may, but doesn't necessarily, increase performance of network&lt;br /&gt;
communications.&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; limits and failed socket buffer allocations&lt;br /&gt;
do not have strong negative effect on the applications, but just reduce&lt;br /&gt;
performance of network communications.&lt;br /&gt;
However, staying above the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
for a long time is less harmless than for &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;.&lt;br /&gt;
Long periods of exceeding the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; may cause termination&lt;br /&gt;
of some connections.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Tcprcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;tcprcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers is limited&lt;br /&gt;
by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== othersockbuf ==&lt;br /&gt;
The total size of buffers used by local (UNIX-domain) connections between&lt;br /&gt;
processes inside the system (such as connections to a local database server)&lt;br /&gt;
and send buffers of UDP and other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; parameter depends on number of non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; configuration should satisfy&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;othersockbuf_{lim} - othersockbuf_{bar} \ge 2.5KB \cdot numothersock.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Increased limit for &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; is necessary for high performance of&lt;br /&gt;
communications through local (UNIX-domain) sockets.&lt;br /&gt;
However, similarly to &amp;lt;code&amp;gt;tcpsndbuf&amp;lt;/code&amp;gt;, hitting &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; affects&lt;br /&gt;
the communication performance only and does not affect the functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Othersockbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== dgramrcvbuf ==&lt;br /&gt;
The total size of buffers used to temporary store the incoming packets of UDP and&lt;br /&gt;
other datagram protocols.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; parameters depend on number of&lt;br /&gt;
non-TCP sockets (&amp;lt;code&amp;gt;[[numothersock]]&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits usually don't need to be high.&lt;br /&gt;
Only if the containers needs to send and receive very large&lt;br /&gt;
datagrams, the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;s for both &amp;lt;code&amp;gt;othersockbuf&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; parameters should be raised.&lt;br /&gt;
&lt;br /&gt;
Hitting &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; means that some datagrams are dropped, which may&lt;br /&gt;
or may not be important for application functionality.&lt;br /&gt;
UDP is a protocol with not guaranteed delivery, so even if the buffers&lt;br /&gt;
permit, the datagrams may be as well dropped later on any stage of the&lt;br /&gt;
processing, and applications should be prepared for it.&lt;br /&gt;
&lt;br /&gt;
Unlike other socket buffer parameters, for &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt;&lt;br /&gt;
the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; should be set to the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Dgramrcvbuf&amp;lt;/code&amp;gt; limits can't be set arbitrarily high.&lt;br /&gt;
The total amount of &amp;lt;code&amp;gt;dgramrcvbuf&amp;lt;/code&amp;gt; consumable by all containers&lt;br /&gt;
in the system plus the &amp;lt;code&amp;gt;kmemsize&amp;lt;/code&amp;gt; and other socket buffers&lt;br /&gt;
is limited by the hardware resources of the system.&lt;br /&gt;
This total limit is discussed in [[UBC systemwide configuration#“Low memory”|“low memory”]].&lt;br /&gt;
&lt;br /&gt;
== oomguarpages ==&lt;br /&gt;
The guaranteed amount of memory for the case the memory is “over-booked”&lt;br /&gt;
(out-of-memory kill guarantee).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Oomguarpages&amp;lt;/code&amp;gt; parameter is related to &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
If applications start to consume more memory than the computer has,&lt;br /&gt;
the system faces an out-of-memory condition.&lt;br /&gt;
In this case the operating system will start to kill container's&lt;br /&gt;
processes to free some memory and prevent the total death&lt;br /&gt;
of the system.  Although it happens very rarely in typical system loads,&lt;br /&gt;
killing processes in out-of-memory situations is a normal reaction of the&lt;br /&gt;
system, and it is built into every Linux kernel&amp;lt;ref&amp;gt;The possible reasons of out-of-memory situations are the excess of total &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees the available physical resources or high memory consumption by system processes.  Also, the kernel might allow some containers to allocate memory above their &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt; guarantees when the system had a lot of free memory, and later, when other containers claim their guarantees, the system will experience the memory shortage.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[[Oomguarpages]]&amp;lt;/code&amp;gt; parameter accounts the total amount of&lt;br /&gt;
memory and swap space used by the processes of a particular&lt;br /&gt;
container.&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is the out-of-memory&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
If the current usage of memory and swap space&lt;br /&gt;
(the value of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt;) plus the amount of used kernel memory&lt;br /&gt;
(&amp;lt;code&amp;gt;[[kmemsize]]&amp;lt;/code&amp;gt;) and socket buffers is below the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt;,&lt;br /&gt;
processes in this container are guaranteed not to be killed in&lt;br /&gt;
out-of-memory situations.&lt;br /&gt;
If the system is in out-of-memory situation and there are several&lt;br /&gt;
containers with &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; excess, applications in the&lt;br /&gt;
container with the biggest excess will be killed first.&lt;br /&gt;
The &amp;lt;code&amp;gt;failcnt&amp;lt;/code&amp;gt; counter of &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
increases when a process in this container is killed because&lt;br /&gt;
of out-of-memory situation.&lt;br /&gt;
&lt;br /&gt;
If the administrator needs to make sure that some application won't be&lt;br /&gt;
forcedly killed regardless of the application's behavior,&lt;br /&gt;
setting the &amp;lt;code&amp;gt;[[privvmpages]]&amp;lt;/code&amp;gt; limit to a value not greater than the&lt;br /&gt;
&amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee significantly reduce the likelihood of&lt;br /&gt;
the application being killed,&lt;br /&gt;
and setting it to a half of the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; guarantee completely&lt;br /&gt;
prevents it.&lt;br /&gt;
Such configurations are not popular because they significantly reduce&lt;br /&gt;
the utilization of the hardware.&lt;br /&gt;
&lt;br /&gt;
The meaning of the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;oomguarpages&amp;lt;/code&amp;gt; parameter is&lt;br /&gt;
unspecified in the current version.&lt;br /&gt;
&lt;br /&gt;
The total out-of-memory guarantees given to the containers should&lt;br /&gt;
not exceed the physical capacity of the computer, as discussed in [[UBC systemwide configuration#Memory and swap space]].&lt;br /&gt;
If guarantees are given for more than the system has, in out-of-memory&lt;br /&gt;
situations applications in containers with guaranteed level of&lt;br /&gt;
service and system daemons may be killed.&lt;br /&gt;
&lt;br /&gt;
== privvmpages ==&lt;br /&gt;
Memory allocation limit in pages (which are typically 4096 bytes in size).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
allows controlling the amount of memory allocated by applications.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt; of &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter&lt;br /&gt;
control the upper boundary of the total size of allocated memory.&lt;br /&gt;
Note that this upper boundary doesn't guarantee that the container&lt;br /&gt;
will be able to allocate that much memory, neither does it guarantee that&lt;br /&gt;
other containers will be able to allocate their fair share of&lt;br /&gt;
memory.&lt;br /&gt;
The primary mechanism to control memory allocation is the &amp;lt;code&amp;gt;[[vmguarpages]]&amp;lt;/code&amp;gt;&lt;br /&gt;
guarantee.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Privvmpages&amp;lt;/code&amp;gt; parameter accounts allocated (but, possibly,&lt;br /&gt;
not used yet) memory.&lt;br /&gt;
The accounted value is an estimation how much memory will be really consumed&lt;br /&gt;
when the container's applications start to use the allocated&lt;br /&gt;
memory.&lt;br /&gt;
Consumed memory is accounted into &amp;lt;code&amp;gt;[[oomguarpages]]&amp;lt;/code&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Since the memory accounted into &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; may not be actually used,&lt;br /&gt;
the sum of current &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; values for all containers&lt;br /&gt;
may exceed the RAM and swap size of the computer.&lt;br /&gt;
&lt;br /&gt;
There should be a safety gap between the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;limit&amp;lt;/code&amp;gt;&lt;br /&gt;
for &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; parameter to reduce the number of memory allocation&lt;br /&gt;
failures that the application is unable to handle.&lt;br /&gt;
This gap will be used for “high-priority” memory allocations, such&lt;br /&gt;
as process stack expansion.&lt;br /&gt;
Normal priority allocations will fail when the &amp;lt;code&amp;gt;barrier&amp;lt;/code&amp;gt; of&lt;br /&gt;
&amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; is reached.&lt;br /&gt;
&lt;br /&gt;
Total &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt; should correlate with the physical resources of the&lt;br /&gt;
computer.&lt;br /&gt;
Also, it is important not to allow any container to allocate a&lt;br /&gt;
significant portion of all system RAM to avoid serious service level&lt;br /&gt;
degradation for other containers.&lt;br /&gt;
Both these configuration requirements are discussed in [[UBC systemwide configuration#Allocated memory]].&lt;br /&gt;
&lt;br /&gt;
There's also an article describing how [[user pages accounting]] works.&lt;br /&gt;
&lt;br /&gt;
== Units ==&lt;br /&gt;
&amp;lt;code&amp;gt;Oomguarpages&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;privvmpages&amp;lt;/code&amp;gt;&lt;br /&gt;
values are measured in [[memory page]]s.&lt;br /&gt;
For other secondary parameters, the values are in bytes.&lt;br /&gt;
&lt;br /&gt;
== System-wide limits ==&lt;br /&gt;
All secondary parameters are related to memory.&lt;br /&gt;
Total limits on memory-related parameters must not exceed the physical&lt;br /&gt;
resources of the computer.&lt;br /&gt;
The restrictions on the configuration of memory-related parameters are listed&lt;br /&gt;
in [[UBC systemwide configuration]].&lt;br /&gt;
Those restrictions are very important, because their violation may&lt;br /&gt;
allow any container cause the whole system to hang.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Nathanhaigh</name></author>
		
	</entry>
</feed>