
Managing Resources
57
Monitoring System Resources Consumption
It is possible to check the system resource control parameters statistics from within a Virtual
Private Server. The primary use of these statistics is to understand what particular resource has
limits preventing an application to start. Moreover, these statistics report the current and
maximal resources consumption for the running Virtual Private Server. This information can be
obtained from the
/proc/user_beancounters
file.
The output below illustrates a typical session:
# vzctl exec 101 cat /proc/user_beancounters
Version: 2.5
uid resource held maxheld barrier limit failcnt
101: kmemsize 803866 1246758 2457600 2621440 0
lockedpages 0 0 32 32 0
privvmpages 5611 7709 22528 24576 0
shmpages 39 695 8192 8192 0
dummy 0 0 0 0 0
numproc 16 27 65 65 0
physpages 1011 3113 0 2147483647 0
vmguarpages 0 0 6144 2147483647 0
oomguarpages 2025 3113 6144 2147483647 0
numtcpsock 3 4 80 80 0
numflock 2 4 100 110 0
numpty 0 1 16 16 0
numsiginfo 0 2 256 256 0
tcpsndbuf 0 6684 319488 524288 0
tcprcvbuf 0 4456 319488 524288 0
othersockbuf 2228 9688 132096 336896 0
dgramrcvbuf 0 4276 132096 132096 0
numothersock 4 17 80 80 0
dcachesize 78952 108488 524288 548864 0
numfile 194 306 1280 1280 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
numiptent 0 0 128 128 0
The
failcnt
column displays the number of unsuccessful attempts to allocate a particular
resource. If this value increases after an application fails to start, then the corresponding
resource limit is in effect lower than is needed by the application.
The
held
column displays the current resource usage, and the
maxheld
column – the maximal
value of the resource consumption for the last accounting period. The meaning of the
and
columns depends on the parameter and is explained in the
guide.
barrier
limit
OpenVZ Management of System
Resources
Inside a VPS, the
/proc/user_beancounters
file displays the information on the given
VPS only, whereas from the Hardware Node this file displays the information on all the VPSs.
To check the UBC usage for a HN (summary for all running VPSs), you can use the following
scripts:
(for any resource accounted in pages)
# for res in lockedpages totvmpages ipcshmpages anonshpages rsspages;\
do echo;echo "$res usage for all VEs, in MB:";cat \
/proc/user_beancounters |grep $res|awk 'BEGIN{ cur=max=lim=0; } \
{ cur+=$2; max+=$3;lim+=$5 } END {print "held:",cur*4/1024, "max:", \
max*4/1024, "limit:", lim*4/1024}'; done
(for kmemsize and other resources accounted in bytes)