Database / ValKey Interview questions
Explain the internal working of Valkey's hash slot mechanism in cluster mode?
Each of the 16384 slots is owned by exactly one primary at a time, and the current ownership map, along with a configuration epoch used to resolve conflicting claims, is gossiped continuously between nodes over the cluster bus.
Multi-key commands are only allowed when every key involved maps to the same slot, which application code can force using a hash tag like {user1000}.profile. When rebalancing moves a slot to a new node, Valkey historically moved its keys one at a time in a move-then-delete sequence; Valkey 9.0 introduced atomic slot migration, moving all of a slot's keys in a single atomic step instead, avoiding the partial-migration edge cases the older approach could hit.
More Related questions...