Course contentsShow
← System Design
Lesson 1783 of 1,91943. Real-World System: Rate Limiter ServiceFree lesson

Functional Requirements for Rate Limiter

Defining core capabilities: limit requests per user/IP/API key within time windows with configurable rules.

Functional Requirements for Rate Limiter

What you'll learn: How to define what a rate limiter must actually do before we build it.

Why Requirements Come First

Before designing any system, we must answer: "What should this thing accomplish?" For a rate limiter, we're building a gatekeeper that decides whether to allow or reject incoming requests based on usage rules.

Core Functional Capabilities

A rate limiter service must support these essential functions:

1. Limit Requests by Identity

The system must track and enforce limits based on:

  • User ID (authenticated users)
  • IP address (anonymous or additional layer)
  • API key (for third-party integrations)

Think of this like a bouncer who recognizes guests by face (user), address (IP), or membership card (API key).

2. Time Window Controls

Rate limits operate within time boundaries:

  • Fixed windows (e.g., 100 requests per hour starting at :00)
  • Sliding windows (e.g., 100 requests in any rolling 60-minute period)
  • Multiple concurrent windows (per-second AND per-day limits)

3. Configurable Rules

Different resources need different limits:

  • /api/search: 10 requests/second per user
  • /api/upload: 5 requests/minute per IP
  • Free tier: 1000 requests/day, Premium: 100,000 requests/day

Rules must be stored, updated, and applied without restarting services.

4. Decision Response

For each request, return:

  • Allow or Deny decision
  • Current usage count
  • Time until limit resets
  • Remaining quota

Key Takeaway: Functional requirements define the what—limiting requests per user/IP/API key within configurable time windows—before we tackle the how of building distributed counters and storage.