If you want to use CBQ to control the bandwidth, you use filters to divide the traffic in classes. But how do you choose the bandwidth parameters and how do you create the classes and qdiscs?
I attached a class of 140kbps to the root qdisc and a subclass of 130kbps to this class. Then I tried all possible combinations of bounded and isolated to this two classes.
CBQ can bound classes, but the bandwidth will be more then the rate you gave to the class. See CBQ bounded tests. So bounding a class with a rate of 140 kbps will result in a bandwidth of 159kbps and a rate of 130 kbps will result in a bandwidth of 145 kbps.
Used script (download)
I tried all the possible combination and each time I generate traffic in class 10:10. These are the results:
kernel 2.4.5 & New TC command | ||||
---|---|---|---|---|
class 10:1 | bounded | bounded + isolated | isolated | |
bounded | 144 kbps | 144 kbps | Full | 156 kbps |
bounded + isolated | 144 kbps | 144 kbps | Full | 156 kbps |
isolated | 144 kbps | 144 kbps | Full | Full |
144 kbps | 144 kbps | Full | Full |
The only case when the results are not good, is when class 10:10 is isolated and class 10:1 is bounded (red results). In this case class 10:10 gets the full bandwidth while you would expect that it only can get the bandwidth of class 10:1 and that's 140 kbps. So the isolated parameter of class 10:10 disturbs the setup.
I added a second class and did the tests again. I want to split the traffic in 2 classes with one class the most traffic. So I give class 10:10 a rate of 130kbps and class 10:20 a rate of 10kbps. Together they may not have more then 140kbps.
CBQ can bound classes, but the bandwidth will also little more then the rate you gave to the class. See CBQ bounded tests. So bounding a class with a rate of 140 kbps will result in a bandwidth of 159kbps and a rate of 130 kbps will result in a bandwidth of 145 kbps.
Used script (download)
I tried all the possible combination and each time I generate traffic in class 10:10 and class 10:20. These are the results:
kernel 2.4.5 & New TC Command | ||||
---|---|---|---|---|
class 10:1 | bounded | bounded + isolated | isolated | |
bounded | 144 + 12 | 144 + 12 | Full | (144 + 12) |
bounded + isolated | 144 + 12 | 144 + 12 | Full | (144 + 12) |
isolated | 144 + 12 | 144 + 12 | Full | Full |
144 + 12 | 144 + 12 | Full | Full |
(144 + 12): The classes can borrow unused bandwidth from each other but together they can not use more bandwidth then the bandwidth assigned to the parent class
Everything is working like expected. Except when you have an isolated subclass and a bounded parent class (red results). The isolated parameter makes the parent class unbounded. This is the same problem as I had with the previous setup.
In theory, the isolated parameter can be used to prevent classes to share their bandwidth with other classes. But this parameter is not working. It makes the parent class unbounded.
To get better results, I added a qdisc to class 10:1 and attached the 2 subclasses to this qdisc. Maybe this can help to get the isolated parameter working properly.
Used script (download)
I tried all the possible combination and each time I generate traffic in class 20:10 and class 20:20. These are the results:
kernel 2.2.18 & kernel 2.4.4 | ||||
---|---|---|---|---|
class 10:1 | bounded | bounded + isolated | isolated | |
bounded | 145 + 12 | 145 + 12 | (145 + 12) | (145 + 12) |
bounded + isolated | 145 + 12 | 145 + 12 | (145 + 12) | (145 + 12) |
isolated | (X) | (X) | Full | Full |
(X) | (X) | Full | Full |
(X): This is a very strange situation so I tried some things:
70 + 70 = 140: stream A : 140 kbps, stream B : 140 kbps, together : FULL (50%)
130 + 10 = 140: stream A : 700 kbps, stream B : 11 kbps, together : FULL (92%)
100 + 40 = 140: stream A : 245 kbps, stream B : 57 kbps, together : FULL (68%)
105 + 35 = 140: stream A : 412 kbps, stream B : 48 kbps, together : FULL (72%)
To avoid the strange effect of (X), I added an extra class to qdisc 20:
Used script (download)
kernel 2.2.18 & kernel 2.4.4 | ||||
---|---|---|---|---|
class 10:1 | bounded | bounded + isolated | isolated | |
bounded | 145 + 12 | 145 + 12 | (132 + 26) | (132 + 26) |
bounded + isolated | 145 + 12 | 145 + 12 | (132 + 26) | (132 + 26) |
isolated | 145 + 12 | 145 + 12 | Full | Full |
145 + 12 | 145 + 12 | Full | Full |
(132 + 26): 158.1 kbps total (84.0% in class 20:10)
145 + 12: 158.0 kbps and 92.7 in class 1
The extra class helped to avoid the strange effect that I had with the previous test.