How would you design a distributed cache system like Redis?

🏗️ System Design9/21/2025
System design for distributed caching covering consistency, partitioning, replication, and cache eviction strategies.

Distributed Cache System Design

Requirements

  • High availability and low latency
  • Horizontal scalability
  • Data consistency
  • Fault tolerance
  • Cache eviction policies

Architecture Components

Client Library

  • Consistent hashing for node selection
  • Connection pooling
  • Retry logic and failover

Cache Servers

  • In-memory storage (RAM)
  • Hash table for O(1) operations
  • Persistence options (snapshots, logs)

Coordination Service

  • Node discovery and health monitoring
  • Configuration management
  • Cluster membership

Data Partitioning

Consistent Hashing:

  • Minimizes data movement on node changes
  • Virtual nodes for better distribution
  • Handles hot keys effectively

Replication Strategies

  1. Master-Slave: Strong consistency, single point of failure
  2. Master-Master: High availability, conflict resolution needed
  3. Leaderless: Eventually consistent, high availability

Cache Eviction Policies

  • LRU (Least Recently Used)
  • LFU (Least Frequently Used)
  • TTL (Time To Live)
  • Random eviction
By: System Admin