3.5.2. Configuring Disk I/O Bandwidth

In OpenVZ, you can configure the bandwidth virtual machines and containers are allowed to use for their disk input and output (I/O) operations. Limiting the disk I/O bandwidth can help you prevent the situations when high disk activities in one virtual machine or container (generated, for example, by transferring huge amounts of data to/from the virtual machine or container) can slow down the performance of other virtual machines and containers on the hardware node.

By default, the I/O bandwidth limit for all newly created virtual machines and containers is set to 0, which means that no limits are applied to any virtual machines and containers. To limit the disk I/O bandwidth for a virtual machine or container, you can use the --iolimit option of the prlctl set command. For example, the following command sets the I/O bandwidth limit for the container MyCT to 10 megabytes per second (MB/s):

# prlctl set MyCT --iolimit 10

By default, the limit is set in megabytes per second. However, you can use the following suffixes to use other measurement units:

  • G sets the limit in gigabytes per second (1G).
  • K sets the limit in kilobytes per second (10K).
  • B sets the limit in bytes per second (10B).

Note

Note: In the current version of OpenVZ, the maximum I/O bandwidth limit you can set for a virtual machine or container is 2 GB per second.

To check that the I/O speed limit has been successfully applied to the container MyCT, use the prlctl list command:

# prlctl list MyCT -o iolimit
IOLIMIT
10485760

At any time, you can remove the I/O bandwidth limit set for container MyCT by running this command:

# prlctl set MyCT --iolimit 0