5 ms·
Consider randomizing error_timeout, to avoid a possible case where all clients retry at the same time.
by klodolph 7y ago
Consider randomizing error_timeout, to avoid a possible case where all clients retry at the same time.
- smoyer 7y agoWe use this quite a bit but we actually have a constant timeout with random "jitter" added to it. You almost never want the timeout completely randomized because there's a chance you'll get a zero.
- klodolph 7y agoThe concept of “completely randomizing” something isn’t really well-defined, it’s more of a casual phrase that people use without thinking about it. If you have a constant timeout with random jitter added to it, you’ve randomized it. It is now random. If you think about it, a “perfectly random” die roll on an ordinary die will never be 0. So, whether a value is random has no relationship with whether that value can be 0.
- ed_balls 7y agoyou don't want it random. You want to add a splay .e.g # add a random value (from 0 to X) to the timeout # This can be used to prevent the thundering herd problem splay = "5s"
- speedgoose 7y agoAfter reading your comment, I did consider to implement that in my codebase and then I remembered that I have so few servers that it would not matter. Even if my company has to scale up to 99% of the market.
- londons_explore 7y agoI suggest you do it anyway. It's a one line code or config change, yet if you do suffer the "stampeding herd" problem, it's hard to diagnose and hard to fix in the middle of another production outage.
- brobinson 7y ago("thundering" herd in case anyone wants to google it)