Real-time pricing engine: from batch overnight to sub-second

Real-time pricing engine: from batch overnight to sub-second

Simor Consulting | 19 Aug, 2026 | 05 Mins read

An online travel agency processed 2.3 million flight searches per day. Each search triggered a pricing computation that determined the displayed fare for every matching itinerary. The pricing computation was a batch job that ran overnight, computing fare recommendations for all active itineraries based on current inventory, competitor pricing, demand forecasts, and margin targets. The batch output was stored in a lookup table. When a user searched for flights, the system read the pre-computed fare from the lookup table and displayed it.

The batch approach had a fundamental problem: the fare a user saw was computed on data that was between eight and twenty hours old. During that window, competitor prices changed, inventory levels shifted, and demand patterns evolved. The agency was displaying fares that were optimal for yesterday’s market, not today’s. Revenue analysts estimated that the agency was leaving four to seven percent of potential revenue on the table because their prices could not respond to real-time market conditions.

The business case for real-time pricing was clear: if the pricing engine could compute fares at search time, incorporating the latest competitive and demand signals, the agency could capture the revenue that the batch approach missed. The engineering case was harder: the pricing computation involved evaluating 400 pricing rules against an average of 3,000 itineraries per search, all within the 500ms latency budget that the search experience required.

The batch architecture’s constraints

The overnight batch job processed all active itineraries — approximately 2 million — and evaluated each against the 400 pricing rules. Total computation time was six hours on a cluster of thirty-two compute nodes. Extrapolating to per-search computation: 2 million itineraries times 400 rules divided by 32 nodes divided by 6 hours equals approximately 1,100 rule evaluations per second per node.

A single search, with 3,000 itineraries and 400 rules, required 1.2 million rule evaluations. At the batch processing rate of 1,100 evaluations per second per node, a single search would take over 1,000 seconds on one node, or 32 seconds on the entire batch cluster. Neither was acceptable. The search experience required sub-500ms response times.

The batch approach achieved overnight processing by amortizing the computation across all itineraries simultaneously. The per-search computation was far too expensive for real-time execution. The architecture could not be made faster by adding nodes — the per-search computation was inherently sequential because each rule evaluation depended on the result of prior rules.

The approach: pre-compute the framework, compute the details at search time

We redesigned the pricing engine to split the 400 rules into two tiers: framework rules and dynamic rules. Framework rules determined the pricing structure — base fare classes, advance purchase discounts, length-of-stay requirements, and seasonal adjustments. These rules changed slowly, on a cadence of days or weeks. Dynamic rules determined the real-time adjustment — competitive matching, demand-based surge pricing, inventory-driven scarcity pricing, and promotional discounts. These rules changed by the minute.

This diagram requires JavaScript.

Enable JavaScript in your browser to use this feature.

The overnight batch job continued to run, but its scope was reduced. Instead of computing final fares, it computed framework fares — the base price for each itinerary after applying the stable pricing rules. The framework fare was stored in the lookup table. At search time, the dynamic pricing layer read the framework fare and applied a small number of real-time rules — typically five to ten, not 400 — to compute the final fare.

The dynamic rules operated on a much smaller input space than the full rule set. The framework fare was a single number. The competitive price feed was a small lookup table updated every sixty seconds. The demand forecast was a pre-computed score for the route and date. The inventory level was a single integer. The dynamic pricing layer evaluated these inputs against five to ten rules and produced an adjusted fare. Total computation time was under 30ms.

This approach preserved the batch architecture’s ability to handle complex, sequential rule evaluation for the stable rules, while adding a real-time adjustment layer that was fast enough to meet the latency budget.

The competitive price feed

The most critical dynamic input was competitor pricing. The agency subscribed to a fare monitoring service that provided competitor prices for the same routes and dates. The feed was updated every sixty seconds and cached in a low-latency store.

The dynamic pricing rules used the competitor feed to implement three strategies: match, undercut, and premium. Match applied when the agency’s framework fare was within two percent of the competitor’s fare — no adjustment. Undercut applied when the competitor’s fare was lower — the agency reduced its fare to match minus a configurable margin. Premium applied when the agency’s fare was already lower — the agency held its price or increased it slightly to capture additional margin.

These three strategies covered approximately eighty percent of competitive pricing situations. The remaining twenty percent involved complex multi-competitor scenarios, route-specific promotions, or bundle pricing that required evaluation beyond the dynamic rule set. For these cases, the dynamic pricing layer fell back to the framework fare, accepting that real-time adjustment was not always possible within the latency budget.

What we gave up

The two-tier architecture could not apply all 400 rules at search time. Rules that required historical data spanning months or years — customer lifetime value adjustments, long-term demand trend analysis, loyalty program tier calculations — remained in the batch layer. A customer’s loyalty tier affected their fare, but the tier was computed overnight, not at search time. If a customer crossed a loyalty threshold during the day, their fare would not reflect the new tier until the next batch run.

The second trade-off was pricing consistency. With batch pricing, every user who searched for the same route at the same time saw the same fare. With real-time pricing, fares could change between searches as competitor prices and inventory levels updated. Users who searched, left, and returned minutes later might see a different fare. The agency addressed this with a fare lock feature — users could hold a fare for fifteen minutes — but the inconsistency was a user experience concern that the batch approach never had.

The third trade-off was operational complexity. The dynamic pricing layer added a new service that required monitoring, capacity management, and failure handling. If the competitor price feed went down, the dynamic pricing layer had to decide whether to fall back to framework fares or use stale competitor data. The team implemented a staleness threshold of five minutes — if the feed was older than five minutes, the system fell back to framework fares and logged the fallback for revenue analysis.

Results

Revenue per search increased by fourteen percent in the first quarter after deployment. The increase came from three sources: competitive undercutting captured price-sensitive customers who would have booked with competitors, scarcity pricing increased fares on high-demand routes as inventory decreased, and promotional pricing allowed same-day flash sales that were impossible with overnight batch computation.

The fourteen percent exceeded the four to seven percent that analysts had estimated, because the real-time engine enabled pricing strategies that the batch approach could not implement at all — not just strategies that the batch approach implemented poorly. Same-day flash sales and inventory-driven scarcity pricing were new capabilities, not improvements to existing capabilities.

Search latency increased by an average of 35ms — from 420ms to 455ms at p50. The dynamic pricing layer’s 30ms computation time was within the search service’s latency budget. No degradation in user experience was detected.

The decision heuristic

If your pricing computation involves rules that change at different cadences, do not compute everything at the same frequency. Separate the rules by their rate of change. Pre-compute the slow rules in batch. Compute the fast rules at request time. The batch layer handles complexity. The real-time layer handles freshness. The boundary between them is defined by the latency budget: any rule that can be evaluated within the budget should be evaluated at request time. Any rule that cannot should be pre-computed. The goal is not to make everything real-time. The goal is to make the things that need to be real-time fast enough to matter.

Shipping a production AI system?

Find the control gaps before they turn into incidents. Take the AI Production Scorecard for a fast baseline across the seven layers, or book an architecture review and we will turn it into a hardening plan.

Similar Articles

The Modern Data Stack for AI Readiness: Architecture and Implementation
The Modern Data Stack for AI Readiness: Architecture and Implementation
28 Jan, 2025 | 03 Mins read

Existing data infrastructure often cannot support ML workflows. The modern data stack offers a foundation, but it requires adaptation to become AI-ready. This article covers building a data architectu

How a retailer reduced inference latency 90% with feature store caching
How a retailer reduced inference latency 90% with feature store caching
21 Apr, 2026 | 04 Mins read

A mid-market e-commerce retailer with roughly $200M in annual revenue had invested eighteen months building a product recommendation engine. The models were accurate. Offline evaluation showed meaning

The data pipeline that cost $50K/month — and the audit that found why
The data pipeline that cost $50K/month — and the audit that found why
22 Apr, 2026 | 04 Mins read

A financial services firm running analytics on trade settlement data came to us with a specific complaint: their cloud data platform cost had tripled in eighteen months, and nobody could explain why.

dbt vs SQLMesh: which transformation tool wins in 2026?
dbt vs SQLMesh: which transformation tool wins in 2026?
23 Apr, 2026 | 06 Mins read

Every analytics team eventually faces the same choice: how do you transform raw data into something analysts can actually use? For years, dbt was the only serious answer. SQLMesh arrived with a differ

Migrating from batch to streaming: a 6-month journey
Migrating from batch to streaming: a 6-month journey
28 Apr, 2026 | 05 Mins read

A logistics company processing two million shipments per day ran their entire operational reporting stack on nightly batch ETL. Every morning at 6 AM, operations managers reviewed dashboards built on

When RAG failed: a knowledge retrieval project post-mortem
When RAG failed: a knowledge retrieval project post-mortem
29 Apr, 2026 | 05 Mins read

A legal technology company had invested six months building a retrieval-augmented generation system to help contract attorneys find relevant precedent clauses across a corpus of 180,000 executed agree

Data Lakehouse Security Best Practices
Data Lakehouse Security Best Practices
22 Feb, 2024 | 02 Mins read

Data lakehouses combine lake flexibility with warehouse performance but introduce security challenges from their hybrid nature. Securing these environments requires layered approaches covering authent

From 3-hour dashboards to 3-minute insights: a BI modernization story
From 3-hour dashboards to 3-minute insights: a BI modernization story
05 May, 2026 | 05 Mins read

