Skip to content
Lesson 37

Back-of-the-envelope estimation

Ten minutes and a few round numbers: turn guests into requests per second, storage and bandwidth, find the peak, compare with what you run, and attach a decision to every number.

The lesson in text

Click a paragraph to hear it.

01Ready for 10×?

Wednesday afternoon. Karim, our CTO, has an investor meeting on Friday. Slide 9 of his deck says: "StayHub is ready for 10× growth." That's 300,000 guests a day instead of 30,000. He asks you a simple question: is it true?

The honest first answer is: no idea. A proper load test, where you push fake traffic at the system until it struggles, takes weeks to do well. Karim has two days.

Lina, our senior engineer, says we don't need weeks to know whether it's 4 servers or 40. We need ten minutes and a napkin. That's a back-of-the-envelope estimate, and it's what this lesson teaches you.

02A wedding venue

Think of booking a wedding venue. You don't need the final guest list. About 150 guests, at roughly a square metre and a half each with the tables: you need a room of a bit over 200 square metres. Not 50, and not a stadium.

Being off by 20% doesn't change the venue. Being off by ten times does. That's the whole idea: aim for the right order of size, tens, hundreds or thousands, not the exact number.

And you staff the bar for the toast, when everyone wants a glass at the same moment, not for an average hour. Systems are the same: they fall over at the busiest moment.

03Guests to requests per second

Let's start with traffic. The chain is always the same. Guests a day, times requests per guest, gives requests a day. Then divide by the seconds in a day.

A day has 86,400 seconds. For estimates, round it to 100,000. That's about 16% off, but your inputs are rougher than that, and it keeps the maths in your head. One million requests a day is about ten a second.

Today StayHub has 30,000 guests a day, and the logs say each one makes about 40 requests: searches, hotel pages, prices. That's 1.2 million requests a day, so about 12 a second.

At ten times: 300,000 guests, 12 million requests a day, about 120 a second on average. And write the assumptions at the top, so anyone can challenge "40 requests" without redoing your maths.

From guests to requests per second
Assumptions: 40 requests per guest (logs) · a day ≈ 100,000 swritten on top
Today: 30,000 guests × 40 = 1,200,000 requests a day
1,200,000 ÷ 100,000 ≈ 12 requests a secondtoday's average
10×: 300,000 guests × 40 = 12,000,000 requests a day
12,000,000 ÷ 100,000 ≈ 120 requests a secondthe 10× average
A day is rounded to 100,000 seconds (really 86,400). The assumptions go on top, so people argue about “40 requests”, not about your arithmetic.

04Design for the peak

But nobody books a hotel at four in the morning. Traffic follows the day. The evening is about three times busier than the average: 360 requests a second.

Then there are campaigns. When Maya sends a sale email, traffic jumps to about ten times the average: 1,200 requests a second. That's the number StayHub must survive, not 120.

That multiplier is called the peak factor. It's an assumption too, so write it down: about three for the daily rhythm, ten or more for a sale. Design for the peak, because the average never takes anything down.

The average, and the moments that matter (at 10×)
MomentPeak factorRequests a second
Average over the day× 1120
Evening× 3360
Sale email× 101,200
Systems fall over at the peak. The sale email is a known, repeating event, so it's the number StayHub designs for.

05Compare with what you run

Now compare each number with what you have. Omar, our on-call engineer, load-tested one app server last month: it handles about 400 requests a second on StayHub's pages. StayHub runs 4 of them.

At the sale peak, 1,200 divided by 400 is 3 servers fully busy, out of 4. Sounds fine. Now ask what happens if one crashes in the middle of the sale. The 3 left are at exactly their limit: no room for a deploy, a slow query, or bad luck.

So the decision: run 6 servers on sale days. Each one then carries 200 requests a second, half its capacity, and losing one still leaves room. Two extra servers, for a few days a year.

Then the database. After the cache, each request makes about one database query: 1,200 a second at the peak. Writes are smaller. At ten times, 25,000 bookings a day, about ten rows each, is 2.5 writes a second, and 25 at the sale peak. One PostgreSQL server handles thousands of simple queries a second. So no sharding, no splitting the data across machines, no new database.

Compare each number with what you run, then decide
PartAt the 10× sale peakWhat we haveDecision
App servers1,200 req/s ÷ 400 = 3 busy4 (only 3 left if one crashes, at 100%)Run 6 on sale days: 200 each
Database reads≈ 1 query per request: 1,200 a secondOne PostgreSQL + a replicaFine as it is
Database writes25,000 bookings × 10 rows ÷ 100,000 s = 2.5/s; × 10 = 25/sOne PostgreSQL primaryNo sharding, no new database
Rough capacities: Omar's load test (one app server ≈ 400 requests a second on StayHub's pages); one PostgreSQL server handles thousands of simple queries a second.

06Count everything you write

Storage goes wrong in a different way. Omar remembers a Sunday last spring, at ten past three in the morning. The main database's disk was full.

The sizing document had said: bookings grow about one gigabyte a year, so a 250-gigabyte disk is plenty. The arithmetic was right: 2,500 bookings a day, one kilobyte each, is under a gigabyte a year.

But nobody had counted the audit log: a line of about 500 bytes for every request, kept in the same database. 1.2 million requests a day, times 500 bytes, is 600 megabytes a day. Over a year, about 220 gigabytes, on a 250-gigabyte disk.

