Adding zero-downtime migrations strategy in a SaaS project
07-19, 10:45–11:15 (Europe/Prague), South Hall 2A

Zero-downtime migration is a technique for running database migrations without stopping the web app. As clients' databases grow larger, applying necessary updates to the database can become time-consuming or potentially break the database schema. This talk will describe problematic operation types and provide a strategy for writing and running migrations to release new software versions without downtime.


When running a web-based SaaS application, it is important to provide software updates without causing downtime for users. However, these updates often require changing the database schema with migrations. In this talk, we will discuss a solution that allows the software to remain life and able to handle incoming traffic while performing migrations.
To ensure zero downtime during this process, the old code must be compatible with the new database schema. Although this may seem easy, it often isn't. In this talk, we will cover problematic operations such as:
- renaming tables or columns,
- deleting tables or columns,
- adding new columns,
- updating all records in a table with a large amount of data.

We will discuss potential problems that may arise due to certain changes and provide corresponding solutions. Additionally, I will describe the challenges we encountered when introducing this approach to Saleor, an open-source e-commerce platform powered by Django.

While the topic and examples are from the Django project, the issue is general and can be faced by any database-related project.

The structure of the talk:
1. Background of the problem
2. Examples of operations causing the downtime
3. Introducing the zero-downtime strategy
a) Writing migrations that follow a zero downtime approach
b) Proceeding the software update without any downtime


Expected audience expertise

intermediate

I'm a Python Developer for over 4 years, currently working in Saleor Commerce. I'm developing Saleor, an rapidly-growing open-source e-commerce platform powered by Django.