Meet Polly: The .NET resilience library
Polly is a powerful library for .NET that helps you handle transient faults and improve the resilience of your applications. With Polly, you can easily define and apply strategies such as Retry, Circuit Breaker, Hedging, Timeout, Rate Limiter and Fallback to handle failures and slowdowns in a fluent and thread-safe way.
Polly is part of the .NET Foundation!
What can Polly do for you?
Polly lets you use and combine different resilience strategies to cope with various scenarios, such as:
- Retry: Try again if something fails. This can be useful when the problem is temporary and might go away.
- Circuit Breaker: Stop trying if something is broken or busy. This can benefit you by avoiding wasting time and making things worse. It can also support the system to recover.
- Timeout: Give up if something takes too long. This can improve your performance by freeing up space and resources.
- Rate Limiter: Limit how many requests you make or accept. This can enable you to control the load and prevent problems or penalties.
- Fallback: Do something else if something fails. This can improve your user experience and keep the program working.
- Hedging: Do more than one thing at the same time and take the fastest one. This can make your program faster and more responsive.
You can learn more about each strategy and how to use them resilience strategies section.
How to get started with Polly?
Polly is easy to install and use. You can follow the getting started guide to add and start using Polly in your projects.
Where to find more information?
Polly has a rich documentation that covers various topics, such as:
- Resilience strategies: A collection of strategies for improving the resilience of your system.
- Resilience pipelines: How to combine and reuse strategies in a flexible and modular way.
- Telemetry and monitoring: How to access and analyze the data generated by Polly strategies and pipelines.
- Dependency injection: How to integrate Polly with dependency injection frameworks and containers.
- Performance: Tips on optimizing and getting the best performance from Polly.
- Testing: How to test the composition and configuration of resilience pipelines.
- Chaos engineering: How to use Polly to inject faults and test the resilience of your system.
- Extensibility: How to create and use custom strategies and extensions for Polly.
You can also find many resources and community contributions, such as:
- Samples: Samples in this repository that serve as an introduction to Polly.
- Practical Samples: Practical examples for using various implementations of Polly. Please feel free to contribute to the Polly-Samples repository in order to assist others who are either learning Polly for the first time, or are seeking advanced examples and novel approaches provided by our generous community.
- Polly-Contrib: Community projects and libraries that extend and enhance Polly's functionality and ecosystem.
- Libraries and contributions: Dependencies and contributors that make Polly possible and awesome.
- Microsoft's eShopOnContainers project: Sample project demonstrating a .NET Micro-services architecture and using Polly for resilience.
- Git Workflow: Our suggested Git workflow for contributing to Polly.
You can browse the documentation using the sidebar or visit the API section for the reference documentation.