All Questions
Sharding hard

To migrate a live dataset from 5 shards to 10 without downtime, engineers often use a 'Dual-Write' strategy. What is the correct sequence of operations to ensure zero data loss during the cutover?

  1. A 1. Begin writing to both Old and New locations (Dual Write); 2. Backfill historical data from Old to New; 3. Verify consistency; 4. Switch Reads to New; 5. Stop writing to Old.
  2. B 1. Stop all writes to the cluster; 2. Perform a file-system rsync from Old to New; 3. Update the DNS records; 4. Resume traffic on the New cluster.
  3. C 1. Copy all historical data to the New cluster first; 2. Enable Dual-Writes to keep them in sync; 3. Run a validation script; 4. Instantly switch all traffic.
  4. D 1. Provision New servers; 2. Update the Application Shard Map to include New servers; 3. Allow the database's auto-balancer to move data; 4. Delete the Old servers.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions