-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Introduce Hedging Strategy #876
Comments
Sorry for the delayed reply. This sounds interesting, but at this time I don't think this is something we'd have the bandwidth to add to a shipping version of Polly any time soon, but does sound like a candidate for something over in https://github.com/Polly-Contrib. I don't know what the policies etc. are for dealing with that, I don't have access to that. Maybe @joelhulen, @DreamOfTheRedChamber, @mebjas or @vany0114 could help you out. |
I also apologize for the late reply. I just saw this issue. I can help you get up and running under Polly-Contrib, which is our officially recognized community projects that extend Polly's core functionality. Any Polly.Contrib NuGet packages are recognized as part of the Polly organization as well. Please reach out to me at joelhulen at gmail.com Thanks! |
@joelhulen : sent you an email, we are interested in this feature as well and can contribute. |
@joelhulen I sent you an email last month, not sure if you got it. Please let me know :). |
Hey, everyone. Sorry I missed this thread. I have created the new
Polly.Contrib project here:
https://github.com/Polly-Contrib/Polly.Contrib.RequestHedging and added
both Alex and Laura. I will work with both of them to make sure they can
successfully publish official Polly.Contrib NuGet packages.
Thanks!
Joel
…On Thu, Sep 30, 2021 at 7:22 AM Laura ***@***.***> wrote:
@joelhulen <https://github.com/joelhulen> I sent you an email last month,
not sure if you got it. Please let me know :).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#876 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNMWYGMXWITMVFXE244LETUERB63ANCNFSM5BIWPLRQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I have created a new repo generically for Hedging vs. the more specific RequestHedging I had previously created (and archived). @laura-mi, I've added you as an admin to this repo: https://github.com/Polly-Contrib/Polly.Contrib.Hedging per your request. |
Since the hedging strategy will be implemented by us as maintainers and it doesn't have any additional dependencies, we were discussing to include hedging directly in the new |
No objections from me. |
I have no objections, either. In fact, I find that any contrib project migrating to core is a win :) |
The hedging will be adopted directly in
|
Is it still possible to use the Contrib.Hedging nuget somehow? I recall it had the ability to issue the hedging request if the duration crossed the duration of some percentile. I.e. the hedging policy would record what is the pXX and use it as the threshold for issuing the hedging request. I don't see this in the v8 docs anymore. Thank you ! |
I don't think there is any hedging available for Polly V7. |
are you sure? I remember a repo Is it possible to get access this code somehow? |
The repo is here, and it's been archived: https://github.com/Polly-Contrib/Polly.Contrib.RequestHedging The contrib stuff is maintained independently from the core Polly library. AFAIK, no contrib libraries have been updated to be compatible with the new APIs in Polly.Core for v8. |
We are working on the development of a generic
HedgingPolicy
to use as part of ourHttpClient
Resilience pipeline.Since the hedging as a policy is not yet supported by Polly we consider setting up a new package dedicated to the generic implementation of such policy. Please let us know if you are interested in having this and how we could proceed further.
Summary
The hedging policy will allow the sequential and delayed execution of a set of tasks, until one of them completes successfully or until all of them are completed.
First task that is successfully completed triggers the cancellation and disposal of all other tasks and/or adjacent allocated resources.
General structure of polly policy:
Async<PolicyName>Syntax
exposes extension method for thePolicyBuilder
which builds new instances of theAsync<PolicyName>
:AsyncHedgingSyntax
exposes methods to createAsyncHedgingPolicy
instances.Async<PolicyName>Policy
is the actual policy, which:AsyncPolicy<TResult>
base classAsync<PolicyName>Syntax
extensions.Async<PolicyName>Syntax
which contains the actual implementation, i.e.AsyncHedgingPolicy
Hedging policy configuration
The base implementation will take:
HedgingDelay
- how long shall one wait before spawning a new hedged request;OnHedgingAsync
- task performed after every spawning a hedged request; [can be used for logging & telemetry]hedgedTaskFunctions
- the tasks performed via hedging if the primary execution delegate fails.Hedging logic
Steps:
Exposed API for policy creation:
The text was updated successfully, but these errors were encountered: