Set I/O Priority for Proxmox/ OpenVZ Containers
Category : How-to
Since the 2.6.18-028stable021 kernel, it has been possible to set the I/O priority of an OpenVZ container. It is not currently possible to set any I/O limits for containers, only the priority. If you require I/O limits you should use KVM.
The higher the priority is for a container, the more time the container will have for using disks. You can choose between 0 – 7 inclusive, the default value is 4. The higher the value you use, the more I/O time your container will receive. Remember, as this is a priority system each container setting is relative to another. For example, if you set all your containers to priority 7, they will still receive the same amount of I/O time each.
To set the I/O priority of an OpenZV container, login to the host using the console and use the below command.
vzctl set [VM ID] --ioprio [Priority] --save
Replace [VM ID] with the ID of the container you would like to modify, and replace [Priority] with the priority value to use between 0 and 7. The below example sets the priority of container 200 to 7.
vzctl set 200 --ioprio 7 --save
You can also edit the config file directly. In Proxmox this is saved in /etc/pve/openvz/[VMID].conf
Add, or change the existing entry in the conf file to: IOPRIO=”[Priority]”
You will need to reboot the container for the changes to take effect.
3 Comments
Eric Thern
27-May-2013 at 7:35 amCommon misconception, but you actually mean to say: The LOWER the value you use, the more I/O time your container will receive. This is based on CFQ, ioprio 0 is HIGHER priority than ioprio 7.
Martijn
11-Mar-2014 at 7:42 amActually that’s not what the OpenVZ wiki says; http://openvz.org/I/O_priorities
There it’s stated that 0 is the lowest priority and 7 gives the most I/O time.
james.coyle
11-Mar-2014 at 8:35 amI agree – the man, the OpenVZ wiki and my basic tests show that this is correct.