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

Tiered Rate Limiting

Implementing different rate limit tiers (free, premium, enterprise) with varying quotas and features.

Tiered Rate Limiting

What you'll learn: How to implement different rate limit tiers (free, premium, enterprise) with varying quotas and features to serve diverse customer segments.

The Core Idea

Tiered rate limiting means applying different rate limits based on the customer's subscription level or service tier. A free user might get 100 requests per hour, a premium user 10,000, and an enterprise customer 1 million—all enforced by the same rate limiter service but with tier-specific policies.

Think of it like gym memberships: basic members can visit 4 times per month, premium members get unlimited access, and VIP members also get priority booking. Same facility, different access rules.

How It Works

When a request arrives, the rate limiter:

  1. Identifies the tenant/user (already covered in lesson 1818)
  2. Looks up their tier from tenant configuration (lesson 1819)
  3. Applies the appropriate rate limit policy for that tier
  4. Returns tier-specific information in responses (e.g., "You have 50 requests remaining in your free tier")

Configuration Structure

Each tier defines:

  • Request quota (requests per time window)
  • Burst allowance (if using token bucket)
  • Time window (per second, minute, hour, day)
  • Features enabled (e.g., enterprise might skip certain limits entirely)
  • Multiple dimensions (read vs write limits, per-endpoint quotas)

Design Considerations

Store tier configuration centrally (database or configuration service) so you can update limits without redeploying. Cache tier mappings in Redis alongside rate limit counters to avoid extra lookups. Consider fallback tiers if lookup fails—default to the most restrictive tier for safety.

Key Takeaway: Tiered rate limiting enables monetization and fair resource allocation by mapping users to subscription levels and enforcing tier-specific quotas using the same underlying rate limiting algorithms.