← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 043 · Messaging and event-driven systems

Design Clickstream Analytics

Medium 50 min

A retail company wants to understand how shoppers use its website and mobile apps. Tracking SDKs record page views, clicks, searches and add-to-basket events, batch them on the device and send them every few seconds. At peak the fleet produces 200,000 events per second, arriving as about 10,000 batched requests per second. Product managers want a live dashboard of active users and top pages that is no more than 10 seconds behind, and analysts want complete, de-duplicated daily reports by 06:00 the next morning. Collection must never slow down the apps, and a burst of traffic or a slow downstream system must not lose events.

Functional requirements

  • Accept batched events from web and mobile SDKs over HTTPS
  • Show live counters (active users, top pages, conversions) per minute
  • Produce daily reports by country, device and campaign
  • Let analysts run ad-hoc SQL over at least 13 months of history
  • Replay raw events to rebuild a report after a bug fix

Non-functional requirements

  • Collection endpoint answers in under 200 ms at p95 and never blocks the app
  • Live dashboard lags real time by no more than 10 seconds
  • No accepted event is lost; duplicates from SDK retries are removed in reports
  • Storage cost grows linearly and cheaply with event volume

Constraints and scale

  • 200,000 events per second at peak, in about 10,000 batched requests per second
  • Average event size 1 KB, so about 8 TB of raw events per day
  • 13 months of history kept for analysts

You will practise

  • Decouple ingestion from processing with a durable, replayable stream
  • Combine a speed layer for live counters with a batch layer for exact reports
  • Choose storage tiers (object storage, warehouse, time-series) by access pattern and cost
Show 3 hints
  1. What should the collector do with an event the moment it arrives, and nothing more?
  2. Live counters can be approximate; daily reports cannot. Do they need the same pipeline?
  3. SDKs retry on timeouts. How will you spot the same event arriving twice?

Ready to build?

Open the canvas, place your components and explain your decisions. Your draft saves automatically.

Sign in to start

Failure scenarios

  • The warehouse loader stalls for six hoursA schema change breaks the job that loads events into the warehouse. Nobody notices until morning, and the daily report is missing most of yesterday.

Run them from the workspace once your design is in place.