Skip to main content

Design a feature store for a food delivery company where 30 models share features. Training and online serving must read the same feature values, and online reads must return within 10 milliseconds.

System design · Pro 2

Short answer

Clarify which features need real-time freshness and which can be daily. Then: one feature definition used for both paths, an offline store with full history for training, an online key-value store with the latest values, batch and stream jobs that write to both, point-in-time joins to avoid leakage, and monitoring of freshness and training-serving skew.

Deeper answer

Start by asking who uses it and what freshness each feature needs. A restaurant's average rating can be a day old. Orders in the last 10 minutes cannot. Also ask about ownership and access control.

Main parts: a registry holds each feature's definition, owner, entity key and version. Batch jobs and stream jobs compute values from the same definition and write to two stores. The offline store keeps every value with its event timestamp, for training. The online store keeps only the latest value per key in a low-latency key-value database, for serving. Training sets are built with point-in-time joins, so each example only sees values that existed at its own timestamp. Without this, future data leaks into training.

Trade-offs: streaming features are fresher but cost more and are harder to backfill. Precomputing is fast to read but wastes storage for rarely used keys. Check correctness by logging the features served online and comparing them with the offline values, which measures training-serving skew. At scale, the first problems are hot keys, late events that change past values, and backfills that take days when a definition changes.

What a strong answer covers

Answer it out loud in the mock interview about 2.5 min

Follow-ups to expect

Common mistakes

Learn it

Data versioning

Practice System design questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.