SQL distribuido
SQL sobre Raft. Cada escritura espera a una mayoría de sus réplicas.
Esta página aún no está traducida al español.
Distributed SQL keeps transactions correct across regions, as CockroachDB does on Raft consensus.
When to place it#
Place it when your Company runs in several regions and checkouts must stay correct everywhere. It unlocks with Consensus databases. See Go global.
Skip it for traffic that a Database or Wide-column Store can serve. It is the most expensive data Component, the right store for checkouts and an expensive one for feeds.
How it works#
Its capacity is counted in transactions, and a read costs a fraction of one. Each size step doubles that capacity. Read queries, write queries, and transactions come in, and it passes none of them on to another Node.
Every write waits for a majority of its replicas. In one region that costs a few milliseconds. Spread across regions, a write waits for a cross-region round trip, so write latency rises. Reads stay local. When spread, its Burn grows with each region.
Options#
| Control | Valores | Cuándo |
|---|---|---|
| Regiones | Una / Repartidas | Dos regiones abiertas |
Regions: One keeps every write in one region, so writes pay local latency and a region outage takes the store down. Spread replicates across the open regions, so the store survives a region outage and every write waits for a cross-region round trip. It needs two open regions, and its Burn grows with each one. See Distributed SQL and leaderless stores.
How it fails#
Spread across regions, every write pays the round trip. Write-heavy kinds feel it in p99.
Overloaded, it drops queries like any data Node.
Instance failure#
Signs: The Distributed SQL card goes grey and its callout reads "The host under this VM died. It still bills." Requests sent to it are stranded.
Do now: Select the Node and click Replace. It costs Cash and comes back cold.
Prevent: Run a second Node of the Component, so one is still serving while the other is replaced.
Zone outage#
Signs: Every Node in one zone goes grey at once. A Node spread across regions keeps replicas in every zone, so only a Node on One region is hit.
Do now: Nothing speeds it up. The Node comes back when the incident ends, at most 120 sim seconds.
Prevent: Research Multiple zones, or turn on Spread under Regions.
Region outage#
Signs: One region's board goes grey. A Node on One region goes with it.
Do now: Nothing speeds it up. Spread across three regions, it survives with no data loss, because a majority remains, and needs nothing from you.
Prevent: Open a third region, then turn on Spread under Regions. Multiple regions unlocks the regions, and GeoDNS sends users to the one that lives.
Network partition#
Signs: The Network partition banner appears, and calls between regions time out. On a leader-based store the writes diverge.
Do now: Click Fence leader in the banner. See network partition.
Prevent: Research Consensus databases and use this Component: a consensus store keeps one leader, so writes do not diverge.
Operator typo#
Signs: Every Distributed SQL Node in one region goes down at once.
Do now: Place a new Distributed SQL in that region and link it. The incident ends once one Node of that Component is up again.
Prevent: Research Infrastructure as code, so a plan shows what a change removes before it runs.
Tips#
Open a third region before you count on it to survive a region outage.
Reglas#
- Cada copia adicional cuesta un 25% más que la anterior.
- Al venderlo se devuelve el 50% de lo que costó su última copia.
- Tiene 6 tamaños. Cada paso duplica su capacidad y su Gasto.