System Design · Module 16
Analytics and counting at scale
- Lessons
- 14
- Free
- 0
- Reading
- ~5 h
Your progress
0 / 14 lessons done
Sign in to trackLessons
- Large-scale counting: why it gets hardAnalytics counters often share infrastructure with customer requests. Understanding their write paths helps you keep reporting useful without slowing the product or silently changing what a count means.
- View counting: accuracy vs speedProduct badges and seller reports can use the same events but need different freshness. Counting them safely means separating what happened, what was accepted, and what the screen currently shows.
- Impression counting for adsAd counts affect advertiser spending and seller trust. You need to explain what was measured, prevent duplicate contributions and preserve enough evidence to investigate disagreements.
- Raw events vs pre-aggregated metricsDashboards need fast answers, but investigations need details. The data you discard determines which questions you can answer later and which mistakes you can repair.
- Time-window aggregation: per-minute, hourly and daily countsSales dashboards and operational reports group events by time. Their answers depend on timestamp choice, late-data rules and how corrections reach stored totals.
- HyperLogLog: estimating unique counts with little memoryDistinct-customer dashboards can consume more memory than ordinary counters. HyperLogLog lets you estimate large audiences with bounded state, provided you accept its accuracy and query limits.
- Count-min sketch: approximate frequency countsHigh-volume analytics often needs approximate frequencies without a counter entry for every distinct key. A count-min sketch bounds that memory, but its error depends on total traffic rather than an individual item’s count.
- Top-k: finding the most frequent itemsPopular-product lists and traffic dashboards need item identities, not just frequency estimates. Their correctness depends on candidate selection, memory limits and how counts are combined.
- Reservoir sampling: unbiased samples from a streamYou often need examples from a stream that is too large to retain in memory. Reservoir sampling bounds the sample size without requiring the final event count.
- t-digest: accurate percentiles with little memoryLatency dashboards need distribution information without retaining every measurement in memory. Understanding t-digest helps you choose its settings and avoid treating an estimate as a guarantee.
- Streaming percentiles: p95 and p99 in real timeLatency dashboards can hide slow customers even when every calculation looks reasonable. You need to preserve the right distribution, time window and measurement population before p95 or p99 can guide an operational decision.
- Mergeable sketches: combining results across serversAnalytics workers often summarize different parts of the same dataset. Combining those summaries correctly requires both a valid merge operation and a precise record of what each worker processed.
- OLTP vs OLAP: transactional vs analytical workloadsA report can slow checkout without changing a single order. Understanding workload differences helps you protect customer requests without building an unnecessary data platform.
- Design: an ad click aggregatorProduct analytics often become evidence for business decisions. You need to explain not only how quickly a count updates, but also what it counts, how it survives failures, and how it can be corrected.
Practise with
Terms this module teaches 32
Open glossaryAd impression
A measured ad-delivery event at a specified counting boundary, commonly beginning to render. It does not by itself establish viewability or billing eligibility.
Additive error
An error allowance expressed as an amount added to or subtracted from a true result, rather than as a percentage of that result.
Aggregation grain
The exact combination of fields and time boundaries represented by one aggregate row.
Centroid
A weighted mean representing a group of observations. In a t-digest, its weight records how many observations it represents.
Click identity
A stable identifier for one countable ad interaction, preserved across delivery retries.
Count reconciliation
Comparing source contributions and aggregate results using the same rules and a fixed input boundary.
Count-min sketch
A frequency summary that updates one shared counter per row and estimates a supplied key’s count using the minimum selected counter.
Counter stripe
One independently updated partial total belonging to a larger logical counter. Reading the logical counter requires combining its stripes.
Deduplication
Recognising repeated copies of the same logical item and preventing them from affecting a result more than once.
Dimension
A field used to divide measurements into groups or filter report results.
Event receipt
A stored record that an identified event has already affected a particular result. Saving it atomically with that effect makes replay safe.
Grain
The precise meaning of one row in a dataset, such as one order or one order line item.
HyperLogLog
A probabilistic sketch that estimates the number of distinct values using hash-derived register maxima.
Invalid traffic
Traffic excluded from measurement under a defined validation policy, including some automated or manipulated activity.
Mergeable sketch
A compact statistical summary that can combine with compatible summaries to represent their combined inputs under the algorithm’s merge rules.
Min-heap
A tree-shaped data structure in which every parent compares no greater than its children, placing a minimum entry at the root.
Online analytical processing
A workload that processes substantial datasets to answer analytical questions using scans, joins and aggregation.
Online transaction processing
A workload of small operational reads and writes that need correct changes and predictable response times.
Pre-aggregation
Combining records into stored summary values before a report requests them.
Raw event
A record describing one occurrence before it is combined into reporting totals.
Reporting generation
An isolated set of computed results and recovery state produced by one version of a reporting computation.
Reservoir sampling
Maintaining a fixed-size uniform sample of stream positions without knowing the final stream length.
Sampling without replacement
Selecting a sample in which an individual population position cannot be selected more than once.
Sketch
A compact summary that answers selected questions about data, often approximately.
Sketch manifest
A recorded selection of snapshot references identifying the inputs used to build one aggregate result.
Space-Saving
An insertion-stream algorithm that tracks a bounded set of item identities with estimated frequencies and error allowances.
t-digest
A compact summary of numerical observations that uses weighted centroids to estimate quantiles, with extra resolution near the distribution’s tails.
Time pane
A short time interval with its own aggregate, combined with other panes to answer a larger window query.
Top-k
The k items with the highest values under a specified ranking rule.
Tumbling window
A fixed-width time interval that does not overlap adjacent intervals, with each event assigned by its timestamp.
Viewable impression
An ad impression meeting the exposure conditions defined for its format and environment. It represents an opportunity to see the ad, not proof of attention.
Window trigger
A rule that decides when a window produces a result, separately from the rule assigning events to that window.