Netflix Clickstream Pipeline + Trending Movies Dashboard
Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2024-05-12
Problem Statement
Design a real-time data pipeline for ingesting Netflix clickstream events, and build a dashboard that, every hour, shows the top trending movies per location.
Only count views where the entire movie has been watched (full watch criteria) to qualify as a valid view.
🎯 Functional Requirements:
1.Clickstream Event Collection
•Collect events like play, pause, seek, stop, complete, etc., from various devices.
2.Event Filtering
•A view is considered valid only if the user watched 100% of the movie duration (configurable threshold like 95–100%).
3.Geo Tagging
•Each event must be tagged with the location (country/state/city) of the user/device.
4.Aggregation Job (Hourly)
•Every hour, aggregate:
•Number of valid views per movie
•Grouped by location
•Output: List of top N (e.g. 10) trending movies per location.
5.Dashboard
•Real-time or near-real-time dashboard to:
•Select location
•View top movies by hour
•Drill down into movie details (optional)
⚙️ Non-Functional Requirements:
•Handle high throughput (millions of events/hour)
•Exactly-once or idempotent processing of events
•Low latency (dashboard should update with minimal delay after the hour ends)
•Scalable and fault-tolerant
•Support schema evolution
🧱 System Components:
LayerComponentDescription
Data Source
Client SDKs
Emit clickstream events from devices (TV, web, mobile)
Ingestion
Kafka / PubSub
Collects real-time events
Processing
Apache Flink / Spark Streaming
Filters, aggregates full movie views per movie/location/hour
Storage
S3 / HDFS / BigQuery / Snowflake
Stores raw and processed event data
OLAP Engine
ClickHouse / Druid / Pinot
Powers fast queries for dashboard
Dashboard UI
React + Chart.js / Superset / Grafana
Displays top movies per location per hour
Orchestration
Airflow / dbt
Runs hourly batch/aggregation jobs (if not using streaming)