Design Clickstream Ingestion Into A Columnar Store For Metrica
Last updated: November 29, 2026
Quick Overview
Design a pipeline that ingests billions of page view and event hits per day from a web analytics counter script and makes them queryable within a minute for interactive reports with arbitrary filters and group-bys.
Yandex
November 29, 20260
0
0 solved
Design a pipeline that ingests billions of page view and event hits per day from a web analytics counter script and makes them queryable within a minute for interactive reports with arbitrary filters and group-bys.
Yandex Metrica is the product ClickHouse was originally built for, and data engineering loops expect candidates to reason about ingestion, deduplication and columnar layout at that scale. The interviewer looks for batching into large inserts, a sort key that matches report queries, and pre-aggregation trade-offs.
What the Interviewer Expects
- Collect hits at edge servers and buffer them into a durable log
- Insert into a columnar MergeTree style table in large batches, not row by row
- Choose partitioning and sort key around counter_id and date
- Deduplicate retried hits with an idempotency key
- Use materialized pre-aggregations for common reports while keeping raw data
- Address sampling, retention and multi-tenant isolation
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- One huge customer counter generates 30% of traffic; how do you keep its queries from hurting everyone else?
- How would you build visit (session) objects from hits when the session can be updated by late events?
- How would you implement GDPR style deletion of one visitor's data in an append-only columnar store?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Ingest about 50 billion hits per day (roughly 600k per second average, several million at peak), each 1 to 2 KB raw. Reports filter by one counter (site), date range and many dimensions (traffic sourc...
High-Level Design
Counter JavaScript sends hits to geo-distributed collectors. Collectors validate, enrich (geo by IP, user agent parsing, bot flag) and append to a partitioned log keyed by counter_id. Batch writers co...