Netflix architecture visualization
All architectures
Technical deep dive

Netflix

How a streaming giant runs a lakehouse on S3, Iceberg, and Kafka at petabyte scale.

Numbers that matter

270M+
Subscribers
as of 2024
hundreds of PB
Data lake
on S3 with Iceberg
~1 trillion
Events / day
through Keystone
10,000s
Streaming apps
Flink + Mantis

The stack

Kafka· streaming
Keystone· event pipeline
Apache Iceberg· table format
Apache Spark· batch compute
Apache Flink· stream compute
Presto / Trino· interactive SQL
S3· object storage
Cassandra· operational store
EVCache· in-memory cache

The architecture as an interactive dashboard

The idea is simple: learn by reading the diagram. Every box and arrow tells part of the story — click to open.

How to read this diagram
Boxes = components

Color signals the role: client, streaming, storage, compute, ML, serving. Click any box to see what it is, why it's used, and what happens there.

Arrows = data flow
streaming· live eventsbatch· scheduled jobsync· direct callserve· user-facing
Click any step to explore
eventsbatch ETLfeaturespersonalized
Client appsClientclick →
KeystoneStreamingclick →
Flink jobsComputeclick →
S3 raw · Icebe…Storageclick →
Spark ETLComputeclick →
S3 curatedStorageclick →
Trino / PrestoComputeclick →
ML trainingMLclick →
RecommendationServingclick →
Simplified view: every playback, click, and scroll on a Netflix client fans into Keystone, lands as Iceberg tables on S3, and feeds both offline ML training and real-time personalization back into the app.
Optional
Read the full written deep dive
The same ideas as the diagram, with more context — recommended after exploring the steps.

The problem: personalize everything, in real time, for 270M people

Netflix's north-star metric is engagement. Every artwork on the home screen, every "because you watched" row, every autoplay preview is chosen by a model trained on hundreds of billions of events per day. The data platform's job is to make that possible without the team writing 100 bespoke pipelines.

Two constraints define everything:

  • Latency: personalization must reflect what you just watched — measured in seconds, not hours.
  • Scale: hundreds of petabytes of viewing data, feature stores that back thousands of models, all running on commodity S3 storage rather than a proprietary warehouse.

Keystone: the front door for every event

Every client event — a play, pause, thumbs-up, artwork impression — flows into Keystone, Netflix's managed event pipeline built on top of Kafka. Keystone is not "just Kafka". It's a self-service layer where product teams register a topic, define a schema, and get:

  • Automatic routing to downstream sinks (S3/Iceberg, Elasticsearch, Druid, custom Flink jobs)
  • Schema evolution with backward-compatibility checks
  • A managed multi-cluster Kafka fleet the producer never sees

The team publishes ~1 trillion events per day through Keystone. Producers only know a topic name; Keystone owns the durability, replay, and fan-out. This is the pattern most companies eventually rediscover: the value isn't Kafka, it's the platform on top of it.

The lakehouse: S3 + Apache Iceberg (they helped invent it)

Netflix authored Apache Iceberg because Hive tables on S3 didn't survive concurrent writes, schema changes, or partition evolution at their scale. Iceberg gave them:

  • ACID commits on object storage — batch jobs and streaming jobs can write the same table without corrupting it
  • Time travel — every commit is a snapshot; SELECT ... AS OF TIMESTAMP just works
  • Hidden partitioning — partition scheme can change without rewriting queries
  • Manifest-based planning — pruning files without listing S3

A typical Netflix Iceberg table read looks like this:

-- Read the state of the events table as it was 3 hours ago
SELECT event_type, count(*)
FROM prodhive.datalake.viewing_events
FOR TIMESTAMP AS OF current_timestamp - INTERVAL '3' HOUR
WHERE event_date = current_date - INTERVAL '1' DAY
GROUP BY event_type;

Time travel is not a demo feature — it's how they debug pipelines, backfill safely, and reproduce ML training sets.

Compute: Spark for batch, Flink for streams, Presto for humans

Netflix runs a polyglot compute layer on top of the Iceberg lakehouse:

  • Apache Spark — heavy batch ETL, feature generation, ML training data prep. Runs on their internal container platform, autoscaled.
  • Apache Flink — thousands of stateful streaming jobs. Real-time features, near-real-time aggregations feeding personalization.
  • Presto / Trino — the interactive SQL engine every analyst and engineer uses to explore the lake. Backs internal dashboards and the ad-hoc query tier.
  • Metaflow — the ML workflow framework Netflix open-sourced; sits above Spark and their orchestration layer to give data scientists a Python-native experience.

Same tables, three engines. That's the point of the lakehouse — the storage is the API.

How a recommendation actually gets served

The path from a click to a personalized home row:

1. You tap play. The client emits an event; Keystone lands it in Kafka. 2. A Flink job updates your short-term interaction state within seconds (materialized to a low-latency store). 3. A batch Spark job (nightly or every few hours) recomputes long-horizon features and writes them to a feature store backed by Iceberg + Cassandra + EVCache. 4. When you open the app, the recommendation service queries the feature store, runs the ranking model, and returns the personalized home page.

The trick is that online (the model serving) and offline (training) read the *same* features from the *same* logical store. No skew between what the model saw at training time and what it sees at serving time. That is one of the hardest problems in ML systems, and the lakehouse is why they can solve it once instead of per-model.

What you can actually steal from this design

You don't have Netflix's traffic. You probably shouldn't build Keystone. But the ideas transfer:

  • Own your table format, not your warehouse. Iceberg on S3 with Trino gives you 80% of what Snowflake sells, at 20% of the cost, and you keep your data portable.
  • Time travel is a debugging tool, not a demo. Turn it on the day you build the table, not the day you have your first incident.
  • The event pipeline is a product. If your producers know a broker exists, you've under-invested. Give them a topic name and a schema registry, and hide the rest.
  • Same features, online and offline. Design your feature store so training data and serving data are literally the same rows, at different points in time. Iceberg's snapshots make this cheap.

Curated sources

The public sources behind this analysis, with our take on why each one is worth your time.

Learn what makes this work

The DataForge courses that cover the pieces of this architecture.

Last updated:
← See all architectures