VISUAL REFERENCE

Rate Limiting Visual Map

Master the algorithms that protect your system from overload. Token buckets, sliding windows, and more.

Algorithm

Token Bucket

Refill RateRequest Allowed

Tokens are added at a fixed rate. Requests consume tokens. Allows for bursts of traffic.

Algorithm

Leaky Bucket

Bursty InputConstant Output

Requests enter a queue (bucket) and are processed (leaked) at a constant rate. Smooths out bursts.

Algorithm

Fixed Window Counter

10:0010:0110:02Count: 50

Counts requests in fixed time windows (e.g., 1 min). Vulnerable to spikes at window edges.

Algorithm

Sliding Window Log

Window (1 min)Count only logs in frame

Tracks timestamps of each request. Accurate but high memory cost. Removes old timestamps.

Hybrid

Sliding Window Counter

Prev: 80Curr: 20Weighted Sum Formula

Combines Fixed Window + Log. Approximates count using weighted average of previous & current window.

Architecture

Middleware Implementation

CRate LimitAPI

Where to place the limiter? API Gateway vs Load Balancer vs Application Code (Sidecar).