Skip to content

Architectural Evolution

The challenge of high-concurrency inventory—the “Sneaker Drop” problem—has evolved through three distinct architectural patterns.

EraArchitectureConsistency StrategyWrite LatencyOversell RiskCost Scalability
Legacy SQL (2000s)Single DB + Row LocksPessimistic LockingHigh (DB RTT)ZeroPoor (DB Bottleneck)
Cloud 1.0 (2010s)Regional DB + Redis CacheEventual / OptimisticMedium (Regional RTT)HighExpensive (Over-provisioning)
Cloud 2.0 (Today)Edge-Native (Durable Objects)Atomic SerialisationUltra-Low (<15ms)ZeroEfficient (Pay-per-request)

[!IMPORTANT] Revenue Guard represents the shift from “How do we scale the database?” to “How do we move the source of truth to the user?”


In the early days of e-commerce, every transaction was a direct row operation in a centralised SQL database.

  • The Mechanism: SELECT FOR UPDATE. The first request to arrive locked the row, decremented the count, and committed. All other concurrent requests waited in a queue.
  • The Failure Mode: Under “drop” conditions (e.g., 50k requests in 1 second), the lock contention destroyed throughput. The database spent more time managing lock queues than processing sales. The site would “white out” or time out, even if inventory was still available.

To solve the SQL bottleneck, we moved to “Serverless” stacks with distributed caches like Redis or NoSQL stores like DynamoDB.

  • The Mechanism: Incrementing/decrementing a counter in a fast, in-memory cache, then asynchronously syncing back to the main database.
  • The Failure Mode: This introduced The Consistency Gap. Because replication across regions takes time, two distinct edge nodes might both see stock=1 in their local cache. Both allow the sale. By the time they sync, you’ve sold two items when you only had one. This leads to the “Oversell” nightmare—refunds, customer support tickets, and brand damage.

Revenue Guard uses Cloudflare Durable Objects to achieve the “Holy Grail”: the speed of a cache with the absolute consistency of a single-threaded SQL lock.

  • The Mechanism: We shard the world by SKU. Each product has exactly one Durable Object responsible for its count. Because this object is single-threaded and persistent, it acts as a perfect serialisation point.
  • Why it Wins:
    • No Contention: Requests are processed in micro-seconds, one by one, with zero lock overhead.
    • No Oversell: The object’s memory is the only source of truth for the count.
    • Zero RTT: The object lives on the Cloudflare network, often just milliseconds away from the user, eliminating the 200ms round-trip to a centralised database.
CapabilityLegacy SQLCloud 1.0 (Redis/NoSQL)Cloud 2.0 (Revenue Guard)
Scaling PatternVertical (Bigger DB)Horizontal (More Nodes)Functional (Per-SKU Sharding)
Write ConsistencyStrong (Local)Eventual (Global)Strong (Global Serialisation)
Locking OverheadMassive (Row Contention)Minimal (Race Risk)Zero (Single-threaded Isolate)
Global LatencyHigh (Regional RTT)Medium (Cache Sync RTT)Ultra-Low (Edge Resident)
Operational EffortHigh (DBA required)High (Cache clusters/Sync)Zero (Fully Managed Isolate)