AWS Builder Center

The Dual Write Pattern: Will it work for Migrating Relational Databases to NoSQL?

What is the Dual Write database migration strategy, and how well does it work? Can we use it to migrate a relational SQL database into Amazon DynamoDB?

Series: Dual Writes for Database Migrations (2 articles)

  1. 2
    The Dual Write Pattern: Will it work for Migrating Relational Databases to NoSQL? This article
Specialist Solution Architect - DynamoDB
When organizations decide to migrate from a relational database (RDBMS) to a NoSQL database like Amazon DynamoDB, one of the most promising strategies is the dual write pattern, which involves writing data simultaneously to both the old and new database during a transition period. The goal is to keep the application available throughout the migration, so users do not notice any interruption in service.

How it works, in theory

In a dual write migration, at time T1 an ETL job takes a snapshot of the database and begins to load this into the target, often using an intermediate staging area like Amazon S3. This process can take hours or days for very large datasets.
Figure 1: Stage source data at time T1

Also, at time T1, the database application is modified to write to both the source database and the target database in parallel, while reads continue to be served by the source.
Figure 2: Enable dual writes at T1, begin ETL to load target

After some time, the historical database load will finish, at which point the application may begin to use the target database to for both reads and writes. The source database can be retired, and the migration is complete.
Figure 3: Migration Complete

Will it work?
This approach appears everywhere. Articles on the internet, database migration guides, and even published books espouse this pattern as a simple and straightforward approach to maintaining application uptime during a database migration. But before you use this for your next migration project, carefully consider what risks this approach introduces. What questions would you ask the application owners before planning such a migration?
Share your thoughts in the comment section below. In part two, I will share what features I believe a dual write migration will require.

Series: Dual Writes for Database Migrations (2 articles)

  1. 2
    The Dual Write Pattern: Will it work for Migrating Relational Databases to NoSQL? This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article