Configuring Network Bandwidth Management for Container
The network bandwidth for outgoing traffic a Container receives is controlled by two variables in the Container configuration file (
/etc/vz/conf/<
CT_ID
>.conf
):
RATE
and
RATEBOUND
.
Note:
Container incoming traffic cannot be controlled in the current version of Parallels Server Bare Metal.
The
RATE
variable has the same format as
TOTALRATE
-
<
NIC
>:<
network_class
>:<
bandwidth
>
. This variable specifies the guaranteed outgoing traffic rate that the corresponding Container receives. This rate can be specified differently for different network classes and network adapters; use space to separate several rate descriptions.
Bandwidth values are specified in Kb/s. It is recommended to increase this value in 8 Kb/s chunks and to set it no lower than 8 Kb/s.
The
RATEBOUND
variable specifies whether the network bandwidth available to the Container for outgoing traffic is limited by the bandwidth specified in the
RATE
variable. The possible values of the
RATEBOUND
variable are
yes
and
no
; the default is
no
. In this case the Container is allowed to take free bandwidth from the
TOTALRATE
pool.
The actual network bandwidth available to the Containers depends on the number of Containers and the total sum of the
RATE
values, and normally does not coincide with the bandwidth specified in their own
RATE
variables. If the
RATEBOUND
variable is set to
yes
, the Container bandwidth is limited by the value of the
RATE
variable.
If the Container configuration file does not specify any of these parameters, the values from the
/etc/vz/vz.conf
configuration file are taken. By default, Parallels Server Bare Metal does not set
RATEBOUND
, which corresponds to
no
, and
RATE
is set to
eth0:1:8
.
The network bandwidth management in Parallels Server Bare Metal works in the following way. The bandwidth pool for a given network class (configurable through the
TOTALRATE
variable in the global configuration file) is divided among the Containers transmitting data proportionally to their
RATE
settings. If the total value of the
RATE
variables of all Containers transmitting data does not exceed the
TOTALRATE
value, each Container gets the bandwidth equal or greater than its
RATE
value (unless this Container has the
RATEBOUND
variable set to
yes
). If the total value of the
RATE
variables of all Containers transmitting data exceeds the
TOTALRATE
value, each Container may get less than its
RATE
value.
The example below illustrates the scenario when there are two Containers, 101 and 102, which have
RATEBOUND
set to
no
, and Container 103 has
RATEBOUND
set to
yes
:
# grep ^RATE /etc/vz/conf/101.conf /etc/vz/conf/102.conf
RATE="eth0:1:8"
RATEBOUND="no"
RATE="eth0:1:8"
RATEBOUND="no"
# grep ^RATE /etc/vz/conf/103.conf
RATE="eth0:1:64"
RATEBOUND="yes"
With the default
TOTALRATE
of 4096 Kb/s, bandwidth pool will be distributed according to the following table:
Container 101
|
Container 102
|
Container 103
|
Bandwidth consumed by Containers
|
transmits
|
idle
|
idle
|
Container101: 4096 Kb/s
|
idle
|
idle
|
transmits
|
Container103: 64 Kb/s
|
transmits
|
transmits
|
idle
|
Container101: 2048 Kb/s
Container102: 2048 Kb/s
|
transmits
|
idle
|
transmits
|
Container101: 4032 Kb/s
Container103: 64 Kb/s
|
transmits
|
transmits
|
transmits
|
Container101: 2016 Kb/s
Container102: 2016 Kb/s
Container103: 64 Kb/s
|
After you have set up Container bandwidth settings, activate your changes as shown below:
# /etc/init.d/vz shaperrestart
Stopping shaping: Ok
Starting shaping: Ok
Set shaping on running Container: Ok
This command clears off all existing shaping settings and sets them again using the configuration files of running Containers.
|