A manufacturing company with facilities in twelve countries ran its operational reporting on a traditional BI stack: a data warehouse, an ETL pipeline, and a dashboard tool that had been deployed six

Orchestration face-off: Airflow vs Prefect vs Dagster
Orchestration face-off: Airflow vs Prefect vs Dagster
07 May, 2026 | 06 Mins read

The orchestration market has a clear incumbent and two serious challengers. Apache Airflow has been the default choice since 2015. Prefect and Dagster both emerged to address Airflow's pain points, bu

The vector database that couldn't scale — and what we did instead
The vector database that couldn't scale — and what we did instead
12 May, 2026 | 05 Mins read

A media company with a library of twelve million articles, transcripts, and research documents had built a semantic search system on a managed vector database. The system was designed to let journalis

Building an AI operating system for a 10,000-person company
Building an AI operating system for a 10,000-person company
19 May, 2026 | 05 Mins read

A diversified industrial company with 10,000 employees across manufacturing, logistics, and field services had accumulated forty-seven separate AI projects over three years. Each business unit had bui

Real-time streaming: Kafka vs Redpanda vs Pulsar
Real-time streaming: Kafka vs Redpanda vs Pulsar
21 May, 2026 | 05 Mins read

Kafka has dominated event streaming for a decade. It processes trillions of messages daily across thousands of companies. Its dominance created an ecosystem so large that "streaming" became synonymous

How we killed our ETL pipeline (and productivity went up)
How we killed our ETL pipeline (and productivity went up)
26 May, 2026 | 05 Mins read

A B2B SaaS company running a customer success platform had a data pipeline that consumed sixty percent of the data engineering team's time. Not feature work. Not analytics. Pipeline maintenance. The p

A compliance-first AI rollout in financial services
A compliance-first AI rollout in financial services
03 Jun, 2026 | 05 Mins read

A regional bank with $12 billion in assets wanted to use machine learning to improve its commercial loan underwriting process. The existing process was manual, relying on credit analysts who spent fou

Semantic Layer Implementation: Challenges and Solutions
Semantic Layer Implementation: Challenges and Solutions
20 Mar, 2024 | 02 Mins read

A semantic layer provides business-friendly abstraction over technical data structures, enabling self-service analytics and consistent metric interpretation. Implementing one involves technical challe

The $2M model that never made it to production
The $2M model that never made it to production
09 Jun, 2026 | 05 Mins read

A retail chain with 400 stores spent two years and $2.1 million building an inventory optimization model. The model was technically excellent. It reduced predicted stockouts by thirty-two percent and

Data cataloging tools: Atlan, Alation, DataHub, Amundsen
Data cataloging tools: Atlan, Alation, DataHub, Amundsen
11 Jun, 2026 | 05 Mins read

A data catalog solves a trust problem. When an analyst cannot find the right table, does not know what a column means, or cannot tell whether data is fresh, they either guess or ask someone. Both outc

Data mesh in practice: year 2 retrospective
Data mesh in practice: year 2 retrospective
16 Jun, 2026 | 05 Mins read

An insurance company with $400 million in premium volume adopted data mesh two years ago. The central data team had become a bottleneck. Every business unit — claims, underwriting, actuarial, and dist

When your AI vendor goes bankrupt — surviving platform lock-in
When your AI vendor goes bankrupt — surviving platform lock-in
23 Jun, 2026 | 05 Mins read

A healthcare analytics company received notice on a Tuesday afternoon that their primary AI infrastructure vendor was filing for Chapter 7 bankruptcy. The platform hosted their patient risk stratifica

Real-time fraud detection: from proof-of-concept to production in 90 days
Real-time fraud detection: from proof-of-concept to production in 90 days
30 Jun, 2026 | 05 Mins read

A payment processor handling twelve million transactions per day had a fraud detection system that was accurate but slow. The system reviewed transactions in batch, four times per day. A fraudulent tr

Consolidating 47 data sources into one knowledge layer
Consolidating 47 data sources into one knowledge layer
01 Jul, 2026 | 05 Mins read

A global professional services firm with 8,000 consultants maintained institutional knowledge across forty-seven separate systems. Project proposals lived in a document management system. Client engag

The GDPR audit that reshaped our entire ML pipeline
The GDPR audit that reshaped our entire ML pipeline
07 Jul, 2026 | 05 Mins read

A European fintech with twelve million customers received a GDPR audit notice from their national data protection authority. The audit focused on the company's machine learning pipeline, which powered

How a healthcare org deployed LLMs without violating HIPAA
How a healthcare org deployed LLMs without violating HIPAA
14 Jul, 2026 | 05 Mins read

A hospital system with twelve facilities and 14,000 clinical staff wanted to use large language models to assist with clinical documentation. Physicians spent an average of two hours per day on docume

