-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for exponential backoff retry #220
Comments
sounds useful. +1 from me. |
We can add one more method to configure the backoffFactor with the default value of 2 |
+1 |
1 similar comment
+1 |
Should be ok for our implementation. So +1 for me |
Very useful. We can start agressive at first and then get slower and slower until we reach a max value and decide it's dead :) |
I see the pull request is like 20 LOC, what is the holdup for the merge? |
We talked this PR and had some questions. @antoinesd is going to update his PR accordingly. I will try to take this over, if Antoine cannot get around to do it. |
@Emily-Jiang I am really interested in this feature as well, but instead of focusing on backoff retry. I'd create some kind of interface called So the API should look like:
|
When I was looking at this a while ago, I realized that even adding just exponential backoff results in adding not-exactly-intuitive parameters to I personally would lean towards using more than one annotation. Just |
Well I have been checking in Microsoft patterns library and they support three (iterative, constant, exponential) but then if you check Awaitility open source project, you'll see that also supports Fibonacci, so I guess that these four strategies might be interesting to support. |
Signed-off-by: Emily Jiang <[email protected]>
Let's discuss further next Tuesday and agree on the solution. |
We discussed this on the call. We thought:
For these reasons, we thought we could cover most use cases by just adding one parameter to Usage: @Retry(delay=500, delayGrowth="fibonacci") This allows us to add new strategies to the spec in the future and allows implementers to provide extra strategies if desired. |
Personally, I don't really like the string approach, and some of the strategy names are too easy to misspell (exponential, fibonacci). I think we should use an enum. On the other hand, I can see how string is appealing -- it can possibly even include a FQN of a class implementing some interface, which allows for ultimate flexibility. But there's an easy way how to allow that with an enum -- extra enum value |
As promised, I investigated this a bit more. Resilience4j has exponential backoff and random exponential backoff. Failsafe has also exponential backoff . I think we need to support similar exponential backoff as a minimum. |
It is not 100% accurate. The statement says:
The performance is better when used in a mobile ad hoc network, which is very narrow use case. Remember the exponential backoff is used by the standare IEEE 802.11, which means a lot and it is very widely adopted strategy, as demonstrated by both failsafe and Resilience4j. |
That's an out-of-context quote, as the entire paper focuses on that particular scenario. There are other papers that examine various backoff strategies in different contexts, e.g. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5375778/ What I mainly wanted to say is that only adding exponential backoff in the proposed way means we won't be able to add other backoff strategies in the future. Currently, I even think that the amount of time we spent debating this shows that the design of |
I would give a +1 to the single property with Another thought that came on my mind is whether the policy mechanism has wider use outside of |
At this point, I can think of several options that make some sense to me. I wanted to summarize them here. Beware, I don't fear of breaking changes :-)
I would personally prefer option 1, obviously :-) |
Hey guys, can we have an update on this ER, it is something we would need for our project. |
There's been no movement on this on the specification front. Depending on which implementation of MicroProfile Fault Tolerance you use, you may already have additional backoff strategies at your disposal. (Shameless plug: SmallRye Fault Tolerance provides exponential backoff, Fibonacci backoff, and completely custom backoff since version 5.2.0, see https://smallrye.io/blog/fault-tolerance-5-2/) |
Failsafe already has support for this.
Preferred and less wasteful policy than fixed period when the target service could be under heavy load and unresponsive for longer periods of time.
The text was updated successfully, but these errors were encountered: