Skip to main content
← PROBLEMS / SYSTEM-DESIGN
An end-to-end domain learning journey

Design an Enterprise ML Feature
Store (100K QPS, <5ms p99).

Design a multi-tenant Enterprise ML Feature Store supporting 100K+ online QPS at <5ms p99 latency, petabyte-scale point-in-time training dataset generation, and zero training-serving skew.
Start the journey7 stages· Last modified Nov 24, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

To keep serving pipelines predictable under bursty prompts, <5ms p99), separate the hot Redis serving plane from the immutable Iceberg history plane, connected by a single declarative Flink/Spark registry.

TL;DR30-second simplified summary
▾

To serve 100K QPS under 5ms p99, pack feature views into single Protobuf Redis keys, shield hot keys with a 500ms L1 cache, and enforce 3.5ms circuit-breaker timeouts.

Offline, bucketed Iceberg tables enable shuffle-free ASOF joins with bounded lookback windows.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Point-in-Time ML Feature Store & ASOF Joins
A Point-in-Time ML Feature Store eliminates training-serving skew and temporal data leakage by pairing a low-latency online key-value store with an immutable offline time-travel lakehouse queried via ASOF joins.
Full walkthrough · 7 stages
01
foundation

Requirements & Capacity Envelope.

Why this matters: Quantify QPS, payload sizes, Redis RAM footprint, and offline storage growth.

At 100K QPS with 50 features per entity (~400 bytes Protobuf), online egress is 40 MB/s.

Storing 100M active entities requires ~40 GB raw data (~120 GB with Redis Cluster overhead and replication), easily fitting in a 6-shard RAM cluster.

Capacity Math

100K QPS Online & PB-Scale Offline Sizing

100K QPS IngressOnline throughputRedis 6-ShardClusterHot state budgetIceberg S3LakehouseCold history5ms p99 BudgetLatency envelopeMeets <5ms p99

1.Memory Budget: 100M entities x 400B x 2x replication + 35% overhead = ~100 GB RAM.

2.Workload Isolation: Training scans never touch Redis; they read Zstd-compressed Iceberg.

Back-of-the-envelope sizing confirms 100M active entities fit in a modest 6-shard Redis Cluster.

02
foundation

High-Level Dual-Plane Architecture.

Why this matters: Connect Kafka streams and batch lakes to online Redis and offline Iceberg.

Think of High-Level Dual-Plane Architecture as the intuition layer for Design an Enterprise ML Feature Store (100K QPS, <5ms p99): Connect Kafka streams and batch lakes to online Redis and offline Iceberg.

Kafka ingests real-time domain events while S3/GCS holds batch tables. Flink runs stateful sliding-window aggregations and writes to a Dual-Sink Materializer: Redis Cluster for real-time inference and Apache Iceberg for point-in-time historical storage.

System Blueprint

Dual-Plane Feature Store Architecture

Kafka + S3 DataLakesIngestion tierFlink StatefulIngestUnified processorDual-WriteMaterializerParity bridgeInference &Training APIsConsumption tierEmits feature vectors

1.Single Compute Path: Flink Kappa-style processing handles both real-time and replay streams.

2.Typed Contracts: Protobuf schemas enforce strict type compatibility across producers and consumers.

A unified Flink materializer feeds both the low-latency Redis online plane and the Iceberg offline plane.

Engineering Decision Framework
Problem
How to implement Design an Enterprise ML Feature Store (100K QPS, <5ms p99) without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
To keep serving pipelines predictable under bursty prompts, <5ms p99), separate the hot Redis serving plane from the immutable Iceberg history plane, connected by a single declarative Flink/Spark registry.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When Design an Enterprise ML Feature Store (100K QPS, <5ms p99) experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

03
intermediate

Point-in-Time Training Set Generation.

Why this matters: Execute scalable ASOF joins across petabytes of Iceberg snapshots.

Think of Point-in-Time Training Set Generation as the intuition layer for Design an Enterprise ML Feature Store (100K QPS, <5ms p99): Execute scalable ASOF joins across petabytes of Iceberg snapshots.

Naively joining 100M labels with 50B feature rows causes a massive shuffle. Partitioning both tables by entity_id hash bucket and event date, and performing a Spark sort-merge ASOF join with a bounded 30-day lookback window reduces shuffle I/O by 90%.

Offline Engine

Bucketed Sort-Merge ASOF Join in Spark

Label Spine (100M)Query driverIceberg PartitionsFeature historySort-Merge ASOFTemporal joinTraining ParquetModel inputPrunes by date & bucket

1.Co-Located Bucketing: Matching Iceberg bucket counts on entity_id eliminates wide Spark shuffles.

2.Bounded Lookback: A 30-day TTL window prevents scanning years of cold partitions.

Bucketed Iceberg tables and bounded lookback windows make petabyte ASOF joins fast and cheap.

04
intermediate

Online Serving, Caching & Circuit Breakers.

Why this matters: Guarantee <5ms p99 inference latency even during Redis node failovers.

Think of Online Serving, Caching & Circuit Breakers as the intuition layer for Design an Enterprise ML Feature Store (100K QPS, <5ms p99): Guarantee <5ms p99 inference latency even during Redis node failovers.

The Real-Time Inference API batches multi-entity lookups into pipelined Redis MGETs with a strict 3.5ms socket timeout. A local Caffeine L1 cache absorbs hot-key spikes (e.g., viral merchants), and a circuit breaker falls back to default feature medians if Redis errors exceed 1%.

Low-Latency Serving

Multi-Tier Online Serving with Circuit Breaker

Inference gRPCGatewayRequest routerL1 In-Process CacheSpike absorberRedis ClusterDistributed KVCircuit BreakerResilience gatePipelined MGET

1.Hot-Key Protection: 500ms L1 caching prevents single viral entities from saturating one Redis shard.

2.Fast Failover: 3.5ms timeouts protect upstream checkout/bidding SLAs.

L1 caching and circuit-breaker fallbacks keep online feature reads under 5ms p99.

05
intermediate

Flink Stateful Sliding Windows & Late Events.

Why this matters: Handle out-of-order mobile telemetry without corrupting real-time counters.

Think of Flink Stateful Sliding Windows & Late Events as the intuition layer for Design an Enterprise ML Feature Store (100K QPS, <5ms p99): Handle out-of-order mobile telemetry without corrupting real-time counters.

Mobile events often arrive 30–120 seconds late. Flink uses event-time watermarks with a 2-minute allowed lateness window in RocksDB, emitting updated aggregates to Redis while routing events beyond 2 minutes to a side-output for offline Iceberg correction.

Stream Semantics

Event-Time Watermarks & Late-Data Side Output

Bounded WatermarkEvent-time clockRocksDB StateWindow memoryRedis UpsertOnline syncLate Side-OutputOffline repairEmits timely updates

1.RocksDB Spillover: Disk-backed RocksDB state supports 100M+ active window keys without JVM OOM.

2.Side-Output Repair: Ultra-late events still land in Iceberg for accurate offline training.

Event-time watermarks and side-outputs balance real-time accuracy with offline completeness.

06
advanced

Feature Drift Monitoring & Automated Remediation.

Why this matters: Detect distribution shifts and stale pipelines before model accuracy collapses.

Think of Feature Drift Monitoring & Automated Remediation as the intuition layer for Design an Enterprise ML Feature Store (100K QPS, <5ms p99): Detect distribution shifts and stale pipelines before model accuracy collapses.

A Feature Drift Monitor computes hourly Population Stability Index (PSI) and null-rate checks on 1% sampled serving vectors. If a Flink job lags or a feature's null rate spikes above 5%, automated alerts fire and the Inference API shifts traffic to a fallback baseline model.

Observability

Drift Monitor & Automated Model Fallback

1% Inference SampleTelemetry sourceDrift & Lag MonitorAnomaly detectorModel TrafficRouterBlast-radius controlAuto-BackfillTriggerSelf-healingTriggers baseline fallback

1.Multi-Signal Health: Combine PSI drift, null-rate spikes, and Kafka consumer lag.

2.Safe Fallback: Routing to a simpler model without the broken feature preserves revenue.

Automated drift detection pairs statistical PSI checks with instant fallback routing.

07
advanced

Multi-Tenant Isolation & Backfill Throttling.

Why this matters: Prevent massive historical backfills from saturating live online Redis shards.

Think of Multi-Tenant Isolation & Backfill Throttling as the intuition layer for Design an Enterprise ML Feature Store (100K QPS, <5ms p99): Prevent massive historical backfills from saturating live online Redis shards.

When teams backfill 90 days of features into Redis, naive writes can trigger 500K+ write OPS and spike p99 read latency. Token-bucket rate limiters throttle backfill writers based on live Redis CPU/latency headroom, pausing automatically if read p99 crosses 3ms.

Multi-Tenancy

Adaptive Backfill Throttling on Live Redis

Spark BackfillWritersBackground loadToken-Bucket LimiterThrottle gateRedis p99 FeedbackBackpressure signalOnline RedisClusterShared serving tierShrinks quota if p99 > 3ms

1.Read-Priority QoS: Live inference reads always preempt background backfill writes.

2.Dedicated Bulk Pipeline: Use Redis RDB/snapshot pre-warming for >100M key initial loads.

Adaptive token-bucket throttling protects live inference SLAs during heavy feature backfills.

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

You need to backfill 100M historical user feature vectors into the live Redis Cluster serving 100K QPS at <5ms p99. What is the safest way to avoid degrading live inference?

Recommended Learning Flow