A full disk isn't a slow-down. It's a cliff. Every write fails, bookings included, and the database can stop completely. Omar spent two hours, at three in the morning, deleting old rows.

So the rule: estimate everything you write, not just the data you care about. Logs, indexes and copies often outgrow the business data. At ten times, that audit log would be 6 gigabytes a day, over 2 terabytes a year. Decision: move it out of the database, into cheap file storage.

Count everything you write
What growsPer dayPer yearAt 10× (per year)
Bookings: 2,500 × 1 KB2.5 MBunder 1 GBabout 9 GB
Audit log: 1.2M requests × 500 B600 MBabout 220 GBover 2 TB → move to file storage
The bookings estimate was right. The audit log, which nobody listed, filled the 250 GB disk at 03:10 on a Sunday: every write failed until old rows were deleted.

07Bytes and bits

One more number: bandwidth, the bytes flowing out every second. At ten times, guests open 1.2 million hotel pages a day, each with 8 photos of about 200 kilobytes. That's about 1.9 terabytes a day.

Divide by 100,000 seconds: about 19 megabytes a second on average, and about 60 in the evening peak. Now the trap. Network links are sold in bits, and a byte is 8 bits. 60 megabytes a second is 480 megabits a second: half of a one-gigabit link.

So the photos must keep coming from the CDN, the copies close to the guests, never through our own servers. Mixing up bits and bytes is an eight-times mistake: exactly the size of mistake that changes a design.

Photo bandwidth at 10×, in bytes and in bits
1,200,000 pages × 8 photos × 200 KB ≈ 1.9 TB a daybytes out
1.9 TB ÷ 100,000 s ≈ 19 MB a secondaverage
× 3 in the evening ≈ 60 MB a secondpeak
60 MB/s × 8 = 480 Mbit/shalf of a 1 Gbit/s link
→ photos from the CDN, never through our serversdecision
Links are sold in bits, storage in bytes: 1 byte = 8 bits, so 1 Gbit/s ≈ 125 MB/s. Half a server's link for photos is why they stay on the CDN.

08Every number needs a "so what"

Look at what ten minutes gave us. Every number came with a decision: 6 servers on sale days, the audit log out of the database, photos on the CDN, and no new database. A number with no "so what" is decoration.

Omar isn't fully convinced. Estimates are good to a factor of two or three, he says. What if one server really handles 150 requests a second, not 400? Then a sale keeps 8 servers busy, and you'd want about 10.

They're both right. Karim's slide says what the estimate shows, with its assumptions: two more servers on sale days, and the audit log moved. And a real load test runs before the summer sale, the event the estimate is about. Estimate to decide, test to confirm.

Shortcuts worth remembering
ShortcutValueUse it for
Seconds in a day86,400 ≈ 100,000Requests a day → requests a second
1 million requests a day≈ 10 a secondSanity-check any traffic claim
Peak factor≈ 3× daily, 10×+ for a saleThe number to design for
KB, MB, GB, TBEach one is 1,000 × the previousStorage per year
1 Gbit/s≈ 125 MB/sBits versus bytes
One app server (StayHub)≈ 400 requests a secondHow many servers, plus one spare
Use them for the order of size, decide, then confirm with a load test before the big event. Estimates are typically good to a factor of two or three.

09Your job as lead

When you lead Claude Code, ask for a one-page estimate before any infrastructure change. Assumptions at the top, each with its source: measured in the logs, or assumed. And every formula with its units.

Then check it the way Omar would. Is it sized for the peak, with one server down? Did it count everything that grows, logs included? Are bits and bytes kept apart? And does every number end with a decision?

Redo one line yourself: 300,000 guests times 40 requests, divided by 100,000 seconds, is 120 a second. If you can redo it in your head, you can challenge it. In the next lesson, you'll use all of this to design a whole service: short links for StayHub.

Check yourself

0/10 answered
  1. 1A site gets 5 million requests a day. Roughly how many is that per second, on average?

  2. 2Why is it fine to round 86,400 seconds to 100,000?

  3. 3At 10×, StayHub averages 120 requests a second, and a sale email brings ten times the average. Which number do you design for?

  4. 4Claude Code's estimate says: "Peak load 120 req/s. 4 servers × 400 req/s = 13× headroom. No changes needed for 10×." What do you ask for?

  5. 5During a 1,200-requests-a-second sale, one of StayHub's 4 app servers (400 a second each) crashes. What happens?

  6. 6The sizing doc said bookings grow about 1 GB a year, yet the 250 GB database disk filled up. What was missing from the estimate?

  7. 7A network link is rated 1 Gbit/s. About how many megabytes per second can it carry?

  8. 8Claude Code proposes sharding the bookings database "to be ready for 10×". The estimate says 25 writes a second at the sale peak. What do you answer?

  9. 9What is a peak factor?

  10. 10Omar says: "What if one server really handles 150 requests a second, not 400?" What's the best way forward?

Free account

Save your progress — create a free account

Free. No card. Your finished lessons follow you to any device, and you can ask questions in the community.

Create my free account
Founding members

Every lesson is free while we build. Lock in €9/month for later.

The first 100 members keep the founding price for as long as they stay. Reserving is free: no card, nothing is charged.

See the founding offer

Questions from the community

All questions →