Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 12 · System Design · The questions that keep coming up · about 23 min to read

Play it as a journeyTutor comes with a plan

The top ten right now (a sketch that is small and wrong by a known amount)

Counting Clicks in Real Time
Counting Clicks in Real Time · Open board

The click pipeline growing one step at a time. This lesson works inside the box that answers “which ten are hottest right now”, and then adds a second box for “how slow is the slowest 1%”.

Before you start. Counting the crowd without a register (HyperLogLog, count-min, top-k) showed that a small structure can trade a little accuracy for a lot of memory, and Hashing gave you the fixed recipe that turns any name into a number. Counting clicks in real time (ad click aggregation and top-k) cut an endless stream into one-minute slices, and Splitting the ledger (sharding) spread one stream over many machines, so that each machine sees only a share. This lesson asks the two questions 0334 did not: how often, and how slow.

Lesson 68 of 115 in System Design

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 2010: Twitter has to explain a list
  • The honest way: one slip for every call
  • A grid of counters that strangers share: the count-min sketch
  • Wrong by an amount you can state before you start
  • Many phone banks, one wall: merging sketches
  • Right now: the sliding window
  • Not how often but how slow: percentile and p99
  • A summary that merges: the t-digest
  • Requirements, numbered
  • Out of scope, said out loud
  • Targets
  • Estimates that change the design
  • Entities and API
  • Storage, with the trade said plainly
  • The design, one requirement at a time
  • Deep dives
  • What each level adds
  • The follow-up: trending, not just popular

Terms it explains: top-k, count-min sketch, sliding window, 99th percentile, t-digest, Common mistakes, event, minute summary, idempotent, min-heap, partition, tumbling window, watermark.

Review System Design