Data Migration and Synchronization
What you'll learn: How to keep data consistent between legacy and replacement systems while running them side-by-side during incremental migration.
The Challenge of Dual Systems
When using the Strangler Fig Pattern to gradually replace a legacy system, you face a critical problem: both old and new systems often need to operate simultaneously, sometimes for months. During this period, they must share data. A customer record updated in the legacy system must appear current in the new system—and vice versa. Without synchronization, your systems diverge, causing data corruption, lost updates, and user confusion.
Think of it like moving apartments while still living in the old one. You need some belongings in both places, and changes in either location must somehow stay coordinated.
Core Synchronization Strategies
One-way sync works when your new system is read-only initially. The legacy system remains the "source of truth," and changes flow in one direction. This is safest but limits new system capabilities.
Two-way sync allows both systems to accept writes, requiring conflict resolution rules. Which system wins when the same record changes in both? Timestamp-based, last-write-wins, or business-logic-driven rules become necessary.
Event-based sync uses message queues or event streams. When data changes in either system, an event triggers updates elsewhere. This decouples systems but introduces eventual consistency.
Dual-write pattern updates both systems in the same transaction, but risks partial failures requiring compensating transactions.
Managing the Transition
Start with data snapshot migration to populate your new system. Then establish continuous synchronization for ongoing changes. As you migrate functionality from old to new (per lessons 1776-1777), gradually shift which system is authoritative for each data domain. Eventually, the legacy system stops receiving writes entirely, simplifying to read-only before final retirement.
Key Takeaway: Data synchronization is the bridge that keeps both systems functional during migration—choose your strategy based on consistency requirements, acceptable lag, and which system is authoritative for each data type.