Wednesday, May 5, 2010

MLAT/cpulimit/cpuunits

http://wiki.openvz.org/User_Guide/Managing_Resources#Managing_CPU_Share //Referred

Resource control VPS :

The root cause of this problem was high "MLAT" value in his container
(as shown by vzstat). This was happening due to this resource setting
of his VPS: cpulimit = 50% & cpus = 4. I have now changed his cpulimit
to 400%. After some research, I found that cpulimit works on PER-CPU
basis. So, for 1 CPU, cpulimit = 100% means "fully use 1 CPU". But
when you have 4 CPUs, you must specify cpulimit = 400% to "fully use
ALL 4 CPUs".

So, if there are 16 CPUs , cpulimit = 1600% ie CPULIMIT = 1600 "fully use
ALL 16 CPUs".

=====
processor at HW Node : 4 (2000.304Mhz each, 1024 KB cache, Dual-Core AMD), 7 GB RAM , 1 GB SWAP
No of processor at Each CT : 1 (each CT RAM = 1 GB)
So, each CT should have CPULIMITS =100, for 4 processor it'll be 400
BURST_CPULIMIT="0" //for each CT

=========

[root@node3 scripts]#for i in `vzlist | awk '{print $1 }'`; do grep CPULIMIT /etc/vz/conf/$i.conf; done //command to check CPUlimit of the container.

Tune CTs :

[root@node3 conf]# for i in `vzlist -a| awk '{print $1 }'`; do sed -i -e 's/CPULIMIT="0"/CPULIMIT="1600"/g' /etc/vz/conf/$i.conf; done
[root@node3 conf]# for i in `vzlist -a| awk '{print $1 }'`; do sed -i 's/BURST_CPULIMIT="1600"/BURST_CPULIMIT="0"/g' /etc/vz/conf/$i.conf; done

[root@node3 conf]#for i in `vzlist -a|grep stopped | awk '{print $1 }'`; do sed -i -e 's/CPUS="0"/CPUS="16"/g' /etc/vz/conf/$i.conf; done

[root@node4 log]# for i in `vzlist -a|awk '{print $1 }'`; do sed -i -e 's/CPUS="2"/CPUS="16"/g' /etc/vz/conf/$i.conf; done


check cpuunits in node and containers :

vzcpucheck and

for i in `vzlist | awk '{print $1 }'`; do grep CPUUNITS /etc/vz/conf/$i.conf; done

=========
In the following example, Container 102 is guaranteed to receive about 2% of the CPU time even if the Hardware Node is fully used, or in other words, if the current CPU utilization equals the power of the Node. Besides, CT 102 will not receive more than 4% of the CPU time even if the CPU is not fully loaded:

# vzctl set 102 --cpuunits 1500 --cpulimit 4 --save
Configuring Number of CPUs Inside Container : # vzctl set 101 --cpus 2 --save

========

primary parameter :


avnumproc
The average number of processes and threads.
V
numproc
The maximal number of processes and threads the CT may create.
V
numtcpsock
The number of TCP sockets (PF_INET family, SOCK_STREAM type). This parameter limits the number of TCP connections and, thus, the number of clients the server application can handle in parallel.
V
numothersock
The number of sockets other than TCP ones. Local (UNIX-domain) sockets are used for communications inside the system. UDP sockets are used, for example, for Domain Name Service (DNS) queries. UDP and other sockets may also be used in some very specialized applications (SNMP agents and others).
V
vmguarpages
The memory allocation guarantee, in pages (one page is 4 Kb). CT applications are guaranteed to be able to allocate additional memory so long as the amount of memory accounted as privvmpages (see the auxiliary parameters) does not exceed the configured barrier of the vmguarpages parameter. Above the barrier, additional memory allocation is not guaranteed and may fail in case of overall memory shortage.

============

How is the values currentlu used bu CT ?

vzctl exec 101 cat /proc/user_beancounters
Monitoring Memory Consumption
You can monitor a number of memory parameters for the whole Hardware Node and for particular Containers with the help of the vzmemcheck utility. For example:
# vzmemcheck -v -A //in Megabyte

No comments:

Post a Comment