KatInterview

E-Commerce Catalog and Inventory Management System Design

System DesignModel answer
MediumModel answerSystem Designe-commercedistributed-systemscaching

Last updated

Build a scalable service handling product information, pricing logic, and stock management with high read throughput and strong checkout consistency.

Problem Context

You need to architect a backend service for an online retail platform that manages three interconnected domains: product catalog data, pricing information, and stock levels. This service powers both customer-facing browsing experiences and critical checkout operations.

Shoppers view thousands of product pages per minute, checking descriptions and availability. Meanwhile, a separate order processing system coordinates with your service during purchase flows to lock inventory and validate prices. Behind the scenes, merchandising teams and automated repricing systems continuously adjust prices and promotional offers.

What You Must Support

Your design should handle:

  • Product Information Retrieval: Return product descriptions, current pricing, and stock status for display on browse and search pages
  • Price Modifications: Allow authorized systems to change prices with full audit trails and version tracking
  • Stock Operations: Support atomic inventory checks and holds during checkout, with rollback capability if transactions fail

Scale and Performance Targets

  • Catalog scope: 20 million distinct products
  • Read load: Peak traffic reaches 100,000 requests/second
  • Write load: 2,000 inventory or pricing changes/second normally, but individual products can see bursts of 10,000 requests/second during promotional events
  • Latency requirements: Browse requests should complete within 25ms at the 99th percentile
  • Consistency model:
    • Browsing can tolerate multi-second staleness for inventory counts
    • Checkout must enforce strict consistency—no overselling or price manipulation
  • Access control: All write operations require authentication and role-based authorization

Design Areas to Address

  1. API contracts: Specify endpoints for reading product data, changing prices, and managing inventory reservations, including mechanisms to prevent duplicate operations
  2. Storage architecture: Choose appropriate database technologies for each data type and explain partitioning strategies for product metadata, pricing records, and inventory ledgers
  3. Performance optimization: Design caching layers and explain cache invalidation approaches; address how to handle extreme concurrency on popular items through locking strategies or alternative patterns
  4. Transactional integrity: Describe the interaction flow between your service and checkout systems to ensure displayed prices match charged prices and that abandoned carts properly release held inventory

Hints

Hint 1

Consider separating concerns by data volatility—catalog metadata changes infrequently while inventory fluctuates constantly

Hint 2

Flash sale scenarios create hotspot contention; evaluate whether traditional row locks suffice or if you need reservation queues

Hint 3

Design the checkout flow around immutable price quotes with expiration times to prevent exploitation of stale cached prices