Token Bucket Visualization
Tokens refill smoothly over time. Allows sudden bursts up to capacity, then throttles to steady refill rate.
Synchronized Execution & Token Refill Timeline (80 requests)
Top lane: HTTP response verdict • Bottom lane: Live token balance dipping to 0 and stair-step refilling
Head-to-Head Algorithm Comparison Under Identical Workload
Input: 80 requests (flash_burst)| Algorithm | Accepted | Throttled | Absorption | Boundary Spike Resilience | Memory Footprint | Time Complexity |
|---|---|---|---|---|---|---|
| Token Bucket | 25 | 55 | 31.3% | Immune (Smooth) | 24 B (O(1) constant) | O(1) Constant |
| Leaky Bucket | 25 | 55 | 31.3% | Immune (Smooth but delays, not throttles) | 24 B (O(1) constant) | O(1) Constant |
| Fixed Window | 20 | 60 | 25% | Vulnerable (2x burst at boundary) | 16 B (O(1) constant) | O(1) Constant |
| Sliding Window Log | 20 | 60 | 25% | Immune (Exact Log) | 1440 B (O(N) scale) | O(log N) / O(N) |
| Sliding Window Counter | 20 | 60 | 25% | Immune (Weighted Window) | 24 B (O(1) constant) | O(1) Constant |
| GCRA (Redis Cell) | 25 | 55 | 31.3% | Immune (Continuous TAT) | 8 B (O(1) single TAT) | O(1) Constant |
Production Gateway Configuration Generator
Drop-in production configurations configured with Capacity: 20 and Limit: 20 req / 60s
# Execute atomic GCRA throttle check inside Redis: # Syntax: CL.THROTTLE <key> <max_burst> <count> <period_seconds> [<quantity>] # Configuration: 20 req/60s with burst allowance of 20 CL.THROTTLE rate:user_101 20 20 60 1 # Output Tuple: # 1) (integer) 0 # 0 = Request Allowed, 1 = Throttled (429) # 2) (integer) 21 # Total burst capacity (max_burst + 1) # 3) (integer) 19 # Remaining tokens in bucket # 4) (integer) -1 # Retry-After seconds (-1 if request permitted) # 5) (integer) 3 # Seconds until bucket completely refills to 20