A .NET resilience and transient-fault-handling library for expressing policies like Retry, Circuit Breaker, and Timeout in a fluent, thread-safe manner.
Polly is a .NET library for resilience and transient-fault handling that allows developers to define and execute policies like Retry, Circuit Breaker, Timeout, and Fallback. It solves the problem of building robust applications that can gracefully handle failures, timeouts, and overloads in distributed systems and microservices architectures.
.NET developers building applications that interact with external services, APIs, or databases, particularly those working on microservices, cloud-native systems, or any scenario requiring fault tolerance and resilience.
Developers choose Polly for its fluent, thread-safe API, comprehensive set of built-in resilience strategies, and seamless integration with .NET dependency injection. It provides a standardized, battle-tested approach to handling transient faults without reinventing the wheel.
Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. From version 6.0.1, Polly targets .NET Standard 1.1 and 2.0+.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Polly offers a wide range of built-in resilience strategies including retry, circuit breaker, hedging, and rate limiting, as evidenced by the Key Features list covering reactive and proactive approaches.
The library emphasizes a fluent, thread-safe API for defining resilience pipelines, allowing developers to combine strategies with minimal boilerplate, as stated in the Philosophy section.
Through the Polly.Extensions package, it provides seamless dependency injection support with AddResiliencePipeline, enabling easy pipeline management in .NET applications, as shown in the Quick Start DI snippet.
Backed by sponsors like AWS, Microsoft, and GitHub, and part of the .NET Foundation, Polly is actively maintained with recent additions like chaos engineering in v8.3.0, ensuring ongoing updates and community support.
Polly requires manual definition and tuning of each resilience strategy, which can lead to complex setup and potential misconfiguration, especially for beginners or rapid prototyping scenarios.
The shift to v8 introduced a new API that is not backward compatible with v7, forcing migration efforts and potential code rewrites, as highlighted in the IMPORTANT note about documentation differences.
Each added strategy incurs runtime overhead, such as latency from retry delays or circuit breaker state checks, which may not be suitable for latency-sensitive applications without careful optimization.