AlgoViz

Requirements of a rate limiter

easy 24 min

Before choosing an algorithm, agree on the rules: who is counted, what counts, how strict the limit is, where it is checked, what a refused caller gets, how fast the check must be, and what happens when the limiter itself fails.

Where it shows up

The same pattern appears across everyday software.

  • GitHub

    Publishes different limits with and without login (5,000 and 60 an hour), and secondary limits such as 100 concurrent requests. Different goals, different rules.

  • Stripe

    Describes four kinds in its engineering blog: requests a second, requests in flight, shedding of non-critical traffic, and shedding by worker use.

  • Cloudflare

    Documents that rate limiting counters are not shared across its data centers, apart from those at one location: a stated limit of exactness.

  • AWS API Gateway

    Documents throttles and quotas as best effort: targets, not guaranteed ceilings.

  • Kong

    Its plugin offers local, cluster and Redis counting: the same rule with different exactness and time.

  • Envoy

    Its global filter has a setting, failure_mode_deny, that decides between open and closed when the limit service fails.