Tech challenge · System Design

Design a clickstream pipeline for 50,000 events per second

HardSystem Design

Design a pipeline for website clickstream: 50,000 events per second at peak, about 1 KB each. Product managers want dashboards that are less than a minute behind, and analysts want full history for daily reports. Walk through ingestion, processing, storage, serving and the sizing numbers.

Think it through or sketch an answer first, then open the hint or the solution.

Show a hint

Start with the numbers: bytes per second, per day and per year. Then go stage by stage.

Show the solution

Sizing: 50,000 × 1 KB = about 50 MB/s, roughly 4.3 TB a day raw (much less compressed in Parquet). Ingest into Kafka or Kinesis, keyed by session or user so a session stays ordered. A stream processor (Spark Structured Streaming or Flink) writes a raw bronze table and computes minute-level aggregates with watermarks for late events. Store history in a lakehouse table partitioned by date; serve dashboards from small pre-aggregated gold tables or a fast OLAP store. Cover replay from the stream, idempotent sinks, monitoring of lag and data quality, and cost, for example retention tiers for old raw data.

Common mistakes

  • Designing before estimating volumes.
  • Pointing dashboards at the raw event table.
  • Ignoring late and duplicate events.

Learn more

More System Design challenges

Today's challenge and the full archive