3 ms·
For patterns like this I like to reach for request coalescing. Here's an example of a package that does it in the golang standard lib https://godoc.org/golang.o
by jwahba 7y ago
For patterns like this I like to reach for request coalescing. Here's an example of a package that does it in the golang standard lib https://godoc.org/golang.org/x/sync/singleflight https://godoc.org/golang.org/x/sync/singleflight
- regecks 7y agoBig fan of request coalescing, was introduced to it by Varnish. Really helps when a cache entry drops. I believe what the article did is called a "grace period". Are there any open implementations of distributed request coalescing? Pretty easy to do using a service proxy, but what about something like a Raft cluster?
- tyingq 7y agoI'm curious if assigning a random value from an acceptable range for the expiry time is a common approach. I assume that wouldn't work for all cases, but might spread the avalanche for some. Google searches on this topic (random expiry to mitigate an avalanche cache refresh) turn up very little.
- NovaX 7y agoIt is very common and often referred to as jitter. A variation, called scaled ttl, was nicely discussed in this video. https://www.youtube.com/watch?v=kxMKnx__uso https://www.youtube.com/watch?v=kxMKnx__uso