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

Handling Redis Failures and Fallbacks

Implement circuit breakers and local-only fallback modes when Redis becomes unavailable to maintain availability.

Handling Redis Failures and Fallbacks

What You'll Learn

You'll learn how to keep your rate limiter service available even when Redis goes down by implementing circuit breakers and graceful degradation strategies.

The Problem of Redis Dependency

When your rate limiter relies entirely on Redis for state management, Redis becomes a single point of failure. If Redis crashes, becomes unreachable, or experiences network partitions, your entire rate limiting system could fail—potentially blocking all traffic or allowing unlimited requests.

Circuit Breaker Pattern

Think of a circuit breaker like the electrical circuit breakers in your home. When it detects too many failures (Redis timeouts, connection errors), it "trips" and stops attempting Redis calls temporarily.

Three states:

  • Closed: Normal operation, all requests go to Redis
  • Open: Redis is down, all requests bypass Redis entirely
  • Half-Open: Testing if Redis has recovered with limited traffic

After a cooldown period (e.g., 30 seconds), the circuit breaker transitions to half-open and tries a few Redis calls. If they succeed, it closes again; if they fail, it reopens.

Fallback Strategies

When Redis is unavailable, you have options:

1. Fail Open (Allow All): Let all requests through without rate limiting. Maintains availability but loses protection.

2. Fail Closed (Block All): Reject requests. Protects backend but sacrifices availability.

3. Local-Only Mode: Use the local cache you already built (lesson 1801) as the sole decision-maker. Less accurate across nodes but maintains partial protection.

4. Conservative Estimates: Apply stricter local-only limits (e.g., 50% of configured limit) to compensate for lack of global coordination.

Most production systems choose fail-open for user-facing traffic and local-only mode for API protection, accepting temporary accuracy loss to maintain availability.

Key Takeaway:
Circuit breakers prevent cascading failures when Redis is down, while fallback modes (fail-open, local-only) let your rate limiter degrade gracefully rather than taking your entire service offline.