FA-73390 / Rate limiter algorithms / Member archive
Generic cell rate algorithm limiter: retry-after ignores the burst tolerance · case 05
Denied clients are told to wait far longer than necessary.
Case contract
Input {period_ms T, burst B, requests [[t, quantity]]}. State TAT starts at 0. A quantity above B is ["never", 0, 0]. Otherwise tat = max(TAT, t) and new_tat = tat + q*T; the request is allowed iff new_tat - t <= B*T, in which case TAT = new_tat and remaining = floor((B*T - (TAT - t))/T). A denied request leaves TAT unchanged and reports retry_after = new_tat - B*T - t and remaining floor((B*T - (tat - t))/T). Return [[decision, retry_after, remaining]].
Why this case matters
GCRA limiters store a single theoretical-arrival timestamp per key; every decision and header value is derived from it, so small formula errors leak bursts or starve clients.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| burst of five | [["allow", 0, 4], ["allow", 0, 3], ["allow", 0, 2], ["allow", 0, 1], ["allow", 0, 0], ["deny", 600, 0], ["allow", 0, 0], ["allow", 0, 0]] | [["allow", 0, 4], ["allow", 0, 3], ["allow", 0, 2], ["allow", 0, 1], ["allow", 0, 0], ["deny", 100, 0], ["allow", 0, 0], ["allow", 0, 0]] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