FA-73772 / Rate limiter algorithms / Member archive
EWMA arrival-rate throttle: simultaneous arrivals treated as one millisecond apart · case 02
Two requests with the same timestamp spike the estimate to 1000 requests per second.
Case contract
Input {tau_ms, limit_rps, requests [t_ms]}. The rate estimate r starts at 0. For each arrival strictly after the latest seen time, dt = t - last, a = exp(-dt/tau) and r = a*r + (1-a)*(1000/dt) requests per second. Simultaneous or late arrivals leave r unchanged and never move the clock backwards. Every arrival reports deny if r > limit else allow, with r rounded to 3 decimals.
Why this case matters
Irregular-interval EWMA estimators throttle clients by smoothed request rate; time-unit and duplicate-timestamp handling decide whether bursts are detected.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| simultaneous arrivals | [["allow", 0.0], ["allow", 1.106], ["allow", 2.354], ["allow", 3.6], ["allow", 3.901], ["deny", 5.146]] | [["allow", 0.0], ["allow", 1.106], ["allow", 1.106], ["allow", 1.106], ["allow", 1.964], ["allow", 1.964]] | 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 ↗