Rate Limiter Config Calculator
Generate production-ready rate limiter configurations for Express.js, Nginx, Redis, and Kong. Compare Token Bucket, Sliding Window, Fixed Window, and Leaky Bucket algorithms — with ASCII visualization and calculated metrics. No install needed.
Frequently Asked Questions
What is the difference between Token Bucket and Sliding Window rate limiting?▼
Token Bucket accumulates credits (tokens) over time up to a burst cap. Requests consume tokens; if empty, they're rejected. It's great for bursty traffic because it allows short bursts while enforcing a sustained average. Sliding Window tracks the exact count of requests in the last N seconds, rolling forward with each request. It's more accurate and immune to boundary attacks, but costs more memory (O(requests) per user). For most public APIs, Token Bucket is the practical choice; use Sliding Window when fairness is critical.
What is a 'burst capacity' and why does it matter?▼
Burst capacity is the maximum number of requests allowed in a short spike before the rate limiter kicks in. For a Token Bucket with 100 req/s and burst=200, a client can fire 200 requests instantly, then is limited to 100/s thereafter. Too low a burst frustrates legitimate users during peak load (e.g., app startup, page loads). Too high allows abuse. A common rule of thumb: set burst to 2-5x your sustained RPS for user-facing APIs.
What is the Fixed Window boundary attack?▼
Fixed Window divides time into fixed slots (e.g., 0-60s, 60-120s). A client can send the full limit at 59s, wait 1s for the window to reset, then send the full limit again at 60s — effectively doubling the rate at the boundary. Example: limit 100 req/min → attacker sends 100 at t=59s + 100 at t=60s = 200 in 2 seconds. Sliding Window eliminates this by always looking at the last N seconds from now, not from a fixed start time.
When should I return HTTP 429 vs 503?▼
Return 429 Too Many Requests when a specific client has exceeded their rate limit — always include a Retry-After header. Return 503 Service Unavailable when your entire service is overloaded globally (e.g., circuit breaker tripped). The key difference: 429 is per-client, 503 is system-wide. Well-behaved clients will back off on 429. Nginx returns 503 by default for limit_req overflow — override with 'limit_req_status 429'.
How do I implement distributed rate limiting across multiple servers?▼
Single-server rate limiters break when you have multiple app instances (each has its own counter). Use a shared store: Redis is the standard choice. Libraries like rate-limit-redis (Node.js) or python-redis-rate-limit plug into your existing rate limiter. For Token Bucket or Sliding Window, use Redis Lua scripts (shown in the Redis tab above) to make the check-and-increment atomic. For high-throughput systems, consider a sidecar approach (Envoy, Istio) or a dedicated rate limiting service like Envoy's global rate limit service.
What is Leaky Bucket and when should I use it?▼
Leaky Bucket processes requests at a constant output rate (the 'leak') regardless of input burst. Excess requests either queue up (up to queue depth) or are dropped immediately. Unlike Token Bucket which allows bursts to pass through, Leaky Bucket smooths them out — output is always steady. Use it to protect downstream services that can't handle bursts: payment processors, third-party APIs with their own rate limits, or database connections. The tradeoff: legitimate burst traffic gets artificially delayed or dropped.
Related Products
on GumroadDevPlaybook Interview Vault
210+ real technical interview questions with model answers, asked at Google, Meta, Amazon, Microsoft, Stripe, and Shopify. Covers Frontend (55), Backend (55), System Design (50), and DSA (50). Available in English and Traditional Chinese.
Buy on Gumroad →TypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →Developer Interview Vault
210 technical interview questions with model answers, key points, and follow-up questions. Covers Frontend, Backend, System Design, and DSA — bilingual English + Traditional Chinese (ZH-TW). PWYW from $29.
Buy on Gumroad →You Might Also Need
Redis Command Tester
Test Redis commands in your browser with no install needed. Simulate SET, GET, HSET, LPUSH, EXPIRE, TTL and more with color-coded output and a built-in command reference.
Open free tool →
nginx Config Generator
Generate production-ready nginx server blocks instantly. Supports static sites, reverse proxy (Node.js, API), PHP-FPM, and HTTPS redirects. Includes SSL/TLS, gzip, cache headers, security headers, and
Open free tool →
Redis Pipeline Builder
Build Redis command pipelines visually. Add GET, SET, HSET, LPUSH, EXPIRE and other commands, reorder them, and export as raw pipeline, redis-cli, or Node.js ioredis code.
Open free tool →
More Free Tools
Related Articles
API Rate Limiting: Algorithms and Implementation Guide 2026
Complete guide to API rate limiting in 2026. Token Bucket, Leaky Bucket, Sliding Window algorithms with Node.js and Redis implementations, distributed rate limiting, 429 handling, and best practices.
API Rate Limiting: Strategies, Algorithms, and Free Tools
A complete guide to API rate limiting in 2025: Fixed Window, Sliding Window, Token Bucket, and Leaky Bucket algorithms explained, with implementation in Node.js, Python, and Go, Redis-based distributed limiting, and client-side backoff strategies.
The Ultimate API Design Checklist for Production Apps
Ship production-ready APIs with this comprehensive checklist. Covers REST design, authentication, validation, error handling, rate limiting, versioning, documentation, and monitoring.
FastAPI vs Django REST Framework 2025: Which Should You Choose?
FastAPI vs Django REST Framework compared for 2025. Performance benchmarks, feature comparison, real-world use cases, and a clear decision guide for your next Python API project.
JWT Authentication Best Practices 2026: Secure Your API Tokens
Complete JWT security guide for 2026. Covers RS256 vs HS256 signing, token storage strategies, expiry and refresh token patterns, revocation, common vulnerabilities, and a production security checklist.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →