SlideShare una empresa de Scribd logo
1 de 77
Descargar para leer sin conexión
Protect your users with
Circuit Breakers
@scott_triglia
Jim’s
Yelp’s Mission:
Connecting people with great
local businesses.
@scott_triglia
I work with 💵💶
Let’s talk Circuit Breakers
CC BY-NC 2.0 by zerial
Our goals today:
introduce a basic circuit
breaker
Our goals today:
a modular circuit breaker
Our goals today:
test it out on several
scenarios
15
1
2
34
the fundamental rule:
your systems will fail
what’s your response?
1
2
1
2
3
1
2
34
Nygard’s circuit
breaker
Circuit Breaker States:
* Healthy (or “closed”)
* Recovering (or “half-open”)
* Unhealthy (or “open”)
Recovery:
* Wait for recovery_timeout seconds
* Send a trial request, trust its results
Before a circuit breaker
Assume the kitchen gets slow
Kitchen’s backlog grows
Diners wait much longer to get food
New diners make issues worse
And your entire system collapses
And your entire system collapses
With a circuit breaker
CB sees backlog, stops orders
Fewer frustrated diners
Reduced load on the kitchen
A well defined failure mode
How can we do better?
Improvements
1) Detecting Unhealthiness
2) Mitigating downtime
3) Recovering Effectively
Detecting Unhealthiness
Component 1:
def signal_overload(cb):
if len(jobs) > THRESH:
cb.mark_unhealthy()
New Behavior:
* CB gets signals from anywhere
* Signal combining logic
* Allows many (many) new signals
* Must combine signals
* Adds complexity to system
Mitigating Downtime
Component 2:
New Behavior:
* Code can check in advance about
healthiness of system
* Automatic monitoring!
* Build features on top of system
health status
* Requires a single source of truth?
Recovering Effectively
Component 3:
Dark launch:
* Reject but process normally
* Dangerous with side effects
Block User
Request
Try to process anyway!
Synthetic:
* Dark launching with fake requests
* Not necessarily representative
Block User
Request
Process fake requests
New Behavior:
* Traffic determines health
* Removal of recovery timeouts
* Representative recovery
* No timeout tuning required
* Dark launching not always possible
* Synthetic can be unrepresentative
in summary
Your system will fail, have a plan!
The basic CB is better than nothing
Questions to ask:
* What is “unhealthy” for my system?
* How should I react to unhealthiness?
* How do we recover?
Questions to ask:
* What is “unhealthy” for my system?
* How should I react to unhealthiness?
* How do we recover?
Questions to ask:
* What is “unhealthy” for my system?
* How should I react to unhealthiness?
* How do we recover?
Questions to ask:
* What is “unhealthy” for my system?
* How should I react to unhealthiness?
* How do we recover?
…and much more!
Much comes down to your use case
@YelpEngineering
fb.com/YelpEngineers
engineeringblog.yelp.com
github.com/yelp
striglia@yelp.com
@scott_triglia
Downtime options
besides rejecting
requests?
http://techblog.netflix.com/
2011/12/making-netflix-api-
more-resilient.html
How do I safely test out a
new circuit breaker?
https://engineering.heroku.com/
blogs/2015-06-30-improved-
production-stability-with-circuit-
breakers/

Más contenido relacionado

Destacado

Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
Hugo Hamon
 
Designing for developers
Designing for developersDesigning for developers
Designing for developers
Kirsten Hunter
 

Destacado (20)

DNS for Developers - ConFoo Montreal
DNS for Developers - ConFoo MontrealDNS for Developers - ConFoo Montreal
DNS for Developers - ConFoo Montreal
 
Containerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS LambdaContainerless in the Cloud with AWS Lambda
Containerless in the Cloud with AWS Lambda
 
Get more than a cache back! - ConFoo Montreal
Get more than a cache back! - ConFoo MontrealGet more than a cache back! - ConFoo Montreal
Get more than a cache back! - ConFoo Montreal
 
Securing MicroServices - ConFoo 2017
Securing MicroServices - ConFoo 2017Securing MicroServices - ConFoo 2017
Securing MicroServices - ConFoo 2017
 
Monitoring system with Grafana and StatsD
Monitoring system with Grafana and StatsDMonitoring system with Grafana and StatsD
Monitoring system with Grafana and StatsD
 
Les nouveautés d'HTML 5
Les nouveautés d'HTML 5Les nouveautés d'HTML 5
Les nouveautés d'HTML 5
 
Low voltage circuit breakers
Low voltage circuit breakersLow voltage circuit breakers
Low voltage circuit breakers
 
Scott Triglia, MLconf 2013
Scott Triglia, MLconf 2013Scott Triglia, MLconf 2013
Scott Triglia, MLconf 2013
 
Get Complete Information about Circuit Breaker
Get Complete Information about Circuit BreakerGet Complete Information about Circuit Breaker
Get Complete Information about Circuit Breaker
 
Progressive Web Apps – the return of the web?
Progressive Web Apps – the return of the web?Progressive Web Apps – the return of the web?
Progressive Web Apps – the return of the web?
 
Symfony2 en pièces détachées
Symfony2 en pièces détachéesSymfony2 en pièces détachées
Symfony2 en pièces détachées
 
Développeurs, cachez-moi ça ! (Paris Web 2011)
Développeurs, cachez-moi ça ! (Paris Web 2011)Développeurs, cachez-moi ça ! (Paris Web 2011)
Développeurs, cachez-moi ça ! (Paris Web 2011)
 
