Sharding 00:00:01 Follow a single profile update A profile update reaches a cluster with two independent shards. Watch the route first, then watch a copy travel. Which machines participate in owning this user's record? The router hashes the key and picks shard 1. The primary appends the change to its log at position 41. Then it changes its data. After a crash the log can be replayed. The follower receives 41 a moment later. The time in between is lag. Both copies have the change. Shard 2 took no part. The shard locates the row and replication maintains copies of that shard. An unrelated shard has no reason to replay this user's update. 00:00:40 Add a fourth machine A team starts with three machines and twelve keys. Compare changing the modulo denominator with moving a few permanent logical shard assignments in a directory. Key mod 3. Machines M0, M1 and M2 take turns. Key mod 4 gives 9 of 12 keys a new home. Each of 12 logical shards has a home in a map, four per machine. Only 3, 7 and 11 change in the map. A placement table lets the team move selected logical shards. It introduces metadata that routers must learn and owners must enforce during and after a move. 00:01:15 Change the owner while requests continue Logical shard four needs a roomier machine. A bulk copy takes time, and writes arriving during that interval create a gap. Follow how the move closes it. All traffic for logical 4 goes to the old primary. A copy of logical 4 is loaded. Writes made meanwhile are streamed until lag is near zero. Counts and checksums agree. Writes to logical 4 pause for a moment. Version 9 sends logical 4 to the new machine. A router still on version 8 asks the old machine for logical 4. It refuses, and the router reloads the map. Validate the copy, stop or fence old-owner writes, finish catching up and publish the new ownership version. A stale router must discover that its destination has moved. 00:02:00 Read the change you just saved A member changes her profile and refreshes immediately. The session remembers log position forty-one. Decide whether a follower at forty can satisfy this particular refresh. The primary is at 41, and the session remembers 41. Any follower will do, and this one is at 40. The old profile appears. The read carries 41. The follower has only 40, so it is skipped. The primary answers with the new profile. The follower reaches 41 and may answer again. Comparing progress positions works within the relevant log history. An eligible follower or the primary can serve the request, with explicit handling if neither is available. 00:02:41 One merchant needs every shard The order identifier routes one purchase neatly, but the merchant's dashboard asks about several customers. The slowest shard now sits directly on the response path. The key is in the question, so one shard works. The merchant's orders are on every shard. Two answers come in 5 ms, the third in 90 ms. A change stream keeps a copy by merchant. The dashboard asks one place. A separate merchant view can localize frequent dashboard reads. Its storage and update work become part of the design, and its displayed totals may lag their source.