33.10. Limit network bandwidth for a Xen guest
In some environments it may be required to limit the network bandwidth available to certain guests. This can be used to implement basic Quality of Service on a host running multiple virtual machines. By default, the guest can use any bandwidth setting available which your physical network card supports. The physical network card must be mapped to one of virtual machine's virtual network interfaces. In Xen the “
rate
” parameter part of the VIF
entries can throttle guests.
This list covers the variables
-
rate
- The
rate=
option can be added to theVIF=
entry in a virtual machine configuration file to limit a virtual machine's network bandwidth or specify a specific time interval for a time window. - time window
- The time window is optional to the
rate=
option:The default time window is 50ms.A smaller time window will provide less burst transmission, however, the replenishment rate and latency will increase.The default 50ms time window is a good balance between latency and throughput and in most cases will not require changing.
Examples of
rate
parameter values and uses.
-
rate=10Mb/s
- Limit the outgoing network traffic from the guest to 10MB/s.
-
rate=250KB/s
- Limit the outgoing network traffic from the guest to 250KB/s.
-
rate=10MB/s@50ms
- Limit bandwidth to 10MB/s and provide the guest with a 50KB chunk every 50ms.
In the virtual machine configuration a sample
VIF
entry would look like the following:
vif = [ 'rate=10MB/s , mac=00:16:3e:7a:55:1c, bridge=xenbr1']
This
rate
entry would limit the virtual machine's interface to 10MB/s for outgoing traffic