Performance

2 posts in this section

Design a Stock Exchange

Every design in this series so far has scaled out. More partitions, more replicas, more nodes.

This one scales in.

The fastest exchanges in the world run almost everything — order manager, matching engine, market data publisher — on a single server, sometimes in a single process. Not because they can’t afford more machines, but because the network hop between two machines costs more than the machine does.

That inversion is what makes this chapter worth reading. Everything you’ve been taught about distributing work stops applying when a round trip costs more than your entire latency budget.

Continue reading »

Back-of-the-Envelope Estimation: The Art of Making Smart Guesses

Imagine your interviewer says: “We’re designing Instagram Stories. How much storage do we need per year?”

Most junior engineers freeze. They don’t know where to begin. They feel like they need exact numbers — the real database size, the real compression ratios, the real usage stats.

Here’s the secret: you are not supposed to be exact. You are supposed to be directionally correct.

Back-of-the-envelope estimation is the skill of producing a reasonable answer in 2–3 minutes using simple math and a handful of memorized numbers. Google’s Jeff Dean calls it:

Continue reading »