How would you design a distributed cache system like Redis?
🏗️ System Design• 9/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
- Master-Slave: Strong consistency, single point of failure
- Master-Master: High availability, conflict resolution needed
- 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