[LARTC] HTB rate, borrowing, and dequeuing

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I seem to recall having read answers to some of these questions before,
but I cannot find the answers now, and there are other answers I don't
think I have ever known!

 - How is rate calculated in HTB?
 - Over what number of seconds is rate averaged?
 - Is it calculated using exponential weighted moving average (EWMA)?


 - Do children borrow tokens or ctokens from parent classes?


 - What does it mean when a class lends (tokens?, ctokens?) to itself? [1]
   This seems illogical to me.  Is this a LARTC FAQ typo, Stef? Why would
   a class borrow from itself?


 - According to the LARTC HOWTO (9.5.2.2) [1], the kernel asks the root
   qdisc on an interface to dequeue a packet, and the qdisc hands this
   opportunity to dequeue to each subclass.  Is this also accurate for
   HTB?  (If so, this explains for me why only leaf classes can perform
   shaping, and why children classes can exceed lower parent class rates.)


Thanks in advance for any replies,

-Martin

  [1] http://www.docum.org/stef.coene/qos/faq/cache/33.html
  [2] http://lartc.org/howto/lartc.qdisc.classful.html#AEN866
  [3] http://mailman.ds9a.nl/pipermail/lartc/2003q1/006636.html
  [4] http://mailman.ds9a.nl/pipermail/lartc/2002q3/004713.html


During my research in preparing these questions, I found an answer to one
of them in the LARTC mail archive, and I figured I'd post this answer
along with my other related HTB questions.

 - According to this LARTC thread [3], child classes borrow from their
   parent up to ceil in quantum increments.  I thought bandwidth was
   divided between child classes by rate.  Can anybody disambiguate or
   elucidate on this discrepancy?

The answer, Martin, is as follows (see [4] for a restatement).  All
borrowing from the parent is done as each class has the opportunity to ask
the parent for tokens.  This means that during each turn, a class has the
opportunity to borrow a maximum of quantum tokens, before another class
gets serviced.

The confusion is understandable, since HTB calculates a reasonable quantum
(when it is not specified) from rate and r2q at the creation of the HTB
class.  So, practically speaking, unless the user is supplying r2q and
quantum, bandwidth will be borrowed from the parent in a ratio derived
from rate.

As always, quantum must be greater than or equal to MTU for HTB
calculations to be accurate.

-- 
Martin A. Brown --- SecurePipe, Inc. --- mabrown@xxxxxxxxxxxxxx



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux