DoT NeT resiliency framework - Polly.pptx

knoldus 32 views 39 slides Jan 31, 2024
Slide 1
Slide 1 of 39
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39

About This Presentation

Polly is a popular open-source .NET library that provides a resiliency framework for building robust and fault-tolerant applications. It is designed to help developers handle transient faults and failures gracefully, such as network issues, database problems, or service unavailability. Polly allows ...


Slide Content

.Net Resiliency Framework - Polly Ajay Jajoo – Senior Software Consultant Akshit Kumar – Software Consultant

Lack of etiquette and manners is a huge turn off.   KnolX Etiquettes Punctuality Join the session 5 minutes prior to the session start time. We start on time and conclude on time! Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Silent Mode Keep your mobile devices in silent mode, feel free to move out of session in case you need to attend an urgent call. Avoid Disturbance Avoid unwanted chit chat during the session.

Introduction to Resiliency Challenges in Distributed Systems Introduction to Polly Polly's Key Features Circuit Breaker pattern Retry pattern Timeout pattern Fallback pattern Use cases Best Practices Demo

Introduction to Resiliency Definition: Resiliency in software development refers to the ability of a system to withstand and recover gracefully from failures, ensuring continuous operation even when components fail.

Importance of Resiliency In today's distributed and complex software architectures, applications are prone to various challenges such as network failures, service outages, and latency issues. Building resilient applications is crucial to ensure reliability, user satisfaction, and business continuity. So h ere, we will explore Polly, a powerful .NET Resiliency Framework, and how it helps developers address these challenges effectively.

Challenges in Distributed Systems Network Failures: In distributed systems, network failures are common, leading to communication issues between services and components. Service Outages: Services may go down due to maintenance, updates, or unexpected issues, affecting the overall application. Latency Issues: High latency can impact user experience, especially in scenarios where real-time responsiveness is crucial. Addressing these challenges requires a resilient approach in software design and implementation.

Introduction to Polly What is Polly? Polly is an open-source .NET library that helps developers implement resiliency patterns in their applications. It provides a set of policies for handling transient faults and other resiliency concerns in a flexible and configurable manner.

Polly as a .NET Resiliency framework Specifically designed for .NET applications, Polly integrates seamlessly with various .NET frameworks and libraries. Polly allows developers to handle faults and build resilient systems through well-established patterns.

Overview of Polly’s Features and Capabilities Circuit Breaker Pattern: Prevents repeated calls to a failing operation, reducing the impact of transient faults. Retry Pattern: Enables automatic retries with customizable policies to handle transient failures. Timeout Pattern: Sets a maximum execution time for an operation, preventing it from running indefinitely. Fallback Pattern: Defines alternative actions to be taken when an operation fails, ensuring graceful degradation. With Polly, developers can enhance the robustness of their applications in the face of various challenges.

Polly’s Key Features Circuit Breaker Pattern: Polly implements the Circuit Breaker pattern to avoid repeated calls to a failing operation. This pattern helps to reduce the impact of transient faults by temporarily blocking the execution of the failing operation. Configurable parameters allow developers to fine-tune the behavior of the Circuit Breaker.

Retry Pattern: Polly's Retry pattern enables automatic retries of operations in the presence of transient failures. Developers can specify retry policies, including the number of retries, delay between retries, and conditions triggering retries. This feature is essential for handling scenarios where temporary issues may affect service availability.

Timeout Pattern: Polly provides the Timeout pattern to set a maximum execution time for an operation. Prevents operations from running indefinitely, helping to manage system resources effectively. Developers can define the maximum allowed duration for an operation.

Fallback Pattern: Polly's Fallback pattern allows developers to define alternative actions when an operation fails. Ensures graceful degradation by providing a backup plan in case the primary operation fails. Configurable fallback strategies for different scenarios.

Circuit Breaker Pattern

Explanation of the Circuit Breaker Pattern The Circuit Breaker pattern prevents a system from repeatedly trying to execute an operation that is likely to fail. It operates like an electrical circuit breaker, blocking the execution of a faulty operation for a defined period. This helps in minimizing the impact of transient faults and allows the system to recover.

How Polly implements the Circuit Breaker Pattern Polly provides a straightforward API for implementing the Circuit Breaker pattern. Developers can configure the circuit breaker with parameters such as failure threshold, duration of the open state, and settings for resetting. Polly monitors the success and failure of operations and dynamically adjusts the circuit state based on the configured policies.

Benefits of Using the Circuit Breaker Pattern Improved system stability during periods of increased load or service instability. Reduced resource consumption by avoiding unnecessary retries on failing operations. Enhanced resilience by preventing cascading failures in distributed systems.

RETRY PATTERN

Explanation of the Retry Pattern Purpose: Polly's Retry pattern is designed to handle transient failures by automatically retrying a failed operation. Flexibility: Developers can customize retry policies based on the specific needs of their application. Retrying Strategies: Polly supports various retry strategies, including fixed retries, exponential backoff, and jittered retries.

How Polly Implements the Retry Pattern Policy Configuration: Developers can define the number of retries, the duration between retries, and conditions triggering retries. Automatic Retries: Polly intelligently manages retries, allowing applications to recover from transient issues without manual intervention. Exponential Backoff: Polly can be configured to use exponential backoff strategies, reducing the frequency of retries over time.

Use Cases for the Retry Pattern Network Transient Failures: Retry pattern is effective in scenarios where network issues cause transient failures. Service Dependencies: Handling temporary unavailability of external services through automatic retries. Resource Availability: Ensuring resource availability by retrying operations that might initially fail.

TIMEOUT PATTERN

Explanation of the Timeout Pattern Purpose: Polly's Timeout pattern helps prevent operations from running indefinitely, ensuring timely responses. Importance: In distributed systems, unexpected delays can occur; setting a maximum execution time is crucial for resource management.

How Polly Helps in Handling Timeouts Configuration: Developers can set a maximum allowed duration for an operation using Polly's timeout policy. Fail-Fast Approach: Polly ensures a fail-fast approach, terminating operations that exceed the defined time limit. Resource Management: Timeout policies contribute to effective resource utilization by avoiding prolonged execution times.

Preventing Long-Running Operations Scenario: Long-running operations can impact system responsiveness and resource availability. Benefits: Polly's Timeout pattern prevents operations from tying up resources, contributing to the overall stability of the system. By incorporating Polly's Timeout pattern, developers can proactively manage operation durations, enhance system responsiveness, and improve the overall efficiency of their applications.

FALLBACK PATTERN

Explanation of the Fallback Pattern Purpose: Polly's Fallback pattern allows developers to define alternative actions when the primary operation fails. Graceful Degradation: Fallback strategies ensure graceful degradation by providing a backup plan in case of failure. Enhanced Resilience: Applications can continue to function with reduced functionality even when certain operations encounter issues.

Implementing Fallback Strategies with Polly Configurable Fallbacks: Developers can configure specific fallback actions to execute when the primary operation fails. Conditional Fallbacks: Polly enables the definition of conditions under which fallback actions should be triggered. Example: For a web service call, a fallback could involve returning cached data if the service is temporarily unavailable.

Ensuring Graceful Degradation Use Cases: Fallbacks are valuable in scenarios where the failure of an operation does not necessarily mean the entire system is compromised. User Experience: Fallback strategies contribute to maintaining a positive user experience by handling failures transparently. Polly's Fallback pattern provides a safety net for applications, allowing them to gracefully handle failures and maintain a level of functionality even under challenging conditions.

USE CASES

Benefits Observed Improved Uptime: Highlight instances where Polly contributed to minimizing downtime and ensuring continuous service availability. Enhanced User Satisfaction: Explore cases where the use of Polly resulted in improved user satisfaction due to reduced service disruptions. Operational Efficiency: Discuss how Polly positively affected operational efficiency by automating resiliency measures.

Real World Examples Scalability Challenges Service Dependencies Dynamic Environments

Adoption Across Industries Finance Healthcare E-commerce

BEST PRACTICES

Customization Strategies Tailor Policies: Customize retry, timeout, and fallback policies to align with application requirements. Dynamic Adjustments: Leverage Polly's dynamic policy adjustments based on runtime conditions. Feedback Loops: Establish feedback loops for continuous improvement, considering insights from monitoring

Scalability Considerations Scaling Policies: Adjust Polly policies to accommodate varying levels of system load and demand. Parallelization: Explore parallelization strategies to enhance performance during periods of increased traffic. Graceful Scaling: Ensure that Polly gracefully scales with application growth without compromising resiliency.

Error Handling and Recovery Graceful Error Handling: Implement detailed error handling to provide meaningful feedback to users and operators. Recovery Strategies: Define recovery strategies for scenarios where Polly's resiliency measures are invoked. Fallback Optimization: Optimize fallback strategies to maintain a seamless user experience during failures.

DEMO….
Tags