A lookup table, the directory, records which shard holds each key. Nothing about the key decides its shard, so data can be placed and moved however you like: one user at a time, by load, or by any rule. The price is the directory itself: every request needs a lookup, and every copy of the table must be kept up to date. Below, add shards, rebalance a few heavy users, and turn on caching to see a stale copy.
The panel is the directory: one entry per user, coloured by the shard it points to. Each dot in a shard is one user record, coloured by country. Edit the directory and the records it moves glide to their new shard, ringed so you can count them. A shard turns red when it serves well above its share of requests.
1. One entry per user
2. One entry per virtual shard
3. Lookups with no cache
4. Lookups with a cache
Steps 1 and 2 are the storage estimate from the back-of-the-envelope chapter of Alex Xu's System Design Interview, Vol. 1, applied to the directory instead of the data; 16 bytes is roughly a key and a shard number. The 16.4K virtual shards are an example count; mapping virtual shards to physical ones is the approach Azure's sharding guidance describes. Steps 3 and 4 are plain arithmetic.
Azure documents the lookup strategy for whole shards; Vitess uses lookup tables to find rows by a second key.
All are official documentation from Microsoft and the Vitess project. Quoted phrases are short attributed quotations; everything else is described in our words.