Liberating your data
Liberating your dataLiberating your data
Liberating your data
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
Designing for developers
Designing for developersDesigning for developers
Designing for developers
 
Design Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et PimpleDesign Patterns avec PHP 5.3, Symfony et Pimple
Design Patterns avec PHP 5.3, Symfony et Pimple
 
Prototyping in the cloud
Prototyping in the cloudPrototyping in the cloud
Prototyping in the cloud
 
Liberating your data
Liberating your dataLiberating your data
Liberating your data
 
API 101 Workshop from APIStrat Conference
API 101 Workshop from APIStrat ConferenceAPI 101 Workshop from APIStrat Conference
API 101 Workshop from APIStrat Conference
 
Monitor the quality of your Symfony projects
Monitor the quality of your Symfony projectsMonitor the quality of your Symfony projects
Monitor the quality of your Symfony projects
 

Similar a Protect your Users with Circuit breakers

DEA Regulation Changes: Pharmaceutical Controlled Substances
DEA Regulation Changes: Pharmaceutical Controlled SubstancesDEA Regulation Changes: Pharmaceutical Controlled Substances
DEA Regulation Changes: Pharmaceutical Controlled Substances
Triumvirate Environmental
 
Safe staffing and productivity through use of technology and professional jud...
Safe staffing and productivity through use of technology and professional jud...Safe staffing and productivity through use of technology and professional jud...
Safe staffing and productivity through use of technology and professional jud...
NHS England
 
Provider trust oig_compliance_preso
Provider trust oig_compliance_presoProvider trust oig_compliance_preso
Provider trust oig_compliance_preso
providertrust
 

Similar a Protect your Users with Circuit breakers (20)

Faultdec
FaultdecFaultdec
Faultdec
 
Improve Employee Health & Control Healthcare Costs with Direct Primary Care
Improve Employee Health & Control Healthcare Costs with Direct Primary CareImprove Employee Health & Control Healthcare Costs with Direct Primary Care
Improve Employee Health & Control Healthcare Costs with Direct Primary Care
 
Usmle step 3
Usmle step 3Usmle step 3
Usmle step 3
 
Case study - Success with Prostate Enlargement
Case study - Success with Prostate EnlargementCase study - Success with Prostate Enlargement
Case study - Success with Prostate Enlargement
 
Mental health diagnosis system
Mental health diagnosis systemMental health diagnosis system
Mental health diagnosis system
 
Mental health diagnosis system
Mental health diagnosis systemMental health diagnosis system
Mental health diagnosis system
 
Financial Aspects of Genetic Testing - 1/11/22
Financial Aspects of Genetic Testing - 1/11/22Financial Aspects of Genetic Testing - 1/11/22
Financial Aspects of Genetic Testing - 1/11/22
 
Fault-tolerance on the Cheap: Making Systems That (Probably) Won't Fall Over
Fault-tolerance on the Cheap: Making Systems That (Probably) Won't Fall Over Fault-tolerance on the Cheap: Making Systems That (Probably) Won't Fall Over
Fault-tolerance on the Cheap: Making Systems That (Probably) Won't Fall Over
 
Theory of constraints._eliyahu_m._goldra
Theory of constraints._eliyahu_m._goldraTheory of constraints._eliyahu_m._goldra
Theory of constraints._eliyahu_m._goldra
 
Essay Storm At Sea
Essay Storm At SeaEssay Storm At Sea
Essay Storm At Sea
 
Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)Unit 3 part 2(DEADLOCK)
Unit 3 part 2(DEADLOCK)
 
Control lesson 1
Control lesson 1Control lesson 1
Control lesson 1
 
Staying Sane Inside Insanity - ECGC Edition
Staying Sane Inside Insanity - ECGC EditionStaying Sane Inside Insanity - ECGC Edition
Staying Sane Inside Insanity - ECGC Edition
 
Electronic Medical Records (EMR) - Overcoming Barriers to Adoption
Electronic Medical Records (EMR) - Overcoming Barriers to AdoptionElectronic Medical Records (EMR) - Overcoming Barriers to Adoption
Electronic Medical Records (EMR) - Overcoming Barriers to Adoption
 
DEA Regulation Changes: Pharmaceutical Controlled Substances
DEA Regulation Changes: Pharmaceutical Controlled SubstancesDEA Regulation Changes: Pharmaceutical Controlled Substances
DEA Regulation Changes: Pharmaceutical Controlled Substances
 
Safe staffing and productivity through use of technology and professional jud...
Safe staffing and productivity through use of technology and professional jud...Safe staffing and productivity through use of technology and professional jud...
Safe staffing and productivity through use of technology and professional jud...
 
2014 type onenation rn cgm talk Austin, Texas June 21
2014 type onenation rn cgm talk Austin, Texas June 212014 type onenation rn cgm talk Austin, Texas June 21
2014 type onenation rn cgm talk Austin, Texas June 21
 
Using 2 Generators for Cancers
Using 2 Generators for CancersUsing 2 Generators for Cancers
Using 2 Generators for Cancers
 
Provider trust oig_compliance_preso
Provider trust oig_compliance_presoProvider trust oig_compliance_preso
Provider trust oig_compliance_preso
 
Using 4 Generators for Cancers
Using 4 Generators for CancersUsing 4 Generators for Cancers
Using 4 Generators for Cancers
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Protect your Users with Circuit breakers