Protocol in Code · Track

QoS

token buckets, lazy refill, and hierarchical class trees as shaping math

5 sessions Course material (English)

Sessions

QoS track sessions

Session 01

A Token Bucket Is Two Variables

What actually decides whether a request is allowed or throttled, and why does that decision need no queue, no timer, and no scheduler?

Open Session 01
Session 02

Refill Is Lazy

If nothing is ticking a clock in the background, when does a token bucket's balance actually get updated, and why is the math split into its own file with no bucket object in sight?

Open Session 02
Session 03

Leaky and Token Are Cousins

A leaky bucket uses the same two variables and the same lazy-settlement trick as a token bucket — so why does an identical burst that a token bucket allows outright get dropped by a leaky bucket?

Open Session 03
Session 04

Classes Form a Tree

Hierarchical shaping puts classes like "video" and "bulk" underneath "default" so they can share what "default" doesn't use — but a parent pointer alone doesn't make that sharing safe. What has to be true of the tree before any borrowing math is trustworthy, and how much can a class actually borrow on paper?

Open Session 04
Session 05

Build the Toy Shaper Loop

Four sessions built four standalone mechanisms — a token bucket that refills itself, the lazy refill math underneath it, a leaky bucket that drains itself, and a class tree that validates its own shape. None of them, alone, shapes traffic. What does it take to wire them into something that classifies a packet and decides its fate, and what exactly is it about that wiring that keeps one class's exhaustion from leaking into another's?

Open Session 05