QA
Intermediate LevelSystem Design & Architecture

How does Redis Cluster shard data using Hash Slots?

❓ Interview Prompt: Explain Redis Cluster, 16,384 Hash Slots ($CRC16(key) \bmod 16384$), master-slave replication, cluster node failover, and hash tags.

Redis Cluster distributes data across multiple Redis nodes automatically using Hash Slots:

Architecture:

1
The keyspace is divided into 16,384 logical Hash Slots.
2
Key slot assignment formula: $\text{Slot} = \text{CRC16}(key) \pmod{16384}$.
3
Master nodes in the cluster own sub-ranges of the 16,384 slots.
4
Hash Tags: Enclosing part of a key in curly braces ('{user:100}:profile') forces related keys onto the exact same hash slot for multi-key operations!

Code Implementation Example

bash
# Inspecting Redis Cluster slot distribution via redis-cli:
redis-cli -c -h redis-node-1 CLUSTER SLOTS
πŸ’‘Inspecting Redis Cluster hash slot allocations via redis-cli.
🎯 Interview Key Takeaway

Redis Cluster uses 16,384 Hash Slots to shard data evenly across master nodes with automatic failover.

#System Design#Redis Cluster#Hash Slots#Distributed Caching#Intermediate
Back to all System Design & Architecture Questions→

More System Design & Architecture Interview Questions

Beginner LevelSystem Design & Architecture

Explain the CAP Theorem and PACELC Theorem with real-world database examples.

Beginner LevelSystem Design & Architecture

What is Vertical Scaling (Scale Up) vs Horizontal Scaling (Scale Out)?

Beginner LevelSystem Design & Architecture

How do Load Balancers distribute traffic (Round Robin, Least Connections, IP Hash)?