Hi, I''ve been migrating an existing htb-based traffic shaper from a hideous (I''m allowed to call it that - I wrote the damn atrocity myself) tc shell script into a TCNG configuration file, and after a few false starts I think I managed to get the syntax right. However, during tests it looks like some of the tiers aren''t passing their restrictions on to lower levels. For example, part of the configuration looks like this: htb() { $root=class ( rate 1024Mbps, ceil 1024Mbps ) { // Gigabit ethernet interface $enterprise = class ( rate 45Mbps, ceil 45Mbps ) { // list of enterprise-level clients } $business = class ( rate 20Mbps, ceil 20Mbps ) { // list of business-class clients, including $client1 = class ( rate 2Mbps, ceil 2Mbps ) { sfq; } $client2 = class ( rate 2Mbps, ceil 2Mbps ) { sfq; } } // And so on. } } When this setup was tested, both client 1 and client 2 received 2 Mbps of bandwidth, so the attached filters worked properly. But when the rate and ceil of $business was lowered to 2Mbps, both client 1 and client 2 *still* received 2 Mbps, even when they were simultaneously downloading. The interim file generated by tcc *looks* okay, although it''s a little harder to read. Can anyone point out to me what I did wrong, or where I made an erroneous assumption? -- Rens Houben | opinions are mine Resident linux guru and sysadmin | if my employers have one Systemec Internet Services. |they''ll tell you themselves PGP key at http://marduk.systemec.nl/~shadur/shadur.key.asc
Martin A. Brown
2006-Jun-28 02:08 UTC
Re: TCNG issue - parent class restrictions are not honored
Greetings Rens, : I''ve been migrating an existing htb-based traffic shaper from a : hideous (I''m allowed to call it that - I wrote the damn atrocity : myself) tc shell script into a TCNG configuration file, and after : a few false starts I think I managed to get the syntax right. I know what you mean about "hideous" shell scripts to manage traffic control. They can quickly become rather horrid-looking. I''m a big fan of tcng for its simpler syntax. OK, so your problem actually has nothing to do with tcng, though. It is strictly an HTB-related matter. Summary of your problem? In HTB, rate is guaranteed. Longer description follows. : However, during tests it looks like some of the tiers aren''t : passing their restrictions on to lower levels. In fact, it is quite the opposite. The embedded (or nested) tiers are taking more than you wish them to take. This will require a slight change in your configuration. : $business = class ( rate 20Mbps, ceil 20Mbps ) { : // list of business-class clients, including : $client1 = class ( rate 2Mbps, ceil 2Mbps ) { sfq; } : $client2 = class ( rate 2Mbps, ceil 2Mbps ) { sfq; } : } The above configuration basically says the following: $business is guaranteed access to 20Mbps, and no more than 20Mbps. $client1 is guaranteed access to 2Mbps, but no more than 2Mbps. $client2 is guaranteed access to 2Mbps, but no more than 2Mbps. This means that HTB is not even going to bother checking any dequeued rates against a borrowing model until $client1 or $client2 (each individually) reach 2Mbps usage. That''s a total of 2Mbps per client. You have overcommitted. [ As a side note, when you set a child classes rate and ceil to the same value, you don''t get the benefit of the bandwidth sharing. ] Now, what you describe tells me something very different. : When this setup was tested, both client 1 and client 2 received 2 : Mbps of bandwidth, so the attached filters worked properly. But : when the rate and ceil of $business was lowered to 2Mbps, both : client 1 and client 2 *still* received 2 Mbps, even when they : were simultaneously downloading. This is probably what you actually want: $business is guaranteed access to 2Mbps, and no more than 2Mbps. $client1 is guaranteed access to 800kbps, but no more than 2Mbps. $client2 is guaranteed access to 800kbps, but no more than 2Mbps. First, the two clients will each be guaranteed 800kbps. If they are both transmitting as fast as possible, then they are implicitly competing for the remaining 400kbps of the total 2Mbps. In HTB, an inner class (in your case, $business) will divide up the remaining available bandwidth between the various children, all the way up to its own ceiling (ceil). Now, try the following, and see how this works for you: $business = class ( rate 2Mbps, ceil 2Mbps ) { // list of business-class clients, including $client1 = class ( rate 800kbps, ceil 2Mbps ) { sfq; } $client2 = class ( rate 800kbps, ceil 2Mbps ) { sfq; } } I hope I have clarified the behaviour for you, but you may find more detail on the HTB borrowing (sharing) model in the user guide [0] and in a section in my Traffic Control HOWTO [1]. Good luck and happy shaping! -Martin [0] http://luxik.cdi.cz/~devik/qos/htb/manual/userg.htm#sharing [1] http://tldp.org/HOWTO/Traffic-Control-HOWTO/classful-qdiscs.html#qc-htb-borrowing -- Martin A. Brown http://linux-ip.net/