Resource management using openVZ

From Notes_Wiki

Home > CentOS > CentOS 6.x > Virtualization tools > OpenvZ > Resource management using openVZ

Resource allocation can be done using 'vzctl set ' command dynamically. The changes can be made persistent by using '--save' option with 'vzctl set' command. The permanent changes are saved in configuration file '/etc/vz/conf/<container_id>.conf' file

I/O priorities for containers

I/O priorities can be set using:

vzctl set <container_id> --ioprio {[0-7]} --save

Here, 0 is higher or better than 7. Default I/O priority is 4. (Read http://wiki.openvz.org/I/O_priorities_for_VE for more details).


Disk space for containers

Disk space allocated to a container can be set using:

vzctl set <container_id> --diskspace <num1>:<num2> --save

Example: 'vzctl set 101 --diskspace 6G:7G --save' to set the space and 'vzctl exec 101 df -h' to verify the setting.

Just configuring diskspace may not be enough. It is recommended to configure inode limits as well. To configure inode limits use:

vzctl set <container_id> --diskinodes <num1>:num2> --save

To enable/disable quota for a particular container use:

vzctl set <container_id> --diskquota {yes|no} --save

Read http://wiki.openvz.org/Disk_quota for more details



Verify whether current resources allocated to container are enough

One can verify whether current resources allocated to a container are enough by using:

less /proc/user_beancounters

The output includes various details like current resource utilization of container, maximum resource utilization for given container, various resource limits etc. A very important column titled 'failcnt' indicates number of times a container tried to access a particular resource and was denied due to resource limits. Now if this number if high for a given parameter for a specific container than it indicates that the container needs more resources of that type for it to function properly. Thus, /proc/user_beancounters can provide very useful feed-back related to resource allocation (crunch/abundant) for various containers.


Most of the things in this page are learned from http://wiki.openvz.org/Resource_management


Home > CentOS > CentOS 6.x > Virtualization tools > OpenvZ > Resource management using openVZ