FA-73399 / Rate limiter algorithms / Member archive
Generic cell rate algorithm limiter: oversize check compares units with time · case 04
Requests larger than the burst receive retry hints that can never succeed.
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 |
|---|---|---|---|
| multi-unit request | [["allow", 0, 1], ["deny", 20, 1], ["allow", 0, 1], ["deny", 100, 0]] | [["allow", 0, 1], ["deny", 20, 1], ["allow", 0, 1], ["never", 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 ↗