Contribute Media
A thank you to everyone who makes this possible: Read More

The Path to Smoother Database Migrations

Summary

The Path to Smoother Database Migrations

Tuesday 4:45 p.m.--5:30 p.m.

Audience level: Experienced

Description

Migrations are often applied as part of the deploy process. For most Django applications, this is fine. However, when your data becomes large, slow migrations and locked tables can result in downtime. Running migrations outside of the deploy process helps minimize the impact. This talk will go over this and other strategies I have found successful in minimizing downtime during database migrations. Abstract The common approach and its challenges The first step: running migrations out-of-band What it means

Code deployed should work both before and after the migration is applied Step by step examples: adding a new model adding a required field to an existing model changing an existing field

The challenges introduced: More process and discipline required when developing Continuous deployment becomes more challenging

Speeding up schema migrations When running the migration with south is too slow

A showcase of pt-online-schema-change: how it works, its challenges Handling long data migrations:

The issue with running long data migrations using south: takes too long, ssh connection could be lost, no measure of progress Options (advantages and challenges of each): management command in screen background (celery) tasks: monitoring progress throttling to reduce impact on the system

Details

Improve this page