Data quality platforms: Great Expectations vs Soda vs Monte Carlo
Data quality platforms: Great Expectations vs Soda vs Monte Carlo
15 Jul, 2026 | 06 Mins read

Data quality failures are expensive and silent. A broken pipeline does not crash — it produces wrong data that flows into dashboards, models, and decisions. The error is discovered weeks later when a

Legacy mainframe to cloud-native: the data migration they said was impossible
Legacy mainframe to cloud-native: the data migration they said was impossible
21 Jul, 2026 | 06 Mins read

An insurance company running on an IBM mainframe had accumulated forty years of policy data in VSAM files and DB2 tables. The mainframe processed 600,000 transactions per day across policy administrat

The modern data stack is dead — here's what replaced it
The modern data stack is dead — here's what replaced it
23 Jul, 2026 | 05 Mins read

The modern data stack was a marketing category that outlived its usefulness. Between 2019 and 2023, it described a specific architecture: Fivetran or Airbyte for ingestion, dbt for transformation, Sno

Building trust in AI recommendations — the change management story
Building trust in AI recommendations — the change management story
28 Jul, 2026 | 06 Mins read

A consumer goods company built an AI system that recommended reorder quantities for 12,000 SKUs across 340 distribution points. The system optimized for a multi-objective function that balanced invent

Schema registry showdown: Confluent vs Apicurio vs AWS Glue
Schema registry showdown: Confluent vs Apicurio vs AWS Glue
30 Jul, 2026 | 05 Mins read

When producers and consumers share a Kafka topic without agreeing on the data format, things break in production. A producer adds a field. A consumer expects the old schema. The deserialization fails,

When the model was right but nobody believed it
When the model was right but nobody believed it
04 Aug, 2026 | 05 Mins read

An agriculture technology company built a crop yield prediction model that combined satellite imagery, soil sensor data, weather forecasts, and historical yield records. The model predicted per-field

Scaling a recommendation engine from 1K to 10M users
Scaling a recommendation engine from 1K to 10M users
11 Aug, 2026 | 06 Mins read

A video streaming platform grew from 1,000 beta users to 10 million subscribers over thirty months. Their recommendation system was rebuilt three times during this period. Each rebuild was triggered n

Serverless Data Pipelines: Architecture Patterns
Serverless Data Pipelines: Architecture Patterns
05 Jun, 2024 | 08 Mins read

# Serverless Data Pipelines: Architecture Patterns Serverless computing eliminates server management and provides automatic scaling with pay-per-use billing. These benefits matter for data pipelines

Event-Driven Data Architecture
Event-Driven Data Architecture
15 Sep, 2024 | 02 Mins read

Event-driven architectures treat changes in state as events that trigger immediate actions and data flows. Rather than processing data in batches or through scheduled jobs, components react to changes

From Data Silos to Data Mesh: The Evolution of Enterprise Data Architecture
From Data Silos to Data Mesh: The Evolution of Enterprise Data Architecture
15 Feb, 2025 | 03 Mins read

Traditional centralized data architectures worked for BI but struggle with AI workloads. Centralized teams become bottlenecks as data volumes grow. Domain experts who understand the data are separated

Case Study: End-to-End RAG Platform for Customer Support
Case Study: End-to-End RAG Platform for Customer Support
05 Dec, 2025 | 05 Mins read

A SaaS company with 200 support agents and 10,000+ knowledge base articles had an 18-hour average response time and 23% first-contact resolution. Their largest enterprise client threatened to cancel a

Case Study: Building a Production AI Knowledge Layer for Financial Services
Case Study: Building a Production AI Knowledge Layer for Financial Services
01 Mar, 2026 | 10 Mins read

A regional bank's investment research team spent 60% of their time gathering information and 40% doing analysis. Analysts had to search through regulatory filings, internal research memos, market data

Feature Stores for AI: The Missing MLOps Component Reaching Maturity
Feature Stores for AI: The Missing MLOps Component Reaching Maturity
12 Mar, 2026 | 11 Mins read

A recommendation system team built their tenth model. Each model required feature engineering. Each feature engineering project started by copying code from the previous project, then modifying it for

Case Study: Multi-Agent System for Supply Chain Optimization
Case Study: Multi-Agent System for Supply Chain Optimization
13 Jun, 2026 | 12 Mins read

A mid-size automotive parts manufacturer with operations spanning 15 countries and relationships with over 200 suppliers faced a supply chain coordination problem that was consuming too much of their

The AI Data Pipeline: Special Considerations for Unstructured and Structured Data
The AI Data Pipeline: Special Considerations for Unstructured and Structured Data
11 May, 2026 | 13 Mins read

Data pipelines for AI are not the same as data pipelines for traditional software systems. The outputs are different. The failure modes are different. The tolerance for data quality issues is differen