Search⌘ K
AI Features

Resiliency through Cloud-Native Patterns

Explore how to enhance application resiliency in .NET microservices using cloud-native software patterns through Polly. Understand and implement retry, circuit breaker, bulkhead isolation, and fallback policies to improve error handling and system durability. Gain practical experience by adding resilience policies to code, testing their effects, and applying these patterns within a sample distributed application.

We'll cover the following...

Application resiliency can be measured by how durable and recovery prone a service or application is. There are different paradigms for analyzing and implementing resiliency in applications, including infrastructure and software design patterns. For the purposes of this chapter, we’ll be examining software patterns that leverage cloud-first architectural patterns to bolster application resiliency.

While we can review the architectural patterns using the Azure architecture center as well as various sources for software resiliency, we’re going to be looking at a library that’s fairly prevalent, especially in cloud-first development circles. This library is called Polly. Polly is a library that allows us to implement several different types of policies in either a synchronous or asynchronous manner to address specific issues or to combat known problems with cloud service transiency, as well as advanced error handling techniques, such as the circuit breaker pattern.

To familiarize ourselves with Polly, let’s look at a simple example of how we can implement both a circuit breaker policy and a retry policy. Retry policies are one of the most common ways to establish resiliency because we can determine what actions to take after the retry count has been exceeded.

Patterns using Polly

As well as the retry and circuit breaker patterns, there are several other patterns that we can implement using Polly. These include the following:

  • Bulkhead isolation: This pattern purposely restricts the number of resources available to a caller, as well as the number of ...