Skip to main content

Discord's automation playbook for running ScyllaDB at scale

· Do Minh Tuan · Developer Corner 💻

Discord's automation playbook for running ScyllaDB at scale

Discord has published how it rebuilt database operations around automation, using an internal framework called the Scylla Control Plane, or SCP. ScyllaDB is the fast, distributed NoSQL database behind a lot of what Discord does, and running it at their size used to mean a lot of manual work.

That manual work is the part I recognise. Provisioning a cluster, adding nodes when traffic climbs, keeping replicas in sync, recovering from a failure at 2am. Each task is doable. Together they eat weeks, and they only get harder as the cluster grows.

The detail in Discord's write-up that I keep thinking about is not the tool. It is the change from imperative to declarative operations.

The difference that actually matters

Imperative means you describe the steps. Add a node, wait, rebalance, verify, update the config, restart. It works, and it puts the entire procedure in somebody's head. When that person is on holiday, the procedure is on holiday too.

Declarative means you describe the end state. This cluster should have this many nodes, this replication factor, this much capacity. The system works out the steps.

That sounds like management jargon until you have lived through the alternative. With manual steps, every change is an opportunity to skip one. With a declared state, the question changes from 'did we run all the commands correctly' to 'does the cluster match what we asked for', which is a question a machine can answer continuously.

It also changes who can operate the system. A junior engineer can change a number in a config. They cannot safely improvise a rolling replacement of database nodes under load.

As described, the control plane handles the full lifecycle: standing up new ScyllaDB instances, expanding clusters, managing replication, and coordinating disaster recovery. Some of those tasks took days of manual effort before, and now run as a routine operation.

The replication piece deserves a plain explanation for anyone outside infrastructure. Replication means keeping multiple copies of the same data on different machines. If one machine dies, another already has the data and users do not notice. The hard part is keeping the copies consistent while writes keep arriving, and deciding what to do when a copy falls behind.

That work is exactly the kind of thing that should be automated and almost never is, because it is invisible when it goes right and catastrophic when it goes wrong.

What stands out in the story is that Discord's infrastructure team is small relative to the system it runs. That is the real return on this kind of investment. Automation saves time, and it changes the ratio of people to machines, which I think is the only way a small team can operate something large without burning out.

I think the opposite pattern shows up in smaller companies, and it is expensive in a quieter way. One senior engineer becomes the human control plane. Everything works, until they leave, and then the company discovers that the cluster's operating manual was a person.

Automation has a failure mode that rarely gets mentioned. If you automate a process you do not understand, you have simply made the mistakes faster and harder to trace. What worries me is the team that automates first and understands later. I distrust any automation plan that does not start with a written manual procedure.

So the order matters. Document the manual procedure first, run it a few times, watch where it breaks, and only then encode it. The teams that skip that step end up with scripts nobody trusts and a manual process running alongside them, which is the worst of both worlds.

The second mistake is automating the wrong thing. Provisioning is fun to automate because it is visible. Backups and restore tests are boring, and they are what saves you. If I had to pick one thing to automate first in a small company, it would be the restore, not the deploy.

The full SCP is a large piece of internal engineering that most companies will never build. The principle is available to anyone.

Start with infrastructure as code. Terraform for cloud resources, Ansible or similar for configuration. The specific tool matters less than the version history, so you can see what changed and roll it back.

Then pick the task your team does most often and automate that one. I would bet it is environment setup or deploy for most teams, not database scaling. A small script that stops idle development servers at night saves real money and, more importantly, builds the habit.

And write down the runbook even after you automate. Automation fails in ways the person who wrote it did not anticipate, usually at the least convenient moment.

The part I am skeptical about

Stories like this are usually told after the fact, and my guess is they skip the year of debugging. I suspect the first version of an internal control plane is worse than the manual process, and plenty of teams abandon it halfway. Discord had the engineering depth to push through that phase. A twenty-person company often does not, and should buy a managed database instead of building a control plane.

I mean that as a warning about copying the conclusion without the constraints, not as a criticism of Discord. The right question is which of our manual operations is expensive enough to justify automation, and whether we can afford the first six months where it is worse. I would ask any team pitching a control plane to show me the rollback plan first.

For a team in Vietnam running infrastructure for overseas clients, the answer is often a managed service with a clear SLA, plus a documented runbook. That gets you most of the reliability for a fraction of the engineering.

The open question is whether the declarative model reaches the boring parts. Anyone can demo scaling a cluster. I want to know how the system behaves when a node is half-dead, the network is flapping, and the desired state cannot be reached. That is a test I would run before trusting any control plane with a production cluster.

Written with AI assistance, reviewed and edited by Do Minh Tuan.