Design a global rate limiter shared by millions of clients and services. Enforce per-user, per-tenant, and per-route limits with low latency and correct behavior under Redis or regional failures.
Functional requirements
- Token bucket or sliding window counters per key
- Distributed counters with optional local edge enforcement
- Dynamic config push for limits without full redeploy
- Allowlists, burst credits, and cost-based budgets
- Audit of denials for security and capacity planning
Non-functional requirements
- Sub-millisecond local decisions after warm cache
- Horizontal scale of counter shards
- Graceful behavior when central store is partitioned
- Fairness between noisy tenants