Deep dive
singleflight: How Go Collapses Duplicate Calls Under a Thundering Herd
When a hot cache key expires, N concurrent requests all miss and slam the same expensive query at once. golang.org/x/sync/singleflight collapses them into a single execution. Here's the problem it solves and exactly how it works inside.
8 min read