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

[altq 111] Re: cbq update




Fulvio wrote:
>> That's true: with my previous patch, the borrowing mechanism is broken
>> if we eliminate ifnow_ .

>> The problem is (was, hopefully...) in the rmc_delay_action.
>> In fact, the
>> 	rmc_update_class_util
>> compute the underlimit for BOTH the leaf and the root class.
>> When the borrowing is activated AND the root class is being overlimit,
>> the LEAF class is suspended by the rmc_delay_action.
>> As far as I understand, the root class is NOT suspended; the leaf clas
>> does.

>> That's the problem: when the leaf class is suspended, its suspension
>> time is quite high (even if I use the offtime of its parent, like the
>> code currently does) because its avgidle is quite far from zero.
>> Therefore the session is punished because of the amount of service it
>> has got due to the borrowing.

Fulvio,

You seem to have misunderstood the problem.  It is not how long a
class should be suspended but the class should not be suspended at all 
when it borrows from the root class.

When a class borrows bandwidth from its ancestor, the ancestor must be
underlimit (avgidle of the ancestor must be positive).
And the root class should be always underlimit as long as 100% of the
link bandwidth is allocated to the root class.
(the same rule applies to any ancestor but I use the root class as an
example.)

However, it doesn't hold if you calculate an idle time based on the
current time in rmc_update_util() because packets are sent to the
device buffer much faster than the link speed.
The impact is greater to a class with a larger bandwidth allocation
because the error ratio is larger.

For example, assume the following classes:

	root	10Mbps packetsize:1KB pkt_time:800us
		maxidle:25us (maxburst:4)
	  |

	classA 	1Mbps packetsize:1KB pkt_time:8ms
		maxidle:975us (maxburst:4)

Also assume it take only 100us to send a packet to the device buffer,
although it takes 800us to send it to the wire.

When classA sends 5 back-to-back packets, the avgidles of both classes 
become:
			classA		root
	1st packet:	975us		25us
	2nd packet:	698us		 3us
	3rd packet:	429us		-18us
	4th packet:	169us		-38us
	5th packet:	-83us		-58us

When the avgidle of classA becomes negative after sending 5 packets,
the root class is also overlimit and classA can't borrow from the root.
Moreover, if classA repeats this cycle, the avgidle of the root class
stays negative most of the time during classA is suspended!
This illustrates a pitfall of EWMA (exponentially-weighted moving
average).

ifnow_ is used to work around this problem and the issue is completely 
different from how long a leaf class should be suspended.
I agree with you that we don't need ifnow_ to calculate the suspention 
time of a leaf class and it is much simpler and more accurate.

By the way, ifnow_ does not get reset to now.  The gap between ifnow_
and now is bound by the device buffer size.
maxiftime_ is just a guard against
 (1) root bandwidth is set to a value lower than the link bandwidth
 (2) some link-level compression is used, which has an effect similar
     to (1).

-Kenjiro