Library

Volume 1 · System Design Scenarios

Notebook
Sign in

Section 59

Globally Distributed E-Commerce System

343 words · about 2 min

Problem Statement

Design an e-commerce platform serving customers across North America, Europe, and APAC with low latency everywhere, strong consistency for inventory/payments, and 99.99% availability.

Architecture

Users (Global) -> Global Load Balancer / Anycast CDN (latency-based routing)
                              |
        +-----------------------+-----------------------+
        v                     v                     v
   us-east-1 Region      eu-west-1 Region      ap-south-1 Region
   (full stack)            (full stack)           (full stack)
        |                     |                     |
        +-----------------------+-----------------------+
                    Global Database Layer
        Product Catalog: multi-region read replicas (eventual consistency OK)
        Inventory: single source of truth per SKU-region with async reconciliation,
                   OR strongly-consistent regional partitioning (no cross-region overselling)
        Orders/Payments: region-local, strongly consistent (never cross-region for a single order)
        User Profile: multi-region active-active with conflict resolution (last-write-wins
                      or CRDT for cart merges)

Key Design Decisions

  • Catalog is read-heavy and latency-sensitive -> CDN-cached, eventually-consistent multi-region replicas; a few seconds of staleness on “product description updated” is acceptable.
  • Inventory is the hard consistency problem -> partition SKUs to a home region (avoids distributed locking for the common case) or use a strongly-consistent global database (e.g., Spanner-style) only for the inventory-decrement hot path, keeping everything else eventually consistent. Overselling is worse than under-selling — bias the design toward “reserve pessimistically, release on timeout.”
  • Payments never cross regions mid-transaction — route a checkout to the customer’s home region and keep the entire payment saga within that region’s strongly-consistent database; cross-region payment coordination adds latency and failure surface for no real benefit.
  • Cart state — active-active multi-region with a CRDT-style merge (union of items, last-write-wins on quantity) so a customer’s cart survives failover without the added-item conflict resolution being visibly wrong.
  • DR/failover: each region can absorb the traffic of one failed peer region (N+1 capacity headroom); DNS/anycast-based failover with health probes, RTO < 5 minutes, RPO < 30 seconds via async cross-region replication.

Data Consistency Summary Table

Data Type Consistency Model Rationale
Product catalog Eventual (multi-region replicas) Read-heavy, staleness tolerable
Inventory Strong within home region Overselling is a hard business failure
Orders / Payments Strong, single-region per order Financial correctness is non-negotiable
User profile Active-active, conflict-resolved Availability favored over perfect consistency
Recommendations Eventual, best-effort Non-critical, freshness within minutes is fine