tc39 / proposal-concurrency-control

interfaces and data structures for concurrency control and integration into async iterator helpers
23 stars 0 forks source link

Applied control and queueing algorithms #6

Open kriskowal opened 1 month ago

kriskowal commented 1 month ago

Please consider exercising some well-known control algorithms. I offer a couple and invite others.

I believe CoDel is straight-forward to implement as proposed.

AIMD requires the ability to observe whether a particular iteration failed, or rather, was retried. That might require a callback (e.g., the “mapback” for map) to hold a facet of the governor that reports that an error was observed and to cut the “congestion window” (concurrency limit) in half or some other multiplier/divisor.

These would be interesting and compelling use cases to illustrate.

kriskowal commented 1 month ago

It’s also worth looking at the duality of “token bucket” and “leaky bucket”. Some control algorithms are considerably more precise when you flip the numerator and denominator (tokens / time vs time / tokens), where the control system proposes a time to wait before calling next(). It’s likely that there’s an illustrative example in there somewhere, with a governor that adapts such a signal to timed delays.