← Business use cases
Real-time analyticsRetail · global7 min read

Walmart: real-time inventory and replenishment on 500 million events a day

How the world’s largest retailer replaced batch inventory and replenishment with streaming so stores never run out.

Context

Walmart is the world’s largest retailer, with thousands of stores, hundreds of distribution centers of varying types and a fast-growing e-commerce business. Shopping is no longer just the physical store: customers search in the app, buy on the site, pick up in store or get home delivery, and expect the product to be available on any of those paths.

To support that, the company needs an up-to-date snapshot of every item’s inventory position at every location, at all times. Walmart’s engineering solved this at scale with a real-time inventory system based on event streaming with Apache Kafka, described publicly by then director of engineering Suman Pattnaik.

The problem

Inventory and replenishment were batch processes. Stock position was recomputed in cycles, and store replenishment was planned on that stale snapshot. With more than ten event sources changing inventory (sales, receipts, returns, transfers, adjustments), each store’s view arrived hours after the fact, causing stock-outs on some items and excess on others.

There was also the integration challenge: each source had its own format and came from different systems. Without a common model, every new consumer of inventory information had to understand all the origins.

The solution

Walmart designed a real-time inventory system on Kafka with a transformation engine at its center: it reads events from several source topics and converts them into a canonical inventory model, with item, store, quantity and event type. Kafka Streams holds the aggregated stock-position state, and connectors deliver the result to Apache Cassandra and other stores consumed by applications.

Sizing was part of the design. Since each Kafka partition is read by a single consumer within a group, the number of consumers must track the number of partitions to reach the required parallelism. The real-time replenishment system was built on the same event base, with a set of high-throughput processors that generate the order plan for the entire store network.

Results

The inventory system ingests around 500 million events a day and processes 1 million online transactions so stores do not run out of the items customers are looking for. The replenishment system processes tens of billions of messages from nearly 100 million SKUs in under 3 hours a day, at throughput above 85 GB of messages per minute, generating the order plan accurately for the whole network.

In 2022 Walmart was recognized at the Data Streaming Awards for moving batch inventory and replenishment to real time at scale. In the company’s words, the investment in event streaming with Confluent contributed to business innovation and to the company’s growth.

What this means for your team

The design applies to any multichannel retailer, from large supermarkets to pharmacy chains: a canonical inventory event model, an engine that translates every origin into that model and the right partition count for consumer parallelism. It is the same pattern we apply in our retail case.

The business lesson is that real-time inventory is not an IT project: it decides whether the sale happens. When stock position is right, the site does not offer what it lacks and the store does not lose the sale for want of replenishment.

Sourcewww.confluent.io/blog/walmart-real-time-inventory-management-using-kafka/ ↗Public case documented by Confluent. Summary and reading by Intelium.
Want to apply this in your context?Talk to the CoE →
More use cases
Event-driven pipelinesDelivery · Brazil

iFood: from batch pipelines to 60 million real-time orders a month

How iFood decoupled 2,000 microservices, left MSK and started tracking deliveries and orders per second with Confluent Cloud.

Read use case
Streaming platformPayments · Brazil

Stone: from a patchwork of systems to one event platform for 1,500 developers

How Stone’s platform team standardized card, PIX and virtual-payment streaming on Confluent Cloud.

Read use case
Legacy modernizationGrocery · UK

Sainsbury’s: the real-time supply chain that doubled engineering efficiency

How the UK’s second-largest grocer freed data from legacy systems and now forecasts demand on 600 billion records.

Read use case