Difference between revisions of "Proc/user beancounters"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(added Reading)
(Reading: fixed a typo)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{UBC toc}}
 
{{UBC toc}}
{{wrongtitle|/proc/user_beancounters}}
+
{{DISPLAYTITLE:/proc/user_beancounters}}
 
The proc filesystem entry showing resource control information is <code>/proc/user_beancounters</code> file. An example content of <code>/proc/user_beancounters</code> is shown below.
 
The proc filesystem entry showing resource control information is <code>/proc/user_beancounters</code> file. An example content of <code>/proc/user_beancounters</code> is shown below.
  
Line 38: Line 38:
 
== Fields ==
 
== Fields ==
  
The field '''<code>uid</code>''' is a numeric identifier of the Virtual Environment<ref>The name “uid” is related to the fact that OpenVZ Resource Management can be used without virtualization and Virtual Environments.</ref>.
+
The field '''<code>uid</code>''' is a numeric identifier of the container<ref>The name “uid” is related to the fact that OpenVZ Resource Management can be used without virtualization and containers.</ref>.
  
For accountable parameters, the field '''<code>held</code>''' shows the current counter for the Virtual Environment (resource “usage”), and the field '''<code>maxheld</code>''' shows the counter's maximum for the last accounting period. The accounting period is usually the lifetime of the Virtual Environment<ref>The lifetime of a Virtual Environment is the period from the start of the VE till the time all processes in the VE 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 Virtual Environment.</ref>.  
+
For accountable parameters, the field '''<code>held</code>''' shows the current counter for the container (resource “usage”), and the field '''<code>maxheld</code>''' shows the counter's maximum for the last accounting period. The accounting period is usually the lifetime of the container<ref>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.</ref>.  
  
 
The field '''<code>failcnt</code>''' shows the number of refused “resource allocations” for the whole lifetime of the process group.
 
The field '''<code>failcnt</code>''' shows the number of refused “resource allocations” for the whole lifetime of the process group.
Line 51: Line 51:
 
the <code>limit</code> for the parameter.
 
the <code>limit</code> for the parameter.
  
== Units of measurement ==
+
== Units ==
As also discussed in [[UBC parameter units]], all values related to parameters with
+
{{Main|UBC parameter units}}
names starting with <code>num</code> are measured in pieces. Values related to parameters
 
with names ending with pages are measured in memory pages (memory page is 4 kilobytes on
 
x86 and x86_64 hardware, others may differ). Values related to other parameters are measured in bytes.
 
  
 
== Settings ==
 
== Settings ==
Line 61: Line 58:
 
General notes about parameters and their barrier and limit settings
 
General notes about parameters and their barrier and limit settings
 
are provided in [[UBC parameters]]. Parameters not having limit setting have
 
are provided in [[UBC parameters]]. Parameters not having limit setting have
[[MAX_ULONG]] in the corresponding field.
+
[[LONG_MAX]] in the corresponding field.
  
 
== Reading ==
 
== Reading ==
  
If you want to see UBC values for a specific VE, the following construct can be helpful
+
{{Note|It's easier to use [[BC proc entries|the new <code>/proc/bc</code> interface]], i.e. <code>cat /proc/bc/$CTID/resources</code>.}}
  
  egrep -A23 '^[[:space:]]+${VEID}:' /proc/user_beancounters
+
If you want to print UBC values for a specific container, the following construct can be helpful
  
Here ${VEID} is the ID of the VE you are interested in.
+
  <nowiki>egrep -A23 "${CTID}:" /proc/user_beancounters</nowiki>
 +
 
 +
Or with headers, though slightly harder to remember:
 +
 
 +
  <nowiki>sed -nr "1,2p;/${CTID}:/,+23p" /proc/user_beancounters</nowiki>
 +
 
 +
Here <code>${CTID}</code> is the ID of the container you are interested in.
 +
 
 +
In case you want to print UBC values for a few containers at once, set CTID to something like <code>(101|102|103)</code>.
  
 
== Notes ==
 
== Notes ==
 
<references/>
 
<references/>

Latest revision as of 23:28, 15 August 2011

User Beancounters
Definition
/proc/user_beancounters
/proc/bc/
General information
Units of measurement
VSwap
Parameters description
Primary parameters
numproc, numtcpsock, numothersock, vmguarpages
Secondary parameters
kmemsize, tcpsndbuf, tcprcvbuf, othersockbuf, dgramrcvbuf, oomguarpages, privvmpages
Auxiliary parameters
lockedpages, shmpages, physpages, numfile, numflock, numpty, numsiginfo, dcachesize, numiptent, swappages
Internals
User pages accounting
RSS fractions accounting
On-demand accounting
UBC consistency
Consistency formulae
System-wide configuration
vzubc(8)
Configuration examples
Basic
Derived
Intermediate configurations
Tables
List of parameters
Parameter properties
Consistency
Config examples

The proc filesystem entry showing resource control information is /proc/user_beancounters file. An example content of /proc/user_beancounters is shown below.

Yellowpin.svg Note: This article describes an old interface. This is kept for compatibility and new one will be used since 028test008 kernel

Example[edit]

# cat /proc/user_beancounters
Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
       123: kmemsize         836919    1005343    2752512    2936012          0
            lockedpages           0          0         32         32          0
            privvmpages        4587       7289      49152      53575          0
            shmpages             39         39       8192       8192          0
            dummy                 0          0          0          0          0
            numproc              20         26         65         65          0
            physpages          2267       2399          0 2147483647          0
            vmguarpages           0          0       6144 2147483647          0
            oomguarpages       2267       2399       6144 2147483647          0
            numtcpsock            3          3         80         80          0
            numflock              3          4        100        110          0
            numpty                1          1         16         16          0
            numsiginfo            0          1        256        256          0
            tcpsndbuf             0          0     319488     524288          0
            tcprcvbuf             0          0     319488     524288          0
            othersockbuf       6684       7888     132096     336896          0
            dgramrcvbuf           0       8372     132096     132096          0
            numothersock          8         10         80         80          0
            dcachesize        87672      92168    1048576    1097728          0
            numfile             238        306       2048       2048          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            numiptent            10         16        128        128          0

Fields[edit]

The field uid is a numeric identifier of the container[1].

For accountable parameters, the field held shows the current counter for the container (resource “usage”), and the field maxheld shows the counter's maximum for the last accounting period. The accounting period is usually the lifetime of the container[2].

The field failcnt shows the number of refused “resource allocations” for the whole lifetime of the process group.

The barrier and limit fields are resource control settings. For some parameters, only one of them may be used, for some parameters — both. These fields may specify limits or guarantees, and the exact meaning of them is parameter-specific. Description of each parameter in UBC parameters contains information about the difference between the barrier and the limit for the parameter.

Units[edit]

Main article: UBC parameter units

Settings[edit]

General notes about parameters and their barrier and limit settings are provided in UBC parameters. Parameters not having limit setting have LONG_MAX in the corresponding field.

Reading[edit]

Yellowpin.svg Note: It's easier to use the new /proc/bc interface, i.e. cat /proc/bc/$CTID/resources.

If you want to print UBC values for a specific container, the following construct can be helpful

 egrep -A23 "${CTID}:" /proc/user_beancounters

Or with headers, though slightly harder to remember:

 sed -nr "1,2p;/${CTID}:/,+23p" /proc/user_beancounters

Here ${CTID} is the ID of the container you are interested in.

In case you want to print UBC values for a few containers at once, set CTID to something like (101|102|103).

Notes[edit]

  1. The name “uid” is related to the fact that OpenVZ Resource Management can be used without virtualization and containers.
  2. 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.