DoorDash Inventory Now 75% Faster, 50% More Efficient
Inventory woes are real! Tackling these head-on, DoorDash engineered highly scalable and reliable inventory platform.
Hey there!
Isn’t inventory the lifeblood of commerce!? Sure, operations and production, marketing and sales, finance and accounting matter, too.
However, on average, inventory represents approximately 15% of total firm assets for public U.S. firms, and businesses spend 25% to 35% of their budget on inventory costs. In fact, improper inventory management cost companies a staggering $1.8 trillion due to stockouts and overstocks in 2020 alone.
On top of the challenges like overstocking, limited visibility, and tracking obsolete stocks, there can be problems with the inventory platforms themselves.
Can we forget retail giant H&M facing massive financial losses in 2018 while sitting on a giant pile of inventory - more than $4 billion worth of dresses, shirts, and pants!?
This reminds me of one of our clients, a retail chain. By implementing a custom cloud-based inventory management platform leveraging CockroachDB for distributed SQL, automated reordering through machine learning algorithms, and mobile scanning with QR codes, we helped them cut obsolete inventory by 30% within 3 months.
However, today I’d like to discuss how DoorDash, a popular food delivery service, designed a new inventory platform that can handle a large amount of data and traffic.
DoorDash Dominating Food Delivery
As of January 2024, DoorDash held a commanding 66% share of the online food delivery market in the United States. With hundreds of thousands of restaurants, grocery stores, and retailers on their platform, this biggest food delivery app in America delivers food to over 30 million people in 27 countries.
DoorDash started by only delivering restaurant meals. But now, they also deliver from grocery stores, retailers like Target, convenience stores, and more. This, of course, requires a lot of engineering to work smoothly at a large scale. One big problem is tracking inventory.
A grocery store has a plethora of different items. DoorDash must track these items and show what's in stock in real time. It's frustrating to order frosted strawberry pop tarts only to find out later they are sold out!
Challenges Associated with Supporting CnG Inventory Management
DoorDash ensures the inventory of its Convenience and Grocery (CnG) merchants remains up to date by implementing three distinct refresh methods multiple times daily:
1) Automated updates through the intake of inventory files provided by the merchants.
2) The Operations team manually inputs inventory data using specialized internal software.
3) Real-time feedback from the Dasher app used by a Dasher shopping at a CnG store
With tens of thousands of CnG stores, each containing a vast array of items, inventory refreshes could encompass over a billion items per day. To manage this volume efficiently, DoorDash has developed a robust inventory platform capable of handling such data reliably, scaling as needed, and maintaining fault tolerance.
Technical Features They Needed for a Robust Inventory Platform
For an inventory platform to perform optimally and efficiently manage a merchant's in-store inventory, several technical requirements must be met:
High Scalability: As the business expands, the inventory platform should be able to handle an increasing number of items and support frequent updates, ensuring that inventory information remains up-to-date.
Outstanding Reliability: A trustworthy pipeline is critical for ensuring that all valid inventory updates from merchants are processed successfully and in a timely manner.
Low Latency: The latency between receiving data from the merchant and displaying the data to the customer should be kept to a minimum, as item information, particularly relating to price and availability, is time-sensitive.
High Observability: The inventory management system should allow for detailed and historical item-level information to be visible to internal operators.
Comprehensive Validations and Safeguards: The system must be capable of filtering which items are shown to customers and provide explanations for why certain items provided by the merchant are not displayed.
A Look into DoorDash's Technology Choices
DoorDash's inventory management system uses innovative technologies:
Cadence, an open-source workflow orchestration tool developed by Uber, manages microservices and coordinates tasks.
CockroachDB, a distributed SQL database, offers a scalable solution while being compatible with Postgres. These technologies enable DoorDash to efficiently scale and streamline its operations.
Functional Architecture of Streamlined Inventory Management System
The system collects item inventory information from various sources, which consist of:
CSV files provided by retailers having data on item inventory
DoorDash drivers indicating items that are out of stock within the app
Data from Point-of-Sales devices, which show which items are being bought
And more!
High-level design of inventory ingestion pipeline
Source: DoorDash Tech Blog
Below are the steps:
API Gateway: The gRPC-based API gateway serves as a streamlined entry point for inventory data from various sources such as merchants, internal operators, or Dashers.
Data Storage: The platform securely handles and stores raw inventory inputs for easy access and use by other workflows. Additionally, it assists in monitoring and troubleshooting any data irregularities that may arise.
Inventory Enrichment: The system enriches raw inventory data with catalog attributes obtained from an external service, allowing for a complete and detailed view of each item.
Dynamic Price Calculation: Dependencies on external configurations allow the platform to calculate item prices accurately based on various factors, such as the weight of an item or its unit price.
Predictive Availability Analysis: A sophisticated predictive model analyzes historical order and item-not-found data to provide more accurate item availability status and bridge gaps between signal inputs from various sources.
Pipeline Guardrails: The platform incorporates proactive checks and alerts to prevent potential data anomalies or pricing issues from affecting the customer experience.
Monitoring and Observability: A comprehensive monitoring system enables item-level and store-level tracking and observability of the platform's performance, contributing directly to the calculation of business OKRs.
Reliability and Fault Tolerance: Utilizing Cadence as a workflow orchestrator, the platform handles extensive computations and dependencies through asynchronous processing, providing features such as retry mechanisms and heartbeat monitoring for increased reliability.
Optimizing the System
The initial version of the inventory platform relied on item-level API calls for updates.
However, as more stores were added to the system and performance became a critical factor, several changes were made. These included switching to batch API calls for improved efficiency, optimizing database tables for faster access, and transitioning to store-level processing for quicker data retrieval.
By implementing these changes, DoorDash significantly improved the overall performance of its inventory management system.
Through a series of iterative improvements, the DoorDash team successfully scaled its inventory platform, resulting in
75% reduction in item processing time,
99% decrease in database load, and
50% reduction in database CPU utilization
While the technical aspects of the project may be complex, the overall takeaway is clear. A well-designed, efficient, and scalable inventory system is important to succeed in this non-stop rollercoaster that is modern commerce!