Card 02/ 07

ExampleDifficulty: Intermediate2 min

Heuristics Example: A Global News Site

Readers everywhere, each article read a million times and written once.

Reading a brief for its pressures, and taking the pattern each points to, gives a first design in minutes. This example reads a global news site that way: four pressures, four heuristics, and the design they add up to.

The brief. A news site with readers on every continent. Editors publish about 200 articles a day; each popular article is read a million times. Pages must load in under a second anywhere. On the night of a big story, traffic rises tenfold within the hour.

From pressure to pattern for the news site
Pressure in the briefHeuristicPattern
Readers worldwide, pages under a secondLatency and global usersA CDN in front of pages and images
A million reads per article, 200 writes a dayReads and a database bottleneckA cache between servers and database
Tenfold traffic within the hourLoad that rises and fallsStateless servers, autoscaled
The site down means no readersA core part that can failTwo of everything on the request path

The design that results. Readers reach the nearest CDN location, which serves most pages and every image without touching the origin. What it misses goes to a load balancer in front of stateless application servers, autoscaled on processor use. They read from a cache first, and the database only on a miss. Every part on that path has a spare.

Checking the guesses. The cache is worth it because reads repeat: a million reads of each article means almost every one is a hit. The CDN is worth it because most of each page is the same for every reader. Autoscaling is enough because the rise takes an hour, not seconds.

What the reading leaves out. No queue: writes are 200 a day, so nothing needs absorbing. No sharding: 200 articles a day fits one database for decades.

So a read-heavy, global brief is answered mostly at the edge and in the cache, and the heuristics that do not apply keep out parts that nothing needs.