Lesson 12 · OpenStack Production Engineer
MariaDB and Galera — The State Underneath Every Service
How OpenStack uses its database, what Galera guarantees and does not, and the failure modes that present as application errors.
Objectives
- Explain what Galera synchronous replication does and does not guarantee
- Recognise deadlock and cluster-size failures from the errors services report
- Check cluster health and interpret the state values that matter
- Explain why writing to multiple Galera nodes causes intermittent failures
The database holds everything the cloud believes
Instance records, network definitions, volume state, tokens, quotas, and placement allocations all live in MariaDB. Running workloads do not depend on it — a hypervisor keeps running regardless — but nothing about the cloud can be changed or accurately reported without it.
That split is the key to recognising a database incident: instances keep serving traffic while every API is slow or failing, and nothing can be created.
What Galera actually guarantees
Galera is synchronous multi-master replication. A transaction is certified across all nodes before it commits, so every node has the same data.
What it does not provide is conflict-free concurrent writing. If two nodes commit conflicting transactions at the same time, one is certified and the other is rolled back — and the rollback surfaces at the application as a deadlock error.
Cluster health in three values
wsrep_cluster_sizemust equal the number of nodes you have. Anything less means a node has left, and the same value on every node still needs checking — two nodes each reporting size 2 in a three-node cluster is a partition, not a healthy cluster.wsrep_local_state_commentshould readSynced.Donor/Desyncedmeans this node is feeding a state transfer to another and will be slow.Joiningmeans it is receiving one.wsrep_readymust beON. WhenOFF, the node rejects queries entirely, and clients see connection errors rather than slow queries.
Losing quorum
Galera requires a majority to accept writes. A three-node cluster that loses two nodes has one survivor, which correctly refuses to write — it cannot know whether the others are dead or partitioned away and still serving.
The result is a cloud that reads fine and cannot change anything: instance listings work, instance creation fails.
Failures as the services report them
The database rarely announces itself. It appears as errors in whichever service noticed:
| Service symptom | Database cause |
|---|---|
| Intermittent 500s across several services at once | Certification conflicts from multi-writer |
| “Deadlock found when trying to get lock” in logs | The same, surfacing directly |
| Reads work, writes fail cloud-wide | Lost quorum |
| One service consistently slow, others fine | A missing index or a query pattern specific to it |
| Everything slow, database CPU low | Connection pool exhaustion, not the database itself |
That last row misleads reliably. When every service is slow and the database looks idle, the constraint is usually the number of available connections rather than the database’s capacity to answer.
SHOW STATUS LIKE 'Threads_connected';
SHOW VARIABLES LIKE 'max_connections';
OpenStack opens a lot of connections — each service, each worker, each host. max_connections
sized for a small deployment becomes the ceiling for the whole cloud as it grows, and the failure
appears everywhere except in the database’s own metrics.
Growth that becomes an incident
Two tables grow without bound unless something removes rows, and both are database-level problems that present as cloud-level ones:
Deleted rows. OpenStack soft-deletes. Instance records, network records, and volume records accumulate for the life of the deployment, slowing every query that scans them. The archive and purge tooling exists for this and is frequently never run.
Token tables, on deployments predating Fernet. Modern deployments do not have this problem; long-lived ones that were upgraded sometimes still carry the table.
The symptom of both is a cloud that has become gradually slower over months with no change to explain it.
The diagnostic path
- Are workloads affected or only the control plane? Instances fine, APIs failing points here.
wsrep_cluster_sizeon every node — and compare them. Disagreement is a partition.wsrep_local_state_commentandwsrep_readyon the node being written to.- Reads working, writes failing? Quorum.
- Deadlock errors in service logs? Check whether the load balancer sends writes to one node.
- Everything slow, database idle? Connection count against
max_connections.
Exercise
Check wsrep_cluster_size and wsrep_local_state_comment on every node, not just one — the
disagreement between nodes is the thing worth seeing.
Then examine your load balancer configuration for the database and establish, definitively, whether
writes go to one node or several. Confirm it from the database side by comparing
Threads_connected across nodes: a single-writer configuration shows connections concentrated on
one node, and anything close to even distribution means you are running multi-writer, whatever the
configuration was intended to do.
Verification status
This resource has not been executed end to end in a lab environment. Commands and configuration are reviewed by an engineer, but treat them as reference rather than as a tested procedure.
Author
James Joyner
Builds and operates the infrastructure layers underneath production AI systems.
James founded Inside The AI Stack to publish the kind of infrastructure and operations material he wanted while running production systems: specific, tested where it claims to be tested, and written by someone who has had to fix the thing at 3am. He works across AI infrastructure, private cloud, and platform engineering, and reviews every technical resource published here before it is marked as verified.
- AI infrastructure
- OpenStack operations
- Kubernetes
- Terraform
- Linux systems engineering
- Observability
Primary sources
- Galera Cluster documentation — Codership
- MariaDB Galera Cluster — MariaDB Foundation
Continue from here
Related resources chosen because they are the next thing you would actually need — not because they share a keyword.
OpenStack Production Operations
Operating OpenStack in production: service state versus status, the message bus, placement disagreements, and the quiet failures that keep dashboards green.
Control Plane Architecture
How OpenStack services communicate, why the message bus and database are the real dependencies, and what each service actually owns.
OpenStack Production Engineer
A sequenced learning path for engineers who operate OpenStack in production — architecture, service-by-service depth, deployment, and troubleshooting under pressure.
Newsletter
Inside The AI Stack Brief
A practical weekly briefing on AI engineering, infrastructure, production operations, and the technologies powering the AI stack.
One email a week. We send a confirmation link first and never mail an address that has not confirmed. No sponsorship placements inside the technical sections, and an unsubscribe link in every issue.
