Polly is a .NET resilience and transient-fault-handling library that enables developers to express resilience policies in a fluent and thread-safe manner. The library targets .NET Standard 1.1 and 2.0 and later versions, making it compatible with a wide range of .NET applications. Polly is a member of the .NET Foundation and maintains an active project website at thepollyproject.org for announcements, tips, and community updates.
The library provides two main categories of resilience strategies. Reactive strategies handle specific exceptions or failed results returned by executed callbacks, including Retry for handling transient faults that may self-correct after a delay, Circuit Breaker for failing fast when a system is struggling and protecting it from overload, Fallback for defining alternative values or actions on failure, and Hedging for executing parallel actions when operations are slow. Proactive strategies make decisions before execution occurs, including Timeout to prevent indefinite waiting and Rate Limiter to constrain execution rates and control load.
Polly is distributed through multiple NuGet packages with distinct purposes. Polly.Core contains the core abstractions and built-in strategies. Polly.Extensions provides telemetry and dependency injection support. Polly.RateLimiting integrates with System.Threading.RateLimiting APIs. Polly.Testing offers testing support for Polly libraries. The legacy Polly package maintains backward compatibility with pre-version 8 APIs, while version 8 introduces a new API architecture based on resilience pipelines and builders.
The core concept in Polly v8 is the resilience pipeline, which combines one or more resilience strategies into a cohesive unit. Developers use ResiliencePipelineBuilder to integrate strategies, and can define pipelines through dependency injection using IServiceCollection extensions. The library supports both synchronous and asynchronous execution patterns with proper cancellation token support for timeout strategies.
GitGenius activity data shows the repository maintains active engagement with 114 tracked issues and pull requests. The most frequently labeled issues are questions (37), feature suggestions (32), and bug reports (26). The median response latency for issues and pull requests is 0.0 hours, indicating rapid community engagement. Key contributors include martincostello with 271 tracked events, peter-csala with 71 events, and martintmk with 19 events. The repository shares contributors with major projects including dotnet/aspnetcore, open-telemetry/opentelemetry-dotnet, and microsoft/vscode, reflecting its importance in the broader .NET ecosystem.
Starting with version 8.3.0, Polly integrated Simmy, a chaos engineering library, directly into its core, enabling developers to inject faults and test system resilience. The project receives sponsorship from the .NET on AWS Open Source Software Fund, Microsoft's Free and Open Source Software Fund, and GitHub's Secure Open Source Fund, supporting ongoing development and maintenance.