On Sunday 18 May 2003 12:39, Miernik wrote: > When configuring HTB classes, is it true that the rate of a parent > MUST be exactly equal to the sum of rates of it's children? No. > For example let's say I have a 160Kbit link, and two clients. I want > each of them to have equal transfer rate, and ceil each of them to > 70Kbit. I leave 5% of the link idle as suggested on > http://www.docum.org/stef.coene/qos/faq/cache/9.html You misunderstood the faq page. If you have a 160kbit link, you have to make sure that you never send more data then lets say 150kbit. So the maximum ceil of the classes is 150kbit. This is to prevent that you send more data then your modem can handle. > Lets compare two possible setups: > > In setup A I assume that the rate of a parent class DOES NOT have to be > equal to the sum of the rates of its child classes. > > In setup B I assume that the rate of a parent class MUST be equal to > the rates of its child classes. > > > Setup A: > > tc qdisc add dev eth0 root handle 1: htb > tc class add dev eth0 parent 1: classid 1:1 htb rate 150Kbit ceil > 150Kbit tc class add dev eth0 parent 1:1 classid 1:2 htb rate 70Kbit > ceil 70Kbit tc class add dev eth0 parent 1:1 classid 1:3 htb rate > 70Kbit ceil 70Kbit > > > Setup B: > > tc qdisc add dev eth0 root handle 1: htb > tc class add dev eth0 parent 1: classid 1:1 htb rate 80Kbit ceil > 150Kbit tc class add dev eth0 parent 1:1 classid 1:2 htb rate 40Kbit > ceil 70Kbit tc class add dev eth0 parent 1:1 classid 1:3 htb rate > 40Kbit ceil 70Kbit > > > Of course the correspnding filters to these, but I ommit them here, > because it's not needed to show what I mean. > > There are no other classeson eth0, and the filters are setupthis way > that traffic can go either to class 1:2 or class 1:3 and nowhere else. > There is no unclassified traffic. > > In this situation: Are both setups valid? If yes are they equivalent? > If not, then how the traffic will differ? > > Does the rate of a parent class MUST be greater or equal than the sum > of the rates of it children? No. > Or does it have to be exactly equal? No. > What happens if it is smaller? Nothing. > What happens if it is larger? Nothing. > The reason I ask, is that I want to know, is it possible to add a > third client to this setup, without changing the 1:1 class. Or do I > have to recalculate and change the parent class, each time I change > the rate of any of it's children? No. > If I add a third class, the setups will look like this: > > Setup A: > > tc qdisc add dev eth0 root handle 1: htb > tc class add dev eth0 parent 1: classid 1:1 htb rate 150Kbit ceil > 150Kbit tc class add dev eth0 parent 1:1 classid 1:2 htb rate 70Kbit > ceil 70Kbit tc class add dev eth0 parent 1:1 classid 1:3 htb rate > 70Kbit ceil 70Kbit tc class add dev eth0 parent 1:1 classid 1:4 htb > rate 70Kbit ceil 70Kbit > > > Setup B: > > tc qdisc add dev eth0 root handle 1: htb > tc class add dev eth0 parent 1: classid 1:1 htb rate 120Kbit ceil > 150Kbit tc class add dev eth0 parent 1:1 classid 1:2 htb rate 40Kbit > ceil 70Kbit tc class add dev eth0 parent 1:1 classid 1:3 htb rate > 40Kbit ceil 70Kbit tc class add dev eth0 parent 1:1 classid 1:4 htb > rate 40Kbit ceil 70Kbit > > Are both setups equivalent now? Yes. > Are they both valid? Yes. > If they are equivalent, then is one of them somehow better? Setup B > If they are not, then why? > > If setup B is the only validsetup, then what if I want to add 50 > clients to this link, and also give each one a ceil of 70Kbit. > Each of them will use the link rarely, so statistically there will be > no more then two clients on this link at the same time. > Should I then setup for each of the clinents rate 3Kbit ceil 70Kbit : > > tc qdisc add dev eth0 root handle 1: htb > tc class add dev eth0 parent 1: classid 1:1 htb rate 150Kbit ceil > 150Kbit tc class add dev eth0 parent 1:1 classid 1:2 htb rate 3Kbit > ceil 70Kbit tc class add dev eth0 parent 1:1 classid 1:3 htb rate > 3Kbit ceil 70Kbit tc class add dev eth0 parent 1:1 classid 1:4 htb rate > 3Kbit ceil 70Kbit ... and so on? No. As long as you are sure that you never send more data then your modem can handle. So if you have only 2 active classes, you can take a bigger rate. > I've read http://www.docum.org and http://www.lartc.org/howto/ but I > didn't find a strict anwser to this question. The reason why you have to take parent rate = sum of child rate is to just make it easier to find out what will happen. The parent rate and ceil is never respected, so it doesn't matter what you take for parent rate and/or ceil. But following the rules like suggested on my faq page, just makes it easier to found out how the bandwidth is divided. You don't have to follow any of the rules I suggested. It will work. But finding out what will happen will be less obvious. Stef -- stef.coene@xxxxxxxxx "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net