Skip to content
All articles

System Design · Estimation

40 million users is 69 writes a second

Back-of-envelope estimation takes four minutes and tells you whether a design needs one database or forty. Forty million users placing 0.15 orders a day need one primary with replicas.

· 4 min read

An estimation worked step by step. 40,000,000 users times 0.15 orders is 6,000,000 orders a day. Divided by 86,400 seconds in a day, that is 69 writes a second, and 347 at peak. At 40 reads per write, reads are 2,778 a second and 13,889 at peak. 6,000,000 orders a day times bytes per order times 365 days gives 12,238 GiB a year. Verdict: one primary, several replicas and a cache for reads, not forty databases. One well-configured Postgres takes these writes easily.

"Forty million daily users" sounds like a system that needs sharding, a queue in front of everything and a capacity meeting. Four minutes of arithmetic says otherwise.

The estimate

The course's order system has 40 million daily active users who place 0.15 orders each per day:

orders per day           6,000,000
write QPS (average)      69      peak 347
read QPS (average)       2,778   peak 13,889
storage                  12,238 GiB over 365 days
write bandwidth          16.7 Mbps at peak
-> one primary, several replicas, a cache in front of reads

Sixty-nine writes a second, 347 at peak, is a load a single well-configured Postgres instance handles without effort. It comes from a system with forty million users, which is exactly the intuition the arithmetic corrects. Most systems that feel large are not, and the ones that are large are usually large in one dimension rather than all of them.

Five multiplications, in order

  1. Users × actions per user = actions per day.
  2. Actions per day ÷ 86,400 = average QPS.
  3. Average QPS × peak factor = peak QPS.
  4. Actions per day × bytes per action × retention = storage.
  5. Bytes per day × 8 ÷ 86,400 = average bandwidth, and the peak factor turns it into peak bandwidth.

Round aggressively. The answer you want is the exponent, not the digits, because the order of magnitude is what decides whether this design needs one database or forty.

Think Like an Engineer

Read the two lines separately. Writes stay small enough for one primary. Reads, at 40 for every write, are what the replicas and the cache are for. Estimate each dimension on its own before deciding which one the architecture has to scale.

Keep the numbers next to the diagram

Estimation is one of four questions the course asks before anything is drawn: which operations must work, how many and how skewed, what must be strongly consistent, and what failure costs. Write the answers beside the diagram, so that a changed answer shows which boxes it moves.

Suppose a stakeholder decides that order status must be strongly consistent after all. Reads move off the replicas onto the primary, so the 40:1 read-to-write ratio lands on one instance, unless you add a consistent-read mechanism, which costs latency. The cache in front of reads stops being usable for status unless it gains write-through invalidation, which is a consistency problem of its own. And 13,889 peak reads a second become a primary-database number rather than a fleet number. One answer changed, and three boxes did.

Get one diagram a week

A short article built around one engineering diagram, from the same library as these courses.

One diagram-led article a week on AI and systems engineering. We email you once to confirm, and every newsletter has an unsubscribe link. Privacy policy