SlideShare a Scribd company logo
1 of 26
Download to read offline
B E N J A M I N FA N
AGENDA
• Availability
• Introduction Polly
• Demo
• Takeaway
• Appendix
A LONG TIME AGO IN WWW
NESTED TRY CATCH
AVAILABILITY
AVAILABILITY
• Availability is the probability that a system will work as required when required during the
period of a mission.
• The mission could be the 18-hour span of an aircraft flight.The mission period could also be
the 3 to 15-month span of a military deployment.Availability includes non-operational periods
associated with reliability, maintenance, and logistics.
AVAILABILITY (CONT.)
Availability level Allowed unavailability window
per year per quarter per month per week per day per hour
99.5% 1.83 days 10.8 hours 3.6 hours 50.4 minutes 7.20 minutes 18 seconds
99.9% (3 nines) 8.76 hours 2.16 hours 43.2 minutes 10.1 minutes 1.44 minutes 3.6 seconds
99.95% 4.38 hours 1.08 hours 21.6 minutes 5.04 minutes 43.2 seconds 1.8 seconds
99.99% (4 nines) 52.6 minutes 12.96 minutes 4.32 minutes 60.5 seconds 8.64 seconds 0.36 seconds
99.999% (5 nines) 5.26 minutes 1.30 minutes 25.9 seconds 6.05 seconds 0.87 seconds 0.04 seconds
AVAILABILITY (CONT.)
client
DB
3rd
Service
Service
A
Service
B
Service
dependency
Murphy's Law
AVAILABILITY (CONT.)
• Why availability matter?
– https://aws.amazon.com/en/legal/service-level-agreements/
– https://azure.microsoft.com/en-us/support/legal/sla/summary/
– https://cloud.google.com/compute/sla-20171130
INTRODUCTION
POLLY
WHAT IS POLLY
• A .NET resilience and transient-fault-handling library.
• transient-fault:
– Something unexpected happened occasionally
• Ex. network peak or unstable let service unavailable.
• Ex. 3rd party API (there is no 100% availability)
• Ex.Access unmanaged resource (ex. Database, File)
WHY POLLY
• Using fluent API and thread safe way to implement Retry, Circuit breaker,Time out, Bulkhead
isolation and Fallback policy。
• Can implement multi fault handle in one place.
• Make system more robust.
• Focus on business logic rather than fault-handling.
RETRY
• Basic Concept:
– Don’t play sick
RETRY (CONT.)
• Before we use Polly
• Retry mechanism =
count + for loop + try
catch
FALLBACK
• Basic Concept:
– There is always a plan B
start
Execute
delegate
exception
Fallback
handle
Return result
Execute
fallback
delegate
end
Yes
Yes
No
No
FALLBACK (CONT.)
• Before we use Polly
• When you invoke something in catch that
might throw exception again, will you try
catch of that? Hummmm…
DEMO
DEMO
• Source code:
– https://github.com/RiceBen/DotNetPollyEssential
TAKEAWAY
TAKEAWAY
• Things will go wrong, always prepare for the worst case
• High Availability make your user (or customer) more confidence
• Sharp tools make good work.
– Using policy wrap to make fault-handling more easy
– Use proper policy
APPENDIX
APPENDIX – CHAOS ENGINEERING
• Principles:
– https://principlesofchaos.org/?lang=ENcontent
Chaos engineering can be used to achieve resilience against:
• Infrastructure failures
• Network failures
• Application failures
APPENDIX - LIBRARY
.NET Solution
• Simmy
– https://github.com/Polly-Contrib/Simmy
• Polly
– https://github.com/App-vNext/Polly
Java Solution
• Cthulhu
– https://github.com/xmatters/cthulhu-chaos-testing
• Resilience4j
– https://github.com/resilience4j/resilience4j
APPENDIX - LIBRARY
Javascript Solution
• Pollyjs
– https://github.com/Netflix/pollyjs
Golang
• Goresilience
– https://github.com/slok/goresilience
• Fuzz-monkey
– https://github.com/ChrisCooney/fuzz-monkey
READ MORE
• Making the Netflix API More Resilient
– https://netflixtechblog.com/making-the-netflix-api-more-resilient-a8ec62159c2d
• Circuit Breaker
– https://martinfowler.com/bliki/CircuitBreaker.html
• .NET Microservices Architecture
– https://dotnet.microsoft.com/download/e-book/microservices-architecture/pdf
Polly Essentials: Retry, Fallback and Demo

More Related Content

Similar to Polly Essentials: Retry, Fallback and Demo

DoT NeT resiliency framework - Polly.pptx
DoT NeT resiliency framework - Polly.pptxDoT NeT resiliency framework - Polly.pptx
DoT NeT resiliency framework - Polly.pptxKnoldus Inc.
 
Traffic Sign Classification with Fastai Library
Traffic Sign Classification with Fastai LibraryTraffic Sign Classification with Fastai Library
Traffic Sign Classification with Fastai LibrarySébastien Derhy
 
