Future Polly Roadmap - **community feedback sought**
App-vNext has published a Roadmap for Polly.
We are actively seeking community feedback on the roadmap.
Which aspects of the roadmap would be a priority for you, and which not?
Do you have views on how the features in the roadmap should be implemented?
Are there features you'd like to see, that are not on the roadmap?
What is your view on the longer-term possibility, to grow Polly towards a more general resiliency framework for .NET? (as Hystrix is for Java) – for detail see Roadmap. .
Please comment on the Roadmap under this placeholder issue.
About your last point:
Several of our teams working on .NET projects have recommended Polly as being useful in building microservice-based systems. It encourages the fluent expression of transient exception-handling policies and the Circuit Breaker pattern, including policies such as Retry, Retry Forever and Wait and Retry. Similar libraries already exist in other languages (Hystrix for Java for example), and Polly is a welcome addition from the .NET community.
Taken from ThoughWorks Technology Radar. There is clearly a lack of good offers in the .NET ecosystem for general resiliency framework and the spotlight is already on Polly as a Hystrix(Java) alternative so why not jump on the occasion =)
On the open issue #6, I appreciate it wasn't the path the team wanted to go at the time, but I really can't see any other clean way to solve the issue below...
Two instances in their own processes, each has an instance of circuit breaker. Instance A trips at 00:00 and lasts for 5 minutes.. Due to random load balancing, most requests just happen to go to instance A. However, by chance, at 04:50 instance B gets some requests and also trips. it's 5 minute trip timer now starts. However, the tripped service is back at 05:00. The instance A breaker is cleared at 05:01 but the instance B breaker is not able to be cleared until 09:50 - 4+ minutes after when it should be able to serve requests.
I take on board all the comments re: negotiation between services and what if connection to the shared state handler goes down etc. but I'm taking the pessimistic view that if a service the breaker is protecting is dead then it's more likely that the service is really dead rather than the alternative that the service is alive but one instance can't seem to talk to it.
Besides, IMO, that can be some kind of "quorum" logic - two instances, two need to vote dead etc. More complex, but this can be part of the state handler to be developed by the poor soul (i.e. me!) who desires this kind of functionality...
Hi @bunceg, many thanks for the input! Noted that you are still looking for the best solution to shared circuit-breaker state across processes with Polly, and/or a feature to inject state into a circuit. Further views on this welcome from across the community...
@bunceg I'll respond to the specific scenario back within #6, since that feels like it might turn into a longer discussion.
Following the live demo today at devinteractions, there was a request to add caching into the policy pipeline. So we've added to the roadmap a proposal drawing on ICacheProvider, to allow any existing .NET cache implementation.
// Possible configuration syntax
var cachingPolicy = Policy
.CacheProvider(ICacheProvider provider);
// Execution syntax might different slightly from the normal policy .Execute() syntax, eg:
// Possible syntax:
cachingPolicy.ExecuteOrGetExisting<TResult>(Func<TResult> func, string cacheKey);
Other .ExecuteOrGetExisting(...) overloads could also be provided, mimicking ICacheProvider .AddOrGetExisting(...) overloads, for easy comprehension.
Comments welcome on this (or any other feature in the roadmap) under this issue.
Have you thought about implementing some kind of metrics functionality similar to what Hystrix has. It would be very useful to be able to see Circuit Breaker metrics in for example Grafana.
So the idea would be to configure for example a statsd client and use it to send metrics such as call latency, number of succeful calls, number of failed calls etc.
This is an interesting suggestion. We've spoken about ways to visualize the process flow, but not necessarily telemetry information. I wonder if capturing that data would be best served as a plug-in, and not a part of the core package? My line of thinking about this is that there is usually a trade-off between capturing this data and performance. I believe the ideal way to capture the data would be via an asynchronous tool similar to Application Insights. Minimal impact and something you can add in.
Do you have an example of the metrics Hystrix captures that you would like to see? For instance, what would be a priority at first?
Hey @pj-moviestarplanet Great idea, added stats to the roadmap. Happy for any community feedback on an architecture for this.
One question is phasing: whether to start emitting stats/events from Polly as of now or when the fuller Polly Pipeline is in place. Phased would be great if we can see far enough ahead not to introduce breaking changes later.
Related: The Polly Pipeline proposal differs from the Hystrix approach in one significant way. While Hystrix has a fixed structure in which the various elements are composed (fallback, cache, circuit-breaker etc; hmm, no retry), the Polly Pipeline proposal is currently more flexible, allowing users to compose whichever elements of the (envisaged) Polly resilience armoury they want, in any order.
The intended advantage of this flexibility is simplicity: users select and compose only the elements they want. However, a disadvantage may be if (if) that flexibility makes emitting overall stats for calls more difficult ... it may depend whether Polly's role is to emit stats or raw(er) events (perhaps as a ReactiveExtensions Observable<T>) which something else compiles to/pushes to stats.
Keen for any community feedback on the current Pipeline proposal - strengths, weaknesses? Definitely an area of the roadmap that's still up for grabs how we architect it ...
Please support .Net Standard Profile
@PaybackMan That is a great suggestion. Out of curiosity, what is the current holdup you are facing in using the PCL version of the Polly library, or is this request more out of providing greater flexibility for 3rd party libraries to be less dependent upon a specific .NET version within a given project?
Please support async methods in .NET 4.0 by using the portable Microsoft.Bcl.Async nuget.
@KBRETON1 Thanks for the vote for this! (async methods in .NET 4.0 using Microsoft.Bcl.Async). This is already in progress as #103 .
Really want to use this in a ASP.NET Core application, any idea how I can currently?
@SamuelEnglard 👍
I'm also interested in this. A lot of people are coming to dotnet core having used the snappily named "The Transient Fault Handling Application Block for Windows Azure" (topaz), and since that project seems pretty dead, it would be AWESOME if polly could take it's place, and provide a dotnet core version.
@mattwoberts The Polly team view .NET core compatibility as essential and high prio on the roadmap. The current PCL259 codebase is entirely netstandard1.0 compatible, so no major code issues. The recent flux in tooling from Microsoft has been a barrier (we have wanted to avoid tracking a moving target and that impacting other active feature development over last few weeks). We are hoping for some stability from Microsoft in the tooling coming Monday 27 but remains to be seen ...
@SamuelEnglard has made a start at this (thanks @SamuelEnglard !), @mattwoberts see conversation and links at end of #51 . I am hoping to look at this in the coming days/weeks, @mattwoberts if you also have time to evaluate and take further with @SamuelEnglard please do!
(I am just now completing #14, which will unlock the path to many of the hystrix-like features that @seanfarrow, I and many others are interested in on the long-term Roadmap ...)
@reisenberger should I make a proper pull request?
I'm interested in the pipeline idea. Is there more details on a proposal that should be implemented or copied?
Hi @adamhathcock , thanks for your interest! We are hoping to start work on the Pipeline in about a week's time (this week's focus is nuget packages supporting .NET Core). Would be great to hear any input you have on how you see this working, or the context you'd be using it in. I'm also hoping to put out an implementation proposal for comment in the next few days - @seanfarrow and others also interested in this feature.
For now, see nesting policies in the wiki, for a syntax for nesting calls through multiple policies at present. Similar syntax also works for async.
@adamhathcock @seanfarrow For a brief comment on implementation thoughts so far around the policy pipeline: I see a Pipeline represented as a linked list. However, we probably also want to retain the ability to re-use a policy across more than one call, and therefore in more than one pipeline (for benefits of this see wiki). This probably means a pipeline is a linked list of pointers to policy instances, not a linked list of actual policy instances. Thoughts?
That makes sense, do we want to give people the ability to add steps at any point in the pipeline? If yes, does a policy have an id?
@reisenberger @SeanFarrow What I have is an implementation that does exactly what you say: a pipeline that is basically a linked list and can be mutated for different calls. I want to use Polly with it and if you're doing a pipeline thing anyway maybe I could just wholesale remove my implementation.
I don't really like the look of the Nested Policies thing. It looks like there could be a better way to hook things together but each policy remain atomic? Just thinking out loud. Maybe there would have to be a special collection PolicyList that is basically a linked list that allows insertion anywhere and can be executed which invokes the policies in order at anytime.