Bugpit

Lessons › From one user to millions

SQL that grows by itself

A bank-like app: 30,000 req/s and 30% are writes, 9,000 a second. Your orders need joins and real transactions, so NoSQL is out, and nobody wants to run sixteen shards by hand.

Play this level

Free with an account. It runs in your browser: build the design, press Run, and watch what breaks.

The lesson

Sharding works, but you own it: rebalancing, cross-shard joins, and a fresh plan each time you grow. NoSQL removes the work and gives up joins.

Distributed SQL such as Spanner or CockroachDB aims to keep both. Data splits across nodes by itself, and adding a node adds write capacity.

Each write waits for a majority of copies to agree, so writes are slower. Google's estimate is up to 22,500 reads or 3,500 writes a second per node, and they say not to size from it. Load test first.

What you have to achieve

30,000 requests a second at the busiest hour, 30% of them writes.

What you learn

You kept joins and transactions and dropped the shards. The price is a slower write and a bigger bill per node, and it's why plenty of big companies still run plain Postgres for as long as they can.

Check yourself

What does distributed SQL keep that NoSQL gives up?

Show the answer

Joins and real transactions. It splits data across nodes by itself and still supports joins and transactions.

Why are its writes slower?

Show the answer

Each write waits for a majority of copies to agree. Agreement across copies keeps data safe and consistent, and it costs time on every write.

Try it yourself

More in From one user to millions

← Numbers as they happen People you may know →