Test Automation using UiPath Test Suite - Developer Circle Part-3 - 07262022.pdf
Test Automation using UiPath Test Suite - Developer Circle Part-3 - 07262022.pdfTest Automation using UiPath Test Suite - Developer Circle Part-3 - 07262022.pdf
Test Automation using UiPath Test Suite - Developer Circle Part-3 - 07262022.pdfDiana Gray, MBA
 
Ken Johnston - Big Bugs That Got Away - EuroSTAR 2010
Ken Johnston - Big Bugs That Got Away -  EuroSTAR 2010Ken Johnston - Big Bugs That Got Away -  EuroSTAR 2010
Ken Johnston - Big Bugs That Got Away - EuroSTAR 2010TEST Huddle
 
Treating Your Pipeline as a Product - Full Day Workshop
Treating Your Pipeline as a Product - Full Day WorkshopTreating Your Pipeline as a Product - Full Day Workshop
Treating Your Pipeline as a Product - Full Day WorkshopManuel Pais
 
Application Delivery Patterns for Developers - Technical 401
Application Delivery Patterns for Developers - Technical 401Application Delivery Patterns for Developers - Technical 401
Application Delivery Patterns for Developers - Technical 401Amazon Web Services
 
Building on quicksand microservices indicthreads
Building on quicksand microservices  indicthreadsBuilding on quicksand microservices  indicthreads
Building on quicksand microservices indicthreadsIndicThreads
 
Testing Without a GUI Using TestComplete
 Testing Without a GUI Using TestComplete Testing Without a GUI Using TestComplete
Testing Without a GUI Using TestCompleteSmartBear
 
Automated testing on steroids – Trick for managing test data using Docker sna...
Automated testing on steroids – Trick for managing test data using Docker sna...Automated testing on steroids – Trick for managing test data using Docker sna...
Automated testing on steroids – Trick for managing test data using Docker sna...Lucas Jellema
 
Test Driven Development & CI/CD
Test Driven Development & CI/CDTest Driven Development & CI/CD
Test Driven Development & CI/CDShanmuga S Muthu
 
CodeIgniter for Startups, cicon2010
CodeIgniter for Startups, cicon2010CodeIgniter for Startups, cicon2010
CodeIgniter for Startups, cicon2010Joel Gascoigne
 
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...Federico Toledo
 
BeyondAutomation
BeyondAutomationBeyondAutomation
BeyondAutomationSean Zhang
 
How we realized SOA by Python at PyCon JP 2015
How we realized SOA by Python at PyCon JP 2015How we realized SOA by Python at PyCon JP 2015
How we realized SOA by Python at PyCon JP 2015hirokiky
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)CIVEL Benoit
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1CIVEL Benoit
 

Similar to Polly Essentials: Retry, Fallback and Demo (20)

DoT NeT resiliency framework - Polly.pptx
DoT NeT resiliency framework - Polly.pptxDoT NeT resiliency framework - Polly.pptx
DoT NeT resiliency framework - Polly.pptx
 
Traffic Sign Classification with Fastai Library
Traffic Sign Classification with Fastai LibraryTraffic Sign Classification with Fastai Library
Traffic Sign Classification with Fastai Library
 
Production-ready Software
Production-ready SoftwareProduction-ready Software
Production-ready Software
 
Test Automation using UiPath Test Suite - Developer Circle Part-3 - 07262022.pdf
Test Automation using UiPath Test Suite - Developer Circle Part-3 - 07262022.pdfTest Automation using UiPath Test Suite - Developer Circle Part-3 - 07262022.pdf
Test Automation using UiPath Test Suite - Developer Circle Part-3 - 07262022.pdf
 
Securing applications
Securing applicationsSecuring applications
Securing applications
 
Ken Johnston - Big Bugs That Got Away - EuroSTAR 2010
Ken Johnston - Big Bugs That Got Away -  EuroSTAR 2010Ken Johnston - Big Bugs That Got Away -  EuroSTAR 2010
Ken Johnston - Big Bugs That Got Away - EuroSTAR 2010
 
Treating Your Pipeline as a Product - Full Day Workshop
Treating Your Pipeline as a Product - Full Day WorkshopTreating Your Pipeline as a Product - Full Day Workshop
Treating Your Pipeline as a Product - Full Day Workshop
 
Application Delivery Patterns for Developers - Technical 401
Application Delivery Patterns for Developers - Technical 401Application Delivery Patterns for Developers - Technical 401
Application Delivery Patterns for Developers - Technical 401
 
Building on quicksand microservices indicthreads
Building on quicksand microservices  indicthreadsBuilding on quicksand microservices  indicthreads
Building on quicksand microservices indicthreads
 
Testing Without a GUI Using TestComplete
 Testing Without a GUI Using TestComplete Testing Without a GUI Using TestComplete
Testing Without a GUI Using TestComplete
 
Automated testing on steroids – Trick for managing test data using Docker sna...
Automated testing on steroids – Trick for managing test data using Docker sna...Automated testing on steroids – Trick for managing test data using Docker sna...
Automated testing on steroids – Trick for managing test data using Docker sna...
 
Application Delivery Patterns
Application Delivery PatternsApplication Delivery Patterns
Application Delivery Patterns
 
Test Driven Development & CI/CD
Test Driven Development & CI/CDTest Driven Development & CI/CD
Test Driven Development & CI/CD
 
CodeIgniter for Startups, cicon2010
CodeIgniter for Startups, cicon2010CodeIgniter for Startups, cicon2010
CodeIgniter for Startups, cicon2010
 
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
 
BeyondAutomation
BeyondAutomationBeyondAutomation
BeyondAutomation
 
How we realized SOA by Python at PyCon JP 2015
How we realized SOA by Python at PyCon JP 2015How we realized SOA by Python at PyCon JP 2015
How we realized SOA by Python at PyCon JP 2015
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1
 
Mini-Training: Netflix Simian Army
Mini-Training: Netflix Simian ArmyMini-Training: Netflix Simian Army
Mini-Training: Netflix Simian Army
 

Recently uploaded

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 

Recently uploaded (20)

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 

Polly Essentials: Retry, Fallback and Demo

  • 1. B E N J A M I N FA N
  • 2. AGENDA • Availability • Introduction Polly • Demo • Takeaway • Appendix
  • 3. A LONG TIME AGO IN WWW
  • 6. AVAILABILITY • Availability is the probability that a system will work as required when required during the period of a mission. • The mission could be the 18-hour span of an aircraft flight.The mission period could also be the 3 to 15-month span of a military deployment.Availability includes non-operational periods associated with reliability, maintenance, and logistics.
  • 7. AVAILABILITY (CONT.) Availability level Allowed unavailability window per year per quarter per month per week per day per hour 99.5% 1.83 days 10.8 hours 3.6 hours 50.4 minutes 7.20 minutes 18 seconds 99.9% (3 nines) 8.76 hours 2.16 hours 43.2 minutes 10.1 minutes 1.44 minutes 3.6 seconds 99.95% 4.38 hours 1.08 hours 21.6 minutes 5.04 minutes 43.2 seconds 1.8 seconds 99.99% (4 nines) 52.6 minutes 12.96 minutes 4.32 minutes 60.5 seconds 8.64 seconds 0.36 seconds 99.999% (5 nines) 5.26 minutes 1.30 minutes 25.9 seconds 6.05 seconds 0.87 seconds 0.04 seconds
  • 9. AVAILABILITY (CONT.) • Why availability matter? – https://aws.amazon.com/en/legal/service-level-agreements/ – https://azure.microsoft.com/en-us/support/legal/sla/summary/ – https://cloud.google.com/compute/sla-20171130
  • 11. WHAT IS POLLY • A .NET resilience and transient-fault-handling library. • transient-fault: – Something unexpected happened occasionally • Ex. network peak or unstable let service unavailable. • Ex. 3rd party API (there is no 100% availability) • Ex.Access unmanaged resource (ex. Database, File)
  • 12. WHY POLLY • Using fluent API and thread safe way to implement Retry, Circuit breaker,Time out, Bulkhead isolation and Fallback policy。 • Can implement multi fault handle in one place. • Make system more robust. • Focus on business logic rather than fault-handling.
  • 13. RETRY • Basic Concept: – Don’t play sick
  • 14. RETRY (CONT.) • Before we use Polly • Retry mechanism = count + for loop + try catch
  • 15. FALLBACK • Basic Concept: – There is always a plan B start Execute delegate exception Fallback handle Return result Execute fallback delegate end Yes Yes No No
  • 16. FALLBACK (CONT.) • Before we use Polly • When you invoke something in catch that might throw exception again, will you try catch of that? Hummmm…
  • 17. DEMO
  • 18. DEMO • Source code: – https://github.com/RiceBen/DotNetPollyEssential
  • 20. TAKEAWAY • Things will go wrong, always prepare for the worst case • High Availability make your user (or customer) more confidence • Sharp tools make good work. – Using policy wrap to make fault-handling more easy – Use proper policy
  • 22. APPENDIX – CHAOS ENGINEERING • Principles: – https://principlesofchaos.org/?lang=ENcontent Chaos engineering can be used to achieve resilience against: • Infrastructure failures • Network failures • Application failures
  • 23. APPENDIX - LIBRARY .NET Solution • Simmy – https://github.com/Polly-Contrib/Simmy • Polly – https://github.com/App-vNext/Polly Java Solution • Cthulhu – https://github.com/xmatters/cthulhu-chaos-testing • Resilience4j – https://github.com/resilience4j/resilience4j
  • 24. APPENDIX - LIBRARY Javascript Solution • Pollyjs – https://github.com/Netflix/pollyjs Golang • Goresilience – https://github.com/slok/goresilience • Fuzz-monkey – https://github.com/ChrisCooney/fuzz-monkey
  • 25. READ MORE • Making the Netflix API More Resilient – https://netflixtechblog.com/making-the-netflix-api-more-resilient-a8ec62159c2d • Circuit Breaker – https://martinfowler.com/bliki/CircuitBreaker.html • .NET Microservices Architecture – https://dotnet.microsoft.com/download/e-book/microservices-architecture/pdf