TweakCode
Design Method lessons

Estimation · Stage 2 of 3

Peak & Outlier Estimation

Size the average, then the outlier that forces a different path

Foundations

In the first lesson, averages were enough: every record cost about the same. Now, what if one participant is a million times larger than the rest, so the average hides the load that breaks the design?

Estimate three numbers separately: the average rate, the peak, usually about twice the average, and the largest single event. Averages size steady capacity, peaks size headroom, and the outlier decides whether one event needs a different path. Folding an outlier into a mean understates how long it blocks everyone queued behind it.

Take 1,000 producers, each emitting one job per second to 100 consumers: the average is 1,000 × 100 = 100,000 deliveries per second. One producer with 10 million consumers emits once, and that single event is 10 million deliveries, 100 seconds of the normal rate arriving at once. The outlier, not the average, needs its own plan.

average1 event = 10M1,000 producersQueueConsumers100,000/s1 outlier10M consumers
The average fits steady workers behind a queue. The outlier's single event equals 100 seconds of normal traffic at once, which is why it needs a path of its own.
  • Estimation

    That lesson converts product numbers into per-second rates and storage.

    Open lesson

Case Scenario

The design brief

Size a feed fanout

50 million users open home once a day. A typical user follows 200 accounts and posts once a week. One celebrity has 20 million followers.

Input
users = 50_000_000, follows = 200, posts_per_week = 1, celebrity_followers = 20_000_000
Output
[579, 1157, 16534, 20000000]

To see how one outlier can outweigh the average, consider a news feed like X's: 50 million users open home once a day, each follows 200 accounts and posts once a week, and one celebrity has 20 million followers. Ordinary fanout is about 16,500 timeline writes per second; one celebrity post is 20 million at once.

A feed average can look safe while one account creates a burst large enough to delay everyone else. Fifty million daily readers, 200 followees each, and one weekly post per user describe ordinary traffic; the account with 20 million followers describes the tail. The estimate must identify which of peak home reads, steady fanout, or one celebrity post forces a different path.

Pro

The rest of this is on Pro

The idea above is free. The walkthrough, the cost, and the practice are on Pro.