Practice/Amazon/Design a Warehouse Management System
Design a Warehouse Management System
System DesignMust
Problem Statement
Design a warehouse management system (WMS) that handles inventory tracking, order fulfillment, and warehouse operations to optimize storage and distribution efficiency. The system tracks goods at the bin/lot/serial level, guides workers through receiving, putaway, picking, packing, and shipping workflows using handheld scanners, and provides real-time visibility into inventory and work status.
Interviewers use this question to test your ability to model real-world workflows with humans in the loop, maintain inventory accuracy under heavy contention, and design event-driven scalable systems. Expect to reason about reservations vs on-hand inventory, multi-step processes with retries, real-time updates to devices and dashboards, and auditability.
Key Requirements
Functional
- Inventory tracking -- track inventory at warehouse location level (bins/slots) including states like on-hand, reserved, and shipped, with support for lots and serials
- Inbound receiving -- receive inbound shipments, inspect items, and put away into specific warehouse locations using directed putaway rules
- Order fulfillment -- allocate stock, issue pick tasks to workers, confirm picks via scanner, pack orders, and generate shipping labels
- Real-time visibility -- see real-time inventory levels, work progress, exceptions, and cycle count status through dashboards and search
Non-Functional
- Scalability -- support warehouses with millions of SKUs, thousands of bin locations, and hundreds of concurrent workers processing thousands of orders per hour
- Reliability -- maintain 99.9% uptime; inventory accuracy within 99.5% with periodic cycle count reconciliation
- Latency -- scanner task assignments under 200ms, inventory queries under 500ms, real-time dashboard updates within 2 seconds
- Consistency -- strong consistency for inventory reservations and decrements; eventual consistency for dashboard aggregates and analytics
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Inventory Contention and Reservation
Popular SKUs and wave picking create hotspots where many workers and orders compete to update the same inventory quantities.
Hints to consider:
- Use atomic decrements with conditional writes on per-location inventory records to prevent overselling
- Implement a two-phase reservation: soft reserve (allocated to order) then hard commit (picked by worker), with automatic release on timeout
- Partition inventory records by (warehouse, location, SKU) to minimize lock contention on hot items
- Design available-to-promise (ATP) calculations that account for on-hand minus reserved quantities, cached in Redis for fast reads
2. Multi-Step Fulfillment Workflow
Inbound receiving, putaway, picking, packing, and shipping form long-running, human-in-the-loop workflows where each step can fail or be interrupted.
Hints to consider:
- Model each fulfillment workflow as a state machine with explicit states, valid transitions, and compensating actions
- Use idempotent scanner events: if a worker scans the same barcode twice, the system recognizes the duplicate and does not double-decrement
- Implement task assignment that distributes work fairly across workers, considering proximity to pick locations
- Design for partial failures: if a worker cannot find an item at the directed location, create an exception task and attempt to fulfill from an alternate location
3. Real-Time Worker Guidance
Handheld devices need instant task assignments and validation, while control-room dashboards need live progress visibility.
Hints to consider:
- Use WebSocket or push connections to handheld devices for real-time task assignment and status updates
- Cache hot data (task queues, location lookups) in Redis to minimize database load from scanner-driven queries
- Publish inventory and workflow events to Kafka for fan-out to dashboards, analytics, and upstream e-commerce systems
- Design the task queue as a priority queue considering order SLA, worker location, and pick path optimization
4. Data Model and Auditability
Inventory movements must be fully auditable for compliance, dispute resolution, and accuracy tracking.
Hints to consider:
- Record every inventory movement as an immutable event (receipt, putaway, pick, pack, ship, adjustment) with timestamp, actor, and location
- Derive current inventory state from the event log, with materialized views for fast queries
- Support cycle counting workflows that reconcile physical counts with system records, creating adjustment events for discrepancies
- Design reports showing inventory accuracy trends, fulfillment rates, and worker productivity from the event stream
Suggested Approach
Step 1: Clarify Requirements
Confirm scope with the interviewer. Ask about warehouse size and layout, number of SKUs, whether multi-warehouse operation is in scope, types of goods (standard, temperature-controlled, hazmat), and fulfillment models (single-item vs wave picking vs batch). Clarify integration points: does the system receive orders from an external OMS or manage orders internally? Establish whether returns processing and quality inspection are in scope.