System Design: Feature Store (Walnut Feature Store: Online and Offline Stores, Streaming, Training Data)
We design Walnut Feature Store. It is the store behind a large video app's recommendations.
Our companion post, Walnut Tube Recommendations, picks which videos a viewer sees. This store keeps the facts it uses to pick.
As in any system design interview, the numbers are assumptions for planning. Every number here is our own assumption, and the design is our own. All times are Denver time.
How to read this post. It takes about 85 minutes in full, so it is built to be read in parts:
1. Requirements
1.1 What we are building
It is Thursday 10 Dec. Jordan Lee lives in Denver and mostly watches basketball highlights.
Yesterday she tapped "Not interested" on a pasta video, because she wants basketball, not recipes. So the app stopped showing it to her.
When she opens the app, the recommendation system builds her home feed of 20 videos. It also builds an Up next list beside each video she plays. It works in three steps:
- About 1,000 candidate videos are found first. These are videos that might suit her.
- A quick model, the Pre-ranker, cuts them to 300.
- A careful model, the Ranker, puts those 300 in order. It runs on GPU servers: machines with chips built for model math.
Both models need facts about her and about each video. Each such fact is a feature. Examples:
- her basketball minutes this week;
- whether she just said "Not interested" to something;
- how long viewers usually watch a video.
A feature store keeps those facts. It serves them in two very different ways:
- To live models, fast. At 9:00 p.m. the models need 200 facts about Jordan and 76 about each of 300 videos. They need them in a few milliseconds.
- To training, correctly. Each night, the models learn from yesterday's pages. For her 9:00 p.m. page, training must get the facts as they were at 9:00 p.m., not as they are later.
Jordan's evening runs through the whole post:
- 9:00 p.m. She opens the app. The models get her 200 facts in 6 ms. One of them, basketball_minutes_7d, is 46.0.
- 9:13 p.m. She does not bet, so she taps "Not interested" on a sports betting video. Two seconds later the store knows. Her next page ranks betting videos low.
- Friday, 1:00 a.m. The store builds training rows from the videos shown on Thursday.
- The rows for her 9:00 p.m. page hold the facts as the model saw them at 9:00 p.m. That means 46.0, and no betting tap, because that came at 9:13.
- Each row also holds what she did next. The model learns from that.
1.2 Words we use
Models and data
| Word | Meaning |
|---|---|
| Feature | One fact a model reads, such as basketball_minutes_7d = 46.0. |
| Entity | What a feature describes: a viewer such as Jordan, viewer ID U-5120, or a video such as video V-1042. |
| Feature group | Features about one entity that one job computes together, on one schedule. Example: Jordan's live counts. |
| Model | A program that learned from past examples to guess, such as how long Jordan will watch a video. |
| Training, serving | Training adjusts a model on millions of past examples. Serving uses it on a live request, while a viewer waits. |
| Request, impression | A request is one page being built, such as her home feed at 9:00 p.m. An impression is one video shown once. Training rows are made from impressions. |
| Recommendation service | The program that builds Jordan's page. It calls this store. The companion post covers it. |
| Default | The value a model gets when a feature is missing or late, such as 0.0. Training uses the same default. |
Towers and vectors
| Word | Meaning |
|---|---|
| Vector | A list of numbers. Two vectors are "close" when their numbers point the same way. |
| User tower | A small model that turns what Jordan watched, searched and tapped into 128 numbers: her taste vector. It runs on every request, and a copy is stored each night. |
| Video tower | A small model that turns one video's details into 128 numbers: its video vector. It runs every night, for all 300 million videos. |
| Vector version | The name of one night's towers, such as v57 for Thursday. Numbers from v57 mean nothing next to numbers from v58. |
Storage and serving
| Word | Meaning |
|---|---|
| Online store, Offline store | The Online store keeps the latest value of each feature, for live models. The Offline store keeps every past value, for training. |
| Key-value store | A store that answers one question fast: "give me the row stored under this key". It does not search or join. Our Online store is one. |
| Venice | LinkedIn's open-source store for derived data, such as features. Our Online store is built the same way. |
| RocksDB | An open-source library that keeps sorted key-value files on one machine's disk. Each storage machine runs it. |
| Shard, copy | A shard is one slice of the data. Each shard has 3 copies on 3 machines. A copy is also called a replica. |
| Leader, follower | Of a shard's 3 copies, the leader takes each write first and passes it on. The other two are followers. |
| Coordinator | A small database in each region. It knows which machines hold each shard, and which copy leads. |
| Feature client | The library a model's program calls to read features. It runs inside that program, like a database client library. |
| Pod, pod cache | A pod is one running copy of a program. A pod cache is memory inside a Ranker pod that keeps popular videos' rows. |
| Registry, registry snapshot | The registry holds every feature's definition, never values. The snapshot is one file of all live definitions, about 20 MB. It is kept in object storage, which is file storage such as S3. |
| load_log | A table that records when each daily load went live. Training reads it to know what serving read. |
| Serving log | A diary of what the models were given, written after each page. |
| Data lake | The company's store of all past raw events, such as plays and taps, kept for months. |
| Batch job, stream job | A batch job runs on a schedule over stored data (Spark). A stream job runs nonstop and handles each event as it arrives (Flink). |
| Region, zone | A region is a group of data centers in one area: US West, US East and Europe. A zone is one building group in a region, with its own power. |
| p99 | The time within which 99 of every 100 requests finish. |
IDs in this post
Every ID below is made up for Jordan's story. The start of each ID says what kind of thing it names. A bare number, such as shard 613, is named by the word before it.
| ID | What it names | Example |
|---|---|---|
| U-5120 | A viewer ID: one Walnut Tube account | Jordan. U-8873 is Sam Rivera, another viewer |
| V-1042 | A video ID: one video | V-1042, tonight's Hoops Recap highlights. V-4400 is a viral clip |
| rq_9f31c2 | A request ID: one page the app asked for | Her 9:00 p.m. home feed |
| ev_5c71 | An event ID: one action sent by the app | Her 9:13 "Not interested" tap |
| v57 | A version name: one night's models | v57, the models built on Thursday morning. v58 is built on Friday morning |
| p58 | A Pre-ranker vector version: one night's 64-number vectors for the Pre-ranker | p58, made on Friday morning beside v58 |
| r212 | A model name: one trained Ranker | r212, the Ranker that puts her 300 videos in order |
| ds_r212_20261211 | A dataset ID: one set of training rows | The rows for r212 built on Fri 11 Dec |
| viewer_live version 4 | A group version: one version of a feature group's definition file. It is always written "version 4", never "v4", so it is not mixed up with v57 | viewer_live version 4; viewer_watch_daily version 5 |
| 2026-12-10 | A load version: one day's daily values, named by the day | Thursday's daily values, live from 8:10 p.m. |
| field ID 12 | A field ID: a small number that stands for one feature inside its group's row | Field 12 of viewer_watch_daily is basketball_minutes_7d |
| shard 613, 39250 | A shard number: one of the 1,024 slices of the Online store. 39250 is the hash number at the start of a key | Jordan's rows all start with 39250, so they are on shard 613 |
1.3 Every kind of request and change the Feature Store handles
The story follows one viewer's evening, but the store handles much more. Each row names the part that handles it and the stage that adds it. It also names the other team or outside company that takes part.
| Kind | What it is | How big or how often | Which part handles it | Other team or outside company |
|---|---|---|---|---|
| Online reads for a page | The models read facts about the viewer and about each video, for her home feed or Up next | 300,000 home and Up next requests a second at peak. Each makes 2 calls and 1 Pre-ranker read: 900,000 fetch calls a second | Feature client, Online store and pod cache; stages 1 and 2 | The Recommendation service and the Ranker, from the companion post |
| Other models' reads | Search and other models read features the same way | 100,000 requests a second × 2 calls = 200,000 fetch calls. With the row above: 1.1 million a second | The same parts | The Search team and other model teams |
| Live updates | A play or a tap changes a live count, such as negative_taps_1h | 1 million events a second at peak; 1.5 million row writes a second per region; within about 2 seconds | Event log and Stream jobs; stage 4 | The Event collector, another team's |
| Daily loads, whole files | New daily values for every viewer, such as basketball_minutes_7d | 400 GB a day per region; live at 8:10 p.m. on a normal evening | Batch jobs, Offline store and Online loader; stage 5 | The Data lake, another team's |
| Daily loads, changed rows | Daily video stats, where few rows change in a day | About 30 million of 300 million video rows a day, in hourly copy runs | The Online loader's copy runs; stage 5 | The Data lake |
| New feature definitions | A reviewed file in Git, such as viewer_live version 4 | About 40 teams own about 20,000 features | Registry service, Postgres and the registry snapshot; stage 3 | Feature owners, such as Tyler Johnson's viewer-signals team |
| Backfills | History for a new version, computed from past events, so training has past values | Once per new version. viewer_live version 4's took from Mon 2 Nov to Wed 4 Nov | Batch jobs reading the Data lake; stages 3 and 5 | The Data lake |
| Serving log records | What each page's models were given | One per home and Up next page: 5.5 TB of short records + 5 TB of full records = 10.5 TB a day | Feature client and Serving log; stage 6 | None |
| Training data builds | Training rows for one model | About 7.7 billion rows a night, from 1:00 a.m. | Training data service; stage 6 | The Training pipeline, from the companion post |
| Mismatch checks | Served values compared with values recomputed from raw events | About 115 million sampled records a night; the result at 5:20 a.m. | Quality monitor; stage 6 | Feature owners are paged; model releases may be blocked |
| Vectors | Each night's new taste vectors and video vectors | 300 million video vectors and one per viewer; about 234 GB per version per copy; live at 7:00 a.m. | Batch jobs and the Online loader; stage 7 | The Recommendation model jobs, from the companion post |
| Fixing a bad load | Spark wrote wrong daily values, and they are live | Switching back is one registry change | Registry service and Online loader; stage 5 | None |
| Deletes | A viewer's data is deleted | Online rows within 24 hours; files within 30 days | Online store, Offline store and a deleted list that every loader and Stream job checks | The Data lake's team rewrites its files |
This post follows Jordan's evening in depth. The other kinds use the same parts.
1.4 Functional requirements
- Serve features to live models. Given a model and an entity, return all the features that model reads, in one call.
- Count new events within seconds. A tap or a play changes the live counts on her next request.
- Give training the past exactly. For any past moment, return each value as it was readable then.
- One definition for both. One definition computes a feature for serving and for training.
- Let teams add features without writing jobs. About 40 teams own features. Adding one is a reviewed file.
- Never fail the request. A missing or late value becomes a known default, and the page is still built.
Out of scope:
- how models are trained and served;
- how candidate videos are found;
- how the app collects events.
1.5 Non-functional requirements
- Fast. One fetch call returns in under 10 ms at p99. That is one step of the page's 200 ms budget.
- Fresh where it matters.
- Live counts update within about 2 seconds, and at most 10 seconds for 99 of every 100 events.
- Daily features are live by 8:30 p.m. Denver time at the latest. On a normal evening they are live by 8:10 p.m.
- Correct. Training sees the values serving saw. A model trained on other numbers than it gets online does worse, and nobody can tell why.
- Available. If the store is slow or broken, models still get defaults and pages are still built.
1.6 Back of the envelope
These are rough sums, the kind a candidate does at a whiteboard in a few minutes. Every number is our own assumption; the inputs are listed under the table.
| Number | How we get it | Result | What it decides |
|---|---|---|---|
| Fetch calls | 400,000 ranking requests × 2 calls = 800,000, + 300,000 Pre-ranker reads | 1.1 million a second, 10 ms each | Direct reads by key, with no server in between |
| Values per page | 200 viewer values + 300 videos × 76 | about 23,000 | Values must be packed into a few rows |
| Rows per page | Jordan 4 rows + 1,000 Pre-ranker vectors × 1 in 10 not in memory + 300 videos × 3 rows × 5 in 100 not in memory | about 150 (4 + 100 + 45) | Caches in the model servers are essential |
| Row reads at peak | Viewer 400,000 × 4 = 1.6 million + Ranker video rows ≈ 16 million + Pre-ranker 300,000 × 100 = 30 million. The US regions serve about 85% of it | about 48 million a second; 41 million in the US | Without the caches, about 13 times more. We estimate one storage machine serves about 250,000 a second, so row reads, not bytes, set how many machines we run |
| Data online | (0.9 + 0.84) TB × 3 copies = 5.2 TB, + 1.2 TB during the evening load, + 4 TB of recent actions | 10.4 TB per region | Small next to the memory of the machines row reads need, so most reads never touch the disk |
| Daily load | 200 B + 700 B = 0.9 KB × 450 million viewers | 400 GB a day per region | Load whole files and switch at once |
| Live writes | About 1 million viewer rows + 500,000 video rows, each written at most once a second | 1.5 million row writes a second per region | Stream only what must react within minutes |
| Training data | About 3 billion tapped, all kept, + 1 in 10 of the other 47 billion ≈ 3 + 4.7 | 7.7 billion rows a night; serving log 10.5 TB a day | Built in bulk from files, never from the Online store |
Where the inputs come from.
- Ranking requests at peak: 400,000 a second.
- Home: 180,000.
- Up next: 120,000.
- Search and other models: 100,000.
- Each request makes 2 calls: one for the viewer and one for the videos.
- Home and Up next (300,000 requests) also make 1 Pre-ranker read each.
- The Ranker reads 45 video rows a request. On Up next, which ranks 200, it reads 30.
- The US regions serve the Americas and Asia.
- Viewer rows: 2 KB × 450 million ≈ 0.9 TB. Video rows: 0.84 TB.
- Recent actions are things such as plays and taps.
- Per viewer, viewer_profile_daily is 200 B and viewer_watch_daily is 700 B.
- Events: 1 million a second at peak.
- Shown videos: 50 billion a day.
What these numbers tell us: row reads are the bottleneck. So the design reads few rows, through packed rows, caches in the model servers and one read per shard.