Database Reliability Engineering
DBRE, the database version of SRE: its principles, SLIs, SLOs, and error budgets, eliminating toil, blameless postmortems, and how it ties to DevOps.
Where DBRE comes from: SRE
Database reliability engineering (DBRE) applies the ideas of site reliability engineering (SRE) to databases: treat reliability as an engineering problem, measure it with clear targets, automate away repetitive work, and learn from every failure. It's one of the most concrete ways DevOps shows up in a DBA's job.
Site reliability engineering started at Google in 2003, when Ben Treynor Sloss was asked to run a production team. The approach was to hire software engineers and have them treat operations as a software problem. As Treynor Sloss put it, SRE is "what happens when you ask a software engineer to design an operations function." Google's 2016 book Site Reliability Engineering made the ideas widely known.
SRE and DevOps share the same goals. A common way to put it: DevOps describes what to achieve, and SRE is one concrete way to do it, with specific practices for measuring and managing reliability.
What DBRE is
DBRE brings SRE to the data layer. The term was popularized by the 2017 book Database Reliability Engineering by Laine Campbell and Charity Majors. A DBRE is still an expert in databases, but works like an engineer: automating, measuring, and designing for failure, rather than doing every task by hand.
| Traditional DBA | DBRE |
|---|---|
| Does changes by hand, carefully | Builds automation so changes are safe and repeatable |
| Protects the database by limiting access | Builds safe, self-service paths for developers |
| Aims for zero downtime, at any cost | Agrees realistic reliability targets with the business |
| Fixes incidents, then moves on | Runs blameless postmortems and fixes the causes |
| Knows the systems from experience | Measures them with metrics, logs, and traces |
The book's core principles include: protect the data above all; self-service for scale, so developers can do routine work safely without waiting; eliminate toil; databases are not special, so they're managed with the same tools and processes as everything else; and eliminate the barriers between software and operations.
Measuring reliability: SLIs, SLOs, and SLAs
Instead of "the database should never go down", which is impossible and infinitely expensive, DBRE sets measurable targets:
- SLI (service level indicator)
- A measurement of how well the service is working from the user's point of view, such as the percentage of queries that finish in under 200 milliseconds, or the percentage of successful connections.
- SLO (service level objective)
- The target for an SLI over a period, such as 99.9% of minutes healthy over 30 days. It's agreed with the business and set high enough to keep users happy, but no higher.
- SLA (service level agreement)
- A contract with customers, with penalties if it's missed. SLAs are set lower than SLOs, so the team gets warning before breaking a promise.
- Error budget
- The amount of failure the SLO allows: 100% minus the SLO. A 99.9% target over 30 days, or 43,200 minutes, allows about 43 minutes of trouble. While budget remains, the team can take risks, such as releasing changes. When it's spent, the focus shifts to reliability work until it recovers.
Eliminating toil
Toil is manual, repetitive work that scales with the size of the system and leaves nothing lasting behind: resetting passwords, refreshing test databases by hand, checking backups one server at a time, adding space when a tablespace fills up. Google's SRE teams aim to keep toil below half of each engineer's time, spending the rest on engineering work that reduces future toil.
A DBRE looks at the team's board, finds the tasks that come back every week, and automates them one by one, often with Ansible, scripts, or pipeline jobs. Each automated task frees time to automate the next one.
Incidents and blameless postmortems
Failures will happen. DBRE treats each one as a chance to make the system stronger:
- Clear incident roles, such as an incident commander who coordinates, so the people fixing the problem can focus.
- Runbooks for common problems, kept in Git and improved after each use.
- Blameless postmortems after significant incidents: a written review of what happened, why, and what will change, focused on the system and process, not on blaming people. People who fear blame hide mistakes; people who don't share what really happened.
- Action items from the postmortem go onto the backlog, so fixes actually get done.
How DBRE ties into DevOps
DBRE is DevOps applied to the database, with reliability as the main focus:
| DevOps idea | What it looks like in DBRE |
|---|---|
| Shared ownership | DBAs and developers share SLOs and on-call for the data layer |
| Automation | Provisioning, patching, backups, and failover are automated and tested |
| Everything as code | Database servers, settings, users, and schemas live in Git |
| CI/CD | Schema changes go through the pipeline, tested against realistic data |
| Measurement | SLIs, SLOs, error budgets, and the DORA metrics guide decisions |
| Learning culture | Blameless postmortems and regular failover and restore drills |
DBRE also connects to what you learned about high availability and backups: it's the discipline of proving, with metrics and regular drills, that the RPO and RTO you designed for actually hold.
In practice: the orders database's first SLO
Kofi's team has always aimed for "the orders database should never be slow". Nobody can tell whether that's being met, so they set a real target with the product owner:
- SLI: the share of order inserts that complete in under 200 milliseconds, measured from the application.
- SLO: 99.9% over each 30-day period.
- Error budget: 0.1% of inserts, roughly 43 minutes' worth of slow orders a month.
In the second week of the month, a storage problem uses 30 minutes of the budget. With only 13 minutes left, the team postpones a risky index rebuild to the next month, and spends the sprint fixing the storage alerting instead. The SLO turned an argument ("is it safe to make changes?") into a decision the data could answer.
Key takeaways
- SRE, started at Google in 2003, treats operations as a software engineering problem; DBRE applies it to databases.
- DBRE principles include protecting the data, self-service for scale, eliminating toil, and treating databases like any other system.
- Reliability is measured with SLIs, targeted with SLOs, promised with SLAs, and managed with error budgets.
- Toil is repetitive manual work; DBREs automate it away, one task at a time.
- Blameless postmortems turn incidents into lasting improvements.
- DBRE is DevOps for the data layer, with reliability as its focus.