HLD-101·Rate Limiting
Easy · 500 ptsDistributed API Rate Limiter & Quota Gateway
Design a low-latency ingress rate-limiting tier enforcing per-tenant sliding-window and token-bucket quotas across stateless API gateways without adding tail latency.
Max p99
≤ 25 ms
Availability
≥ 99.5%
Budget
≤ $1,850
Functional Requirements
- FR-1POST /v1/check — Evaluates whether api_key has remaining quota in the current window and increments usage.
- FR-2GET /v1/quota/{api_key} — Returns current remaining allowance and reset timestamp.
- FR-3PATCH & DELETE /v1/check/{api_key} — Updates, revokes, or deletes api_key entries with bounded TTL or explicit cache/index invalidation.
- FR-4Quota rules and counter state must remain available if a single state node crashes.
Workload Profile
Baseline Load18,000 Check RPS / 4,000 Counter Write RPS
Bot Surge Peak55,000 Check RPS / 12,000 Write RPS
Active Working Set4 GB hot sliding-window counters (40 GB rules/audit)
Traffic DistributionSkewed burst on abusive api_key tenants
Consistency Model
Bounded eventual consistency (< 1s window drift acceptable across gateway POPs; rule configs must be durably stored).
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
Design Write-up
0 boxes · 0 edges
0 words