Redis & Caching (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
Redis Cluster: 16,384 Hash Slots and Hash Tags.
senior LevelredisAdvanced Internals
In Simple Words: Redis Cluster shards data across multiple nodes without a centralized proxy:
- 16,384 Hash Slots: Keys are mapped to slots using
CRC16(key) % 16384. Each master owns a subset of slots. - Hash Tags (
{user_id}): Only the string inside{}is hashed. Forces related keys (e.g.{u:123}:profileand{u:123}:orders) into the exact same hash slot, enabling multi-key transactions!