Counting & Analytics

Counters, top-K, time series, and logging pipelines.

Learn the reason behind each component

5 independent guides. Each includes local concept explanations, a correctness contract, a worked failure trace, and a runnable Python learning model.

Read in this order: requirements → concepts → data flow → concurrency and failure behavior → sizing → worked example. Explain what can fail before choosing a technology.

01·Count Unique Active UsersEstimate distinct active users cheaply and understand why merging sketches is different from adding daily counts. 02·Trending Topics / Top-KFind frequent items while separating approximate frequency error from missing candidate identities. 03·Ad Click / Impression CounterCount impressions and clicks from a replayable event stream, while distinguishing provisional dashboard numbers from auditable billing. 04·Metrics / Time-Series StoreStore timestamped metric series while preserving the meaning of counters, gauges, and aggregated distributions. 05·Logging / Analytics PipelineMove structured events from applications to independent searchable, analytical, and archival sinks with a bounded loss/replay policy.

Find a guide or concept

5 guides

Designing an Ad Click / Impression Counter — A System Design Interview Guide

Count impressions and clicks from a replayable event stream, while distinguishing provisional dashboard numbers from auditable billing.

Deduplication · Bloom filters · Offsets and checkpoints · Event time and watermarks · Rollups and weighted aggregation · Transactional outbox

Designing a Unique-User Counter — A System Design Interview Guide

Estimate distinct active users cheaply and understand why merging sketches is different from adding daily counts.

HyperLogLog · Cardinality · Event time and watermarks · Offsets and checkpoints · Deduplication

Designing a Logging / Analytics Pipeline — A System Design Interview Guide

Move structured events from applications to independent searchable, analytical, and archival sinks with a bounded loss/replay policy.

Pub/sub and durable queues · Offsets and checkpoints · Write-ahead log and fsync · Backpressure and load shedding · Deduplication · Transactional outbox

Designing a Metrics / Time-Series Store — A System Design Interview Guide

Store timestamped metric series while preserving the meaning of counters, gauges, and aggregated distributions.

Cardinality · Rollups and weighted aggregation · Write-ahead log and fsync · Inverted indexes and columnar storage · Event time and watermarks · Offsets and checkpoints

Designing a Trending Top-K System — A System Design Interview Guide

Find frequent items while separating approximate frequency error from missing candidate identities.

Count-Min Sketch · Top-k candidate discovery · Time windows · Offsets and checkpoints · Cardinality

Download the Python concept models · Python 3.10+, no packages required.

Student clarity and correctness review · 19 October 2026