OpenVZ Forum


Home » General » Support » Rate Limiting 2 Containers
Rate Limiting 2 Containers [message #52027] Wed, 29 April 2015 00:56
krazybob is currently offline  krazybob
Messages: 38
Registered: December 2009
Location: Los Angeles, CA
Member
From: *static.ccmn.ca.charter.com
I use beefy servers and run two servers per server. How can I adjust this so that I rate limit each container to no more than 5mbits? Thank you. I appreciate you.

Limiting outgoing bandwidth

We can limit container outgoing bandwidth by setting the tc filter on eth0.

DEV=eth0
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 256kbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip src X.X.X.X flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10

X.X.X.X is an IP address of container.
Limiting incoming bandwidth

This can be done by setting the tc filter on venet0:

DEV=venet0
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 256kbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst X.X.X.X flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10

Note that X.X.X.X is an IP address of container. 
Previous Topic: VSwap and dump creation
Next Topic: Cannot start a VM when created by custom template
Goto Forum:
  


Current Time: Sun Oct 20 17:24:47 GMT 2019