Hi, I''m using tc and HTB to shape my outgoing ADSL traffic. I was trying to make some graphs on the classes by meassuring the "sent bytes" of each class using rrdtool to store the data (as kbps after conversion). I expected that meassuring the root class I would get values similar that the ones I get measuring the interface counters but they differ by a large amount. Is there something obvious I''m missing here?, is this approach correct? Thank you. Francisco kaori ~ # tc -s class show dev ppp0 class htb 1:1 root rate 200000bit ceil 200000bit burst 6Kb/8 mpu 0b overhead 0b cburst 1699b/8 mpu 0b overhead 0b level 7 Sent 378286130 bytes 2185057 pkt (dropped 0, overlimits 0 requeues 0) rate 182312bit 29pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 168756 ctokens: -13270 class htb 1:10 parent 1:1 leaf 10: prio 1 rate 200000bit ceil 200000bit burst 6Kb/8 mpu 0b overhead 0b cburst 1699b/8 mpu 0b overhead 0b level 0 Sent 115548283 bytes 1520567 pkt (dropped 0, overlimits 0 requeues 0) rate 1848bit 4pps backlog 0b 0p requeues 0 lended: 1520567 borrowed: 0 giants: 0 tokens: 250020 ctokens: 67994 class htb 1:20 parent 1:1 leaf 20: prio 2 rate 180000bit ceil 180000bit burst 6Kb/8 mpu 0b overhead 0b cburst 1689b/8 mpu 0b overhead 0b level 0 Sent 262755089 bytes 664505 pkt (dropped 0, overlimits 0 requeues 0) rate 180456bit 25pps backlog 0b 15p requeues 0 lended: 664490 borrowed: 0 giants: 0 tokens: 113243 ctokens: -89463 class htb 1:30 parent 1:1 leaf 30: prio 3 rate 1000bit ceil 120000bit burst 6Kb/8 mpu 0b overhead 0b cburst 1659b/8 mpu 0b overhead 0b level 0 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 50331648 ctokens: 113321 class htb 1:40 parent 1:1 leaf 40: prio 4 rate 1000bit ceil 60000bit burst 6Kb/8 mpu 0b overhead 0b cburst 1629b/8 mpu 0b overhead 0b level 0 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 50331648 ctokens: 222548
On Sun, Apr 09, 2006 at 04:24:20PM -0300, Francisco wrote:> I expected that meassuring the root class I would get values similar that > the ones I get measuring the interface counters but they differ by a > large amount.The statistics you posted seem to be fine. Which interface counters are you talking about? tc starts counting only after the qdiscs/classes were created, so if you have a separate count somewhere which started counting some other time, the difference will of course be huge (as far as total packet count is concerned). Regards Andreas Klauer
The interface that I''m using is ppp0, the classes/qdiscs are created with the interface (from /etc/ppp/ip-up file) but that doesn''t matter anyway, the way the two graphics are created is: at time 0 look the total amount of bytes/bits transfered at time 5 (mins) I look the amount of bytes/bits transfered and do: (bits(t=5) - bits(t=0))/(300secs) = bps (similar with bytes) and repeat every five minutes, this is how MRTG graphs. So it really doesn''t matter if the counters are different, what matters is the difference between time x and time y. The interface counters and the tc counters are fetched by SNMP and I''m 100% sure that my interface graph is accurate, I just don''t understand why there is so much difference with the tc ones. On the other hand, I just made a test with a file transfer resetting all counters: file: 14675760 lego.pdf iptables: Chain OUTPUT (policy ACCEPT 478208 packets, 1617032905 bytes) pkts bytes target prot opt in out source destination 10725 15568354 MARK tcp -- any ppp0 anywhere anywhere tcp spt:http MARK set 0x1e tc: class htb 1:30 parent 1:1 leaf 30: prio 3 rate 1000bit ceil 120000bit burst 6Kb/8 mpu 0b overhead 0b cburst 1659b/8 mpu 0b overhead 0b level 0 Sent 15568302 bytes 10724 pkt (dropped 0, overlimits 0 requeues 0) rate 112bit 0pps backlog 0b 0p requeues 0 lended: 99 borrowed: 10625 giants: 0 tokens: -13832192 ctokens: -671 All this seems file, the bytes match, etc. So I''m not sure what I''m doing wrong. I''ll keep investigating, I just wanted to know if any of you saw something wrong with my reasoning or if there were known issues with the counters. Francisco El Domingo, 9 de Abril de 2006 16:50, Andreas Klauer escribió:> On Sun, Apr 09, 2006 at 04:24:20PM -0300, Francisco wrote: > > I expected that meassuring the root class I would get values similar that > > the ones I get measuring the interface counters but they differ by a > > large amount. > > The statistics you posted seem to be fine. Which interface counters are > you talking about? tc starts counting only after the qdiscs/classes were > created, so if you have a separate count somewhere which started counting > some other time, the difference will of course be huge (as far as total > packet count is concerned). > > Regards > Andreas Klauer