What does Private-Channel Rate Shaping conclude, in numbers, about “Overflow under Poisson Arrivals: the Bucket Depth Only Shifts the Tail of the Leaky-Bucket Queue”?
Answer: Look at the three rows at a load of 0.60. With a pure leaky bucket, the probability that some message is still queued at the end of a minute is 0.048635, the mean queue 0.0921 messages and the mean extra wait 0.01535 minutes; at depth 10 the queueing probability falls to 0.000008, and at depth 20 it vanishes from six decimals. At a load of 0.80, the leaky bucket queues with probability 0.281302 and the mean extra wait is 0.10983 minutes; depth 10 brings this to 0.004549 and depth 20 to 0.000061. At a load of 0.90, the leaky bucket queues with probability 0.553500 and holds 3.1012 messages on average; depth 10 gives 0.074575, and depth 20 gives 0.009397 with a mean extra wait of 0.00558 minutes, under half a second.
Scope of the numbers: An illustrative plan averaging 10.0 messages a minute still has 420 refused when sent in batches, and none once a token bucket of depth 20 shapes it. Parameters are illustrative, platform figures carry the document and the date read, and all numbers come from the book's programs, which read and write no file and use no network.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.000008, 0.000061, 0.004549, 0.00558, 0.009397, 0.01535
| r = 10 per minute; Poisson load lam per minute | |||||
| lam | load | b | P(queue at minute end) | mean queue | wait (min) |
| 6 | 0.60 | 0 | 0.048635 | 0.0921 | 0.01535 |
| 6 | 0.60 | 10 | 0.000008 | 0.0000 | 0.00000 |
| 6 | 0.60 | 20 | 0.000000 | 0.0000 | 0.00000 |
| 8 | 0.80 | 0 | 0.281302 | 0.8786 | 0.10983 |
| 8 | 0.80 | 10 | 0.004549 | 0.0130 | 0.00162 |
| 8 | 0.80 | 20 | 0.000061 | 0.0002 | 0.00002 |
| 9 | 0.90 | 0 | 0.553500 | 3.1012 | 0.34458 |
| 9 | 0.90 | 10 | 0.074575 | 0.3986 | 0.04429 |
| 9 | 0.90 | 20 | 0.009397 | 0.0502 | 0.00558 |
Show the full program
# Chapter 3. p31: Poisson arrivals through a token bucket, solved exactly.
# Model: event-driven messages (order notices, replies to customers who
# wrote first) arrive as Poisson(lam) per minute. The shaper adds
# r = 10 tokens a minute to a bucket of depth b. State s at the end of a
# minute = backlog - tokens, from -b upwards; next minute
# s' = max(s + A - r, -b). Put u = s + b: then u' = max(u + A - r, 0),
# the queue of a pure leaky bucket, whatever b is. So the backlog of a
# bucket of depth b is max(u - b, 0): one stationary law serves every
# depth. Law of u by iteration on 0 to 220. Mean wait beyond the arrival
# minute follows from Little's law: mean backlog / lam. Token-bucket
# arrival curves as in Le Boudec and Thiran, LNCS 2050.
import math
R, TOP = 10, 220
def poisson(lam, kmax=45):
return [math.exp(-lam + k * math.log(lam) - math.lgamma(k + 1))
for k in range(kmax)]
def leaky_law(lam, iters=6000):
pa = poisson(lam)
pi = [1.0] + [0.0] * TOP
for _ in range(iters):
bins = [[] for _ in range(TOP + 1)]
for u, w in enumerate(pi):
if w < 1e-300:
continue
for a, p in enumerate(pa):
bins[min(max(u + a - R, 0), TOP)].append(w * p)
new = [math.fsum(t) for t in bins]
gap = max(abs(x - y) for x, y in zip(new, pi))
pi = new
if gap < 1e-15:
break
return pi
def at_depth(pi, b, lam):
p_wait = math.fsum(pi[b + 1:])
backlog = math.fsum((u - b) * w for u, w in enumerate(pi) if u > b)
return p_wait, backlog, backlog / lam
if __name__ == "__main__":
print("r = %d per minute; Poisson load lam per minute" % R)
print("lam load b P(queue at minute end) mean queue wait (min)")
for lam in (6, 8, 9):
pi = leaky_law(lam)
for b in (0, 10, 20):
pw, bl, wt = at_depth(pi, b, lam)
print("%3d %4.2f %2d %22.6f %10.4f %10.5f"
% (lam, lam / R, b, pw, bl, wt))Single source and citation
Fan, Y. (2026). Rate Control for Private Messaging Channels without Account Bans: Token-Bucket Shaping, Platform-Published Limits and Consent-Based Reach Throughput (Version 1.0.0), Chapter 3: Overflow under Poisson Arrivals: the Bucket Depth Only Shifts the Tail of the Leaky-Bucket Queue. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-271 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026271,
author = {Fan, Yafu},
title = {Rate Control for Private Messaging Channels without Account Bans: Token-Bucket Shaping, Platform-Published Limits and Consent-Based Reach Throughput},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Bursts That Are Compliant on Average: Sliding-Window Caps and the b + rW Bound of the Token Bucket
- Chapter 2 · Who Decides Account Quality: Consent Rates, Negative Feedback and a Markov Chain of Tiers
- Chapter 4 · Leaky Buckets, Token Buckets and Two Limits at Once: Per-Minute Shaping and Distinct Recipients in 24 Hours
- Chapter 5 · Slowing Down on Feedback: Additive Increase, Multiplicative Decrease and Wald's Sequential Test
- Chapter 6 · Red Lines outside the Model: Stop Means Stop, Quiet Hours, Vulnerable Readers to a Person, and No Pretending
- Chapter 7 · Pulling Up Shoots and Telephone Traffic: Mencius's Parable and Erlang's Paper of 1909
- Chapter 8 · Closing the Loop: a Weekly Review, the Rate Shaper and a Pre-Registered Test