DEV Community

Mike Coutermarsh
Mike Coutermarsh

Posted on

21 6

High traffic app that can’t take downtime - Data migration

When you can't take downtime, the “trick” to data migration is: Think small changes.

  1. New table
  2. Update writes to go to old and new
  3. Background job to migrate old data to new
  4. Move reads to new table
  5. Stop writing to old table

Each of these steps is a deploy.

Top comments (6)

Collapse
 
nholden profile image
Nick Holden

This tip is 🔥!

For Rails apps, I love using the strong_migrations gem to encourage small, safe steps like these.

Collapse
 
ben profile image
Ben Halpern

👌

Collapse
 
ritikesh profile image
Ritikesh • Edited

I would recommend checking LHM out if you're on rails. We have used it for multiple major migrations and it works like a charm.

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
mscccc profile image
Mike Coutermarsh • Edited

See on 2. Write to both tables

Collapse
 
gijovarghese profile image
Gijo Varghese • Edited

Oh sorry, I thought it only writes to new one

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay