Ultra Low Latency Streaming for Real-Time Feature Engineering

Abhay Bothra, Jerry Peng17 Jun 2026

Problem

Fraud detection, ad bidding, recommendations and dynamic pricing need features that are fresh within the inference budget. Teams usually run Spark for batch features and training, and Flink, Storm or custom Kafka consumers for the online path. The two implementations drift apart, which causes online-offline skew. Offline training also assumes zero latency, so any lag online lowers production accuracy. Spark micro-batch streaming struggled to get below a second.

Example from the article: Coinbase could not push Spark micro-batch freshness below roughly 800-900 ms and lost model accuracy to skew. MakeMyTrip had over one minute of P99 latency on hotel personalization.

Solution in brief

Run one Spark engine for both paths. Real-Time Mode (RTM) gives existing Structured Streaming queries millisecond latency through a trigger change. A native rolling-window operator gives correct "last N minutes" aggregates at lookup time, and a native sink writes them to Lakebase, a managed Postgres used as the online store.

Questions this case answers
  • How to compute online features over a sliding time window that is correct at lookup time with sub-second freshness
  • How to keep online and offline feature computation identical so that training and serving do not drift apart
  • How to compute online features with sub-second freshness without a second streaming stack next to Spark
  • How to keep online and offline features consistent and avoid training-serving skew

Tools and methods

  • Real-Time Mode (RTM) — Spark Structured Streaming execution mode with millisecond end-to-end latency
  • rollingWindow operator — aggregate anchored at the current wall clock, with expiry of old events
  • Lakebase — managed Postgres as the online feature store
  • Native Lakebase streaming sink — batching, pooling, retries and upserts built in
  • Spark Declarative Pipelines (SDP) — declarative pipelines on top of RTM
  • Databricks Feature Store — one feature spec generates the pipelines
Continue reading — it's free

Google or a one-time email code. No password.