The service needed to move a large user table from a monolith DB to a new sharded store while traffic kept flowing.
The mismatch caused duplicate writes and occasional lost updates, increasing toil and risking data loss.
The team solved it by: 👉 Add a dual-write layer that forwards every write to both stores. 👉 Run a backfill job that copies historic rows to the new store. 👉 Implement a reconciliation process that compares both stores and fixes divergences.
The parts that matter: 1️⃣ DualWriteService - captures writes and forwards them to legacy and new databases 2️⃣ BackfillJob - streams existing records into the new store in batches
The migration completed without any data loss and the legacy database was decommissioned.
Running dual writes added latency to every request and required extra capacity in both databases. The backfill job consumed significant I/O, so it was throttled to avoid impacting foreground traffic. Reconciliation introduced periodic load spikes that had to be scheduled during low-traffic windows.
How do you balance the cost of dual writes against the risk of data drift during a large migration?