Katkat

Design a Perishable-Goods Inventory and Location Tracking System

AmazonSoftware Engineer · Technical Screen

Last updated

This question tests the ability to design a distributed inventory system that handles high-frequency location updates and strict FIFO/expiry logic for perishable goods.

Problem Statement

Design a system for a large retail chain to track the inventory and real-time location of perishable goods (e.g., produce, dairy) across multiple warehouses and delivery vehicles.

Functional Requirements

  1. Track the current location of every inventory item in real-time.
  2. Record the expiration date of items upon receipt.
  3. Support querying the nearest N items of a specific product type that expire within a certain timeframe.
  4. Provide a mechanism to trigger alerts when an item is nearing its expiration date.

Non-Functional Requirements

  1. High availability for location updates.
  2. Low latency for inventory lookup queries.
  3. Data consistency is required for stock counts to prevent over-selling.
  4. Scalability: The system must handle millions of items and thousands of updates per second.

Expectations

Provide a high-level architecture diagram or description covering:

  • API design for reporting locations and querying inventory.
  • Data model for items and warehouse locations.
  • Database choices for the geo-spatial tracking vs. the inventory state.
  • A strategy for handling high-volume location updates without bottlenecking the primary database.

Hints

Hint 1

Consider using a geo-spatial indexing solution like Quadtrees or Geohashing to manage item proximity efficiently.

Hint 2

Think about the difference between a write-heavy ingestion path for sensor data and a read-heavy path for inventory management.

Hint 3

Use a message queue or event streaming platform to decouple location updates from the main database writes.

Follow-up questions

  • How would you handle the 'hot spot' problem if a large distribution center receives thousands of item updates simultaneously?
  • What specific database technologies would you choose for storing historical location data versus real-time current location data, and why?
  • How would you ensure that expired items are automatically purged or flagged if a background service fails?