Traffic shaping

From ISPWiki
Jump to: navigation, search

How it works

tc tool provided by iproute2, is used for traffic shaping. Hierarchical Token Bucket is used for shaping, allowing to create hierarchy of classes.

Traffic shaping is configured on all the physical network interfaces that are present in the system and have real IP addresses, as well as on the interface venet0.

Outgoing traffic

Outgoing traffic is limiting on all the physical network interfaces (eth0, etc .).

Limiting outgoing traffic

On Network Interface Controller, the root HTB qdisc is specified from which the hierarchy of classes is created.

A class with identifier 1:CTID (CTID - container identifier, hexadecimal) and corresponding network rate are created for each container. Packets received by the class will be automatically held for limiting traffic. SFQ does not allow same-type traffic to use the whole bandwidth.

Filters allow to classify traffic by IP addresses and redirect to a corresponding class. If container has multiple Ips, several filters will be created - one for each IP address.

Non-classified traffic is currently received with the main interface rate.

Incoming traffic

Incoming traffic is limited on venet0.

Limiting incoming traffic

The same settings as for incoming traffic are used. Note that destination IP addresses will be filtered in that case.

Traffic between container ans cluster node

For limiting traffic between container and cluster node, ingress and special policies are used enabling to drop the traffic that exceeds bandwidth rate specified.

Limiting traffic between container and cluster node

Activating traffic shaping in VMmanager OVZ=

You can enable or disable traffic limit in the module Policy.

If the check box "Activate traffic shaping" is selected, clicking OK will apply settings for all the containers. Otherwise, traffic shaping will be disabled on all the cluster nodes, root management disciplines and classes, as well as filters will be deleted.

Container templates

In the container's template edit form in the field "Bandwidth rate" specify the maximum rate in Kb/sec

Containers

In the container's template edit form in the field "Bandwidth rate" specify the maximum rate in Kb/sec