# Leaky queue and token bucket

Subject: Computer Networks

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/cn/#tee/practice/tee-formulas/buckets

Canonical: https://deep-learning-study-room.vercel.app/read/cn/tee/practice/tee-formulas--buckets/

TEE · Complete six-unit quick reference · current syllabus 702AI0C023



$$
q_b=\max(0,q-r\Delta t)
$$



Leaky data-queue state before the next arrival; service cannot exceed queued data.



$$
a_{ok}=\min(a,B-q_b),\quad drop=a-a_{ok}
$$



B finite data capacity; admit instantaneous arrivals after interval service.



$$
T_{new}=\min(B,T+r\Delta t)
$$



Token refill before the next admission, capped by token capacity.



$$
t_{wait}=\max(0,L-T)/r
$$



Single packet of L≤B tokens, no other queued traffic, shaper not policer.



$$
D(t)\le B+rt
$$



Full token-bucket allowance; physical link rate also bounds actual departure.



$$
t_{burst}=B/(P-r),\quad P>r
$$



Fluid peak-rate burst, initially full and continuously backlogged. Net depletion is P−r.

[Three sustained-burst examples](https://deep-learning-study-room.vercel.app/read/cn/tee/practice/congestion--token-burst-1/)
