Skip to content

codel implementation diverges from spec #160

@smklein

Description

@smklein

The implementation of ControlledDelay: https://github.com/TritonDataCenter/node-cueball/blob/master/lib/codel.js

References this specification: https://queue.acm.org/appendices/codel.html

I believe the implementation diverges from this reference specification in cases where a queue has entries that each take CODEL_INTERVAL duration to complete through the queue.

In the reference specification, this would place the queue in the "dropping" state, but the value of drop_next would be re-calculated each time.

In the current implementation, the following would happen:

okToDrop would be set to true:

var okToDrop = this.canDrop(now, start);

We'd be in the drop state:

if (this.cd_dropping) {

And for requests arriving at CODEL_INTERVAL, we'd drop them:

} else if (now >= this.cd_drop_next) {
dropClaim = true;
this.cd_count += 1;
}

This doesn't invoke getDropNext to calculate the next plausible drop time -- it just leaves the old value, which is already in the past. This is where the behavior diverges from the reference specification -- in the reference spec, the value of drop_next is recalculated anytime the queue attempts to drop a value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions