Cloudflare Durable Objects fix stops 800 Workers hammering origin on cache miss
A developer running a Korean flash sale was hit with an unexpected $40 bill after 800 concurrent Cloudflare Workers simultaneously missed a KV cache and flooded the origin server with requests within a 120ms window. The root cause was a timing gap between KV write latency (~80ms) and origin fetch time (~120ms), allowing hundreds of Workers to independently treat the cache as cold. The solution, known as request coalescing, ensures only one Worker fetches from the origin while all others await the same in-flight promise. This was implemented using a Cloudflare Durable Object, which runs in a single-threaded environment, making it safe to store and share in-flight promises without race conditions. A key refinement was assigning one Durable Object instance per resource key rather than a single global instance, preventing slow fetches for one resource from blocking others.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in