When the Pipeline Pushes Back
Backpressure is a feedback loop that slows work when downstream capacity or health deteriorates. Compare its gains, costs, and signals for choosing a control point.
DatabricksSitesh Sharma, Aditya Kumar, Navneeth NairProblem & solution
MakeMyTrip needed sub-second personalization for “last-searched” hotels across its consumer and corporate travel businesses, serving millions of daily users. Spark Structured Streaming’s micro-batch mode consistently delivered one to two seconds, while adopting Flink would have added a second engine, duplicated logic and increased operational overhead. The team instead adopted Databricks Real-Time Mode (RTM), using continuous data flow, concurrent pipeline scheduling and streaming shuffle to process events with millisecond-level latency on Spark. Its unified pipeline merges B2C and B2B Kafka streams, enriches events with each user’s “Last N” hotels from Aerospike, and writes results to Redis for serving in under 50ms. After tuning partitions, backpressure and rate limits, the production deployment reduced P50 latency from approximately 1.23 seconds to 44ms, P99 latency from over one minute to about 500ms, and increased click-through rate by 7%.
MakeMyTrip’s “last-searched” hotels feature required sub-second latency across B2C and B2B travel workflows serving millions of daily users. Spark micro-batch processing remained at one to two seconds despite tuning, while using Apache Flink would have introduced a second engine, duplicated business logic and increased operational overhead.
MakeMyTrip enabled Real-Time Mode by setting the streaming query trigger to RealTimeTrigger, avoiding a rewrite of its business logic. The pipeline unifies B2C and B2B Kafka streams, uses RTM for continuous processing, retrieves each user’s last N hotels from Aerospike, and writes results to Redis. The team scaled to 64 Kafka partitions, enabled backpressure, capped MaxRatePerPartition at 500 events, and used Kafka’s MaxPartitions option to let multiple partitions share a core.
RTM replaced Spark’s periodic micro-batches with continuous data flow, concurrent stage scheduling and streaming shuffle, removing latency sources that kept micro-batch processing at one to two seconds.
A single unified pipeline applies the same personalization logic to B2C and B2B streams, avoiding the duplicated code and potential logic drift of separate Spark and Flink systems.
Production tuning reduced P50 latency to 44ms and P99 latency to about 500ms; click-through rate increased by 7%, while Redis enabled personalized results to be served in under 50ms.
Flink met the latency requirement, but adopting it would have created a dual-engine architecture with duplicated business logic, higher operational overhead, consistency risks and additional infrastructure costs. MakeMyTrip preferred one Spark-based pipeline as its single source of truth.
The streaming query required a single-line trigger change to RealTimeTrigger, without rewriting business logic. The cluster also needed enough task slots for active source and shuffle tasks, and the team tuned partitioning, backpressure, rate limits and checkpoint behavior.
P50 latency fell from approximately 1.23 seconds to 44ms, while P99 latency fell from more than one minute to about 500ms. Click-through rate increased by 7%, and the UI could serve personalized results in under 50ms.
Summaries are generated from the original by a language model. Check the original before relying on it.
See the idea
Backpressure is a feedback loop that slows work when downstream capacity or health deteriorates. Compare its gains, costs, and signals for choosing a control point.
Keep reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
One useful email. Unsubscribe anytime.