Overview
A payments processor ran Valkey 8.0 in cluster mode for idempotency keys and session state. Before a seasonal volume peak the team added shards and started a reshard, which stopped partway with traffic still flowing.
Challenge
Several slots were left in migrating and importing states, clients saw ASK and MOVED redirects for a subset of keys, and tail latency rose on two shards. Retrying the reshard script made the state worse, because the source and target nodes disagreed about who owned the slots. The cause sat in a few very large hash keys that the key-by-key migration could not move inside the configured timeout.
Environment
Valkey 8.0 Cluster on Kubernetes in AWS: 6 primaries with one replica each, going to 9, StatefulSets with persistent volumes, Prometheus for metrics, clients on Java and Go.
Approach
AceMQ engineers stopped the retries, read the slot state on both source and target nodes with CLUSTER NODES and CLUSTER SETSLOT, and found the keys blocking each stuck slot. The large hashes were moved or split in a controlled window, the open slots were closed explicitly on both ends, and the remaining reshard ran in small batches with latency watched between them.
Solution
- Paused the reshard automation and recorded the slot state on every node before changing anything
- Identified the large hash keys blocking migration with a keyspace sample and MEMORY USAGE
- Closed each migrating and importing slot explicitly on both source and target nodes
- Split the largest hashes into bounded buckets in the application and migrated the rest in batches
- Added a pre-check for large keys and a per-batch latency gate to the reshard runbook
- Planned the move to Valkey 9.0, where atomic slot migration moves a whole slot at once
Outcome
The cluster reached nine shards with all 16,384 slots owned and no open migrations before the peak. The team kept a runbook for large-key checks and batched resharding, and an upgrade to atomic slot migration on Valkey 9.0 went into the next maintenance plan.