1. Learning the Basics of the Polly Framework Flashcards
What two categories can Polly resilience strategies be broken into?
- Reactive
2. Proactive
What is a reactive resilience strategy?
A resilience strategy that is triggered in response to a current and perhaps transient issue, like a server fault.
What is a proactive resilience strategy?
A resilience strategy that monitors for ongoing problems and attempts to stabilise the system when facing degraded quality or longer outages in remote services.
What reactive resilience strategies does Polly offer us?
- The
Retry
Policy - The
Wait and Retry
Policy - The
Circuit Breaker
Policy - The
Fallback
Policy
What does the Retry
policy do?
Immediately retries the request some specified number of times without any delay.
What does the Wait and Retry
policy do?
Works like the Retry
but introduces a delay before each retry.
What does the Circuit Breaker
policy do?
Stops all requests to an endpoint if some failure threshold is reached.
What does the Fallback
policy do?
Returns some specified default value if the request fails
ps. Often used in conjunction with other policies
What can the use of delegates with the policies offered by Polly allow us to do?
Run custom code as part of the policy. For example, we can check if the cause of a failure was a specific error and look to resolve it before retrying the original request.
What proactive resilience strategies does Polly offer us?
- The
Timeout
Policy - The
Caching
Policy - The
Bulkhead Isolation
Policy
What does the Timeout
policy do?
Set the timeout for a request rather than waiting for default as implemented by the HttpClient.
What does the Caching
policy do?
Cache responses for a period of time and then channel future requests to the cache rather than the remote service.
What does the Bulkhead Isolation
policy do?
Manage the load on your own application by limiting the number of concurrently executing requests and limiting the size of the queue of requests that are waiting to execute.
What is a resilience framework?
There is no agreed-upon definition, but you can think of it as a set of libraries that help an application to recover from transient or longer failures in services or infrastructure upon which it depends when recovery is possible, and that facilitates graceful degradation of your application when it is not.
When does a Retry
policy retries the request?
Immediately after failure.