Distributed SQL
SQL on Raft. Every write waits for a majority of its replicas.
What it does#
Distributed SQL stands for CockroachDB: SQL with transactions across regions, built on Raft consensus.
It takes read queries, write queries, and transactions. It sends nothing on. Its capacity is counted in transactions, and a read costs a fraction of a transaction. Each size step doubles its capacity.
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.
When to place it#
Place it when your Company runs in several regions and checkouts must stay correct everywhere. It is the right store for checkouts, and an expensive one for feeds. It unlocks with Consensus databases. See Go global.
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.
It is the most expensive data Component. Do not place it for traffic that a Database or Wide-column Store can serve.
It also prevents failures:
Spread across three regions, it survives a Region outage with no data loss, because a majority remains.
It makes a Network partition less harmful: a consensus store keeps one leader, so writes do not diverge. Fence the old leader to end the incident. See network partition.
Tips#
Open a third region before you count on it to survive a region outage.
Rules#
- Each further copy costs 25% more than the one before.
- Selling it refunds 50% of what its last copy cost.
- It has 6 sizes. Each step doubles its capacity and its Burn.