How does retrying and backoffs work? #2374
v-flashpoint
started this conversation in
General
Replies: 2 comments 1 reply
-
@v-flashpoint did you get to the bottom of this? I've stumbled across your post with similar curiosities! |
Beta Was this translation helpful? Give feedback.
0 replies
-
I actually didn't! I've ended up with it just left on default settings and waiting for a problem to show up. Probably not the best approach, but it was really my only option :/ |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been trying to add a few failsafes to my system in case of less-than-adequate network conditions lately, specifically relating to catching requests to Redis that time out.
However, I'm afraid I'm not entirely how the various timeouts and retry settings work together. I've read the documentation and done a bit of experimenting, but I'm afraid it's not helped much!
I think what I'm doing is a bit unorthodox, but I'll try to explain.
I'm using "clumsy" to simulate network drop out. Just for testing purposes, I've added a 5 second sleep() to the code, at which point I turn on clumsy (set to drop 100% of packets), time six or seven seconds, and then turn it off again, at which point I'm expecting to see the result returned. So my code looks like this
In this situation, I'd expect that the get request to Redis is going to timeout after one second, then retry, up to a total of 10 times with a 100ms gap in between. As such, it should take around ten seconds to exhaust its retry budget and throw an error. That means if I turn clumsy off in around six or seven seconds, the request should still resolve. But it doesn't - I end up getting "null" back. In fact, no matter what combination I set in terms of numbers of retries, nothing seems to make it resolve.
The only way I can get the result is by setting the read timeout in connect() to 10 seconds, but then I'm assuming the request isn't actually being retried at all - it's just waiting to get connection back, and then returning.
I can only assume there's something I'm really not following here, but I'm not sure what! Any advice would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions