Skip to main content
Cloud / DevOpsTraffic & ScalingInteractiveIntermediate

Rate Limiting

KO: 레이트 리미팅·EN: Rate Limiting·JA: レートリミット

A traffic control mechanism that caps the number of requests a user, IP, or API key can make within a time window to prevent overload, abuse, and cascading outages

Table of Contents

Interactive Playground

Tap or drag to interact with the demo
Quick Answer

What is Rate Limiting?

A traffic control mechanism that caps the number of requests a user, IP, or API key can make within a time window to prevent overload, abuse, and cascading outages. It is a core concept in Traffic & Scaling within Cloud / DevOps.

Core Principles

Rate Limiting caps how many requests a client (identified by IP, user ID, or API key) can issue within a given time window, rejecting excess traffic with HTTP 429 Too Many Requests.

Common algorithms include Token Bucket (allows controlled bursts while enforcing an average rate), Leaky Bucket (smooths output at a fixed pace), and Sliding Window (prevents double-burst spikes across fixed window boundaries).

Practical Takeaways

  • Return actionable headers: Include Retry-After and RateLimit-Remaining headers with 429 responses so well-behaved clients back off cleanly instead of hammering your API in a tight retry loop.
  • Use atomic distributed counters: In multi-instance deployments, enforce global limits via Redis with Lua scripts to prevent race conditions across nodes.
  • Scope limits by identity and endpoint cost: Apply stricter quotas to expensive endpoints (login, search, AI inference) and key authenticated traffic by user or tenant ID rather than shared corporate NAT IPs.

Notable Examples

  • Stripe, GitHub & OpenAI APIs: Enforce tiered RPM/TPM quotas to guarantee fair multi-tenant performance and predictable billing.
  • NGINX limit_req & AWS API Gateway: Drop abusive traffic at the edge before it consumes backend CPU or database connections.
  • Authentication Protection: Throttles repeated login attempts per account to neutralize credential stuffing and brute-force attacks.