Go singleflight: Cancellation and Shutdown
Learn how Go singleflight prevents cache stampedes, why caller cancellation gets tricky, and how to safely cancel and drain shared work during shutdown.
Staff Software Engineer at Walmart Global Tech, based in Bengaluru.
I work on distributed systems and platform infrastructure, mostly in Go. I write about databases, runtimes, performance, and the parts of software that are easy to use but difficult to understand.
Away from software, I make photographs and sometimes write poetry.
Things I build and maintain outside work.
Learn how Go singleflight prevents cache stampedes, why caller cancellation gets tricky, and how to safely cancel and drain shared work during shutdown.
How an LSM tree gives us the right building blocks, and where object storage changes the design.
How hierarchical timing wheels expire millions of cache entries efficiently in Go without periodic O(n) scans or a timer per key.
An illustrated tour of Go’s runtime scheduler: operating-system foundations, the G-M-P model, work stealing, preemption, and scheduler traces.
I keep source code on GitHub, photographs on 500px, and poetry at Tangled Vibes.