Adding zero-downtime migrations strategy in a SaaS project
- Level:
- intermediate
- Room:
- south hall 2a
- Start:
- Duration:
- 30 minutes
Abstract
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.
Description
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:
- Background of the problem
- Examples of operations causing the downtime
- Introducing the zero-downtime strategy a) Writing migrations that follow a zero downtime approach b) Proceeding the software update without any downtime