The idea to keep with you
When a single bottleneck threatens end-to-end availability, decompose 1-hour sliding windows into sixty 1-minute tumbling HLL + CMS sketches so workers merge fixed kilobyte arrays in <1 MB RAM.
TL;DR30-second simplified summary▾
At 1M events/sec across 50M unique IDs, exact HashSets across 60 overlapping panes hit 18 GB/pod (OOMKilled 137). Decomposing the 1-hour window into 60 1-minute tumbling HLL (16 KB) and Count-Min + Min-Heap (256 KB) panes cuts state to <1 MB/shard, isolates whale tenants, and shrinks checkpoints to <150 ms.
Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
HyperLogLog & Count-Min Sketch (Streaming Sketches)
HyperLogLog tracks max leading-zero runs across m registers to estimate distinct counts in ~1.5–12 KB, while Count-Min Sketch uses d hash rows x w counters to bound item frequencies in sub-megabyte RAM.
Bloom Filters, Counting Bloom & Cuckoo Filters
Bloom filters answer set membership in O(k) bit probes using ~10 bits per key at a 1% false-positive rate with zero false negatives, while Cuckoo filters store compact fingerprints in 2-choice hash buckets to support safe item deletion and better CPU cache loc...
Spark Structured Streaming & Watermarking
Spark Structured Streaming models unbounded streams as continuously appended tables. Event-time watermarks bound how long in-memory or RocksDB state is retained for late-arriving records, enabling fault-tolerant stateful aggregations and Kafka-to-Lakehouse pip...
Full walkthrough · 7 stages
01
L4 · FUNDAMENTALS
.
02
L4 · FUNDAMENTALS
.
03
L5 · APPLIED DESIGN
.
04
L5 · APPLIED DESIGN
.
05
L6 · SCALE & TRADE-OFFS
.
06
L6 · SCALE & TRADE-OFFS
.
07
L7 · STAFF / PRINCIPAL
.
Practice · Explain the consequences
Practice: Make the trade-off yourself.
Question 1 of 3
Score: 0/3Tenant A sends 900K events/sec while Tenant B sends 100 events/sec into a single shared Count-Min Sketch. Why does Tenant B's frequency estimate become wildly inaccurate?
Recommended Learning Flow