SlideShare a Scribd company logo
Handle API Failure gracefully
with Circuit Breakers
Scott Triglia
1
Jim’s
2
Yelp’s Mission:
Connecting people with great
local businesses.
Yelp Stats
As of Q2 2016
92M
monthly
users
32
countries
72% of
searches from
mobile
108M reviews
Scott Triglia
4
@scott_triglia
Work with the $$$
Let’s talk Circuit Breakers
5
6
7
8Photo by zerial, CC BY-NC 2.0
9
10
Our goals today:
introduce a basic circuit breaker
11
Our goals today:
a modular circuit breaker
12
Our goals today:
test it out on several scenarios
13
14
15
1616
1
2
3
4
the fundamental rule:
your systems will fail
what’s your response?
17
1818
1
2
1919
1
2
3
2020
1
2
3
4
21
Nygard’s circuit breaker
22
23
24
25
26
Circuit Breaker States:
* Healthy (or “closed”)
* Recovering (or “half-open”)
* Unhealthy (or “open”)
27
28
Recovery:
* Wait for recovery_timeout seconds
* Send a trial request, trust its results
29
Before a circuit breaker
30
Assume the kitchen gets slow
31
Kitchen’s backlog grows
32
Diners wait much longer to get food
33
New diners make issues worse
34
And your entire system collapses
35
And your entire system collapses
36
With a circuit breaker
37
CB sees backlog, stops orders
38
Fewer frustrated diners
39
Reduced load on the kitchen
40
A well defined failure mode
41
How can we do better?
42
Improvements
43
1) Detecting Unhealthiness
44
2) Mitigating downtime
45
3) Recovering Effectively
46
Detecting Unhealthiness
Component 1:
47
48
def signal_overload(cb):
if len(jobs) > THRESH:
cb.mark_unhealthy()
49
New Behavior:
* CB gets signals from anywhere
* Signal combining logic
50
* Allows many (many) new signals
* Must combine signals
* Adds complexity to system
51
Mitigating Downtime
Component 2:
52
53
54
55
56
New Behavior:
* Code can check in advance about
healthiness of system
* Automatic monitoring!
57
* Build features on top of system
health status
* Requires a single source of truth?
58
Recovering Effectively
Component 3:
59
60
Dark launch:
* Reject but process normally
* Dangerous with side effects
Block User
Request
Try to process anyway!
61
Synthetic:
* Dark launching with fake requests
* Not necessarily representative
Block User
Request
Process fake requests
62
New Behavior:
* Traffic determines health
* Removal of recovery timeouts
63
* Faster(?) recovery
* No timeout tuning required
* Dark launching not always possible
* Synthetic can be unrepresentative
64
in summary
65
Your system will fail, have a plan!
66
The basic CB is better than nothing
67
Questions to ask:
* What is “unhealthy” for my system?
* How should I react to unhealthiness?
* How do we recover?
68
Questions to ask:
* What is “unhealthy” for my system?
* How should I react to unhealthiness?
* How do we recover?
69
Questions to ask:
* What is “unhealthy” for my system?
* How should I react to unhealthiness?
* How do we recover?
70
Questions to ask:
* What is “unhealthy” for my system?
* How should I react to unhealthiness?
* How do we recover?
71
…and much more!
Much comes down to your use case
72
@YelpEngineering
fb.com/YelpEngineers
engineeringblog.yelp.com
github.com/yelp
striglia@yelp.com
@scott_triglia
75
Can’t we do better than
rejecting requests?
http://techblog.netflix.com/2011/12/
making-netflix-api-more-resilient.html
77
How do I safely test out a
new circuit breaker?
https://engineering.heroku.com/blogs/
2015-06-30-improved-production-
stability-with-circuit-breakers/

More Related Content

Similar to Circuit breakers @ API World 2016

Mathworks CAE simulation suite – case in point from automotive and aerospace.
Mathworks CAE simulation suite – case in point from automotive and aerospace.Mathworks CAE simulation suite – case in point from automotive and aerospace.
Mathworks CAE simulation suite – case in point from automotive and aerospace.
WMG centre High Value Manufacturing Catapult
 
Faultdec
FaultdecFaultdec
2018 Update in Diabetes Technology: Closed Loop, CGM, and More
2018 Update in Diabetes Technology: Closed Loop, CGM, and More2018 Update in Diabetes Technology: Closed Loop, CGM, and More
2018 Update in Diabetes Technology: Closed Loop, CGM, and More
Aaron Neinstein
 
Alarm System for Medicine Reminder Based on Microcontroller
Alarm System for Medicine Reminder Based on MicrocontrollerAlarm System for Medicine Reminder Based on Microcontroller
Alarm System for Medicine Reminder Based on Microcontroller
ijtsrd
 
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
 
Using Artificial Intelligence in the field of Diagnostics_Case Studies.ppt
Using Artificial Intelligence in the field of Diagnostics_Case Studies.pptUsing Artificial Intelligence in the field of Diagnostics_Case Studies.ppt
Using Artificial Intelligence in the field of Diagnostics_Case Studies.ppt
RohanBorgalli
 
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
Andrey Karpov
 
UTC Telecom & Technology 2015 - Battery Backup Workshop
UTC Telecom & Technology 2015 - Battery Backup WorkshopUTC Telecom & Technology 2015 - Battery Backup Workshop
UTC Telecom & Technology 2015 - Battery Backup Workshop
Dakx Turcotte
 
The Selfish Stack [FutureStack16 NYC]
The Selfish Stack [FutureStack16 NYC]The Selfish Stack [FutureStack16 NYC]
The Selfish Stack [FutureStack16 NYC]
New Relic
 
Vemma World ! 2010
Vemma World ! 2010Vemma World ! 2010
Vemma World ! 2010
Gloria85
 
Monitoring Complex Systems - Chicago Erlang, 2014
Monitoring Complex Systems - Chicago Erlang, 2014Monitoring Complex Systems - Chicago Erlang, 2014
Monitoring Complex Systems - Chicago Erlang, 2014
Brian Troutwine
 
Making the Smart Home More Insightful
Making the Smart Home More InsightfulMaking the Smart Home More Insightful
Making the Smart Home More Insightful
Vectorform
 
Making the Smart Home More Insightful
Making the Smart Home More InsightfulMaking the Smart Home More Insightful
Making the Smart Home More Insightful
Seattle Interactive Conference
 
Acc 281 Education Organization -- snaptutorial.com
Acc 281   Education Organization -- snaptutorial.comAcc 281   Education Organization -- snaptutorial.com
Acc 281 Education Organization -- snaptutorial.com
DavisMurphyB52
 
Consumer Perception of Job Seekers in updating their Job Profiles on Job Portals
Consumer Perception of Job Seekers in updating their Job Profiles on Job PortalsConsumer Perception of Job Seekers in updating their Job Profiles on Job Portals
Consumer Perception of Job Seekers in updating their Job Profiles on Job Portals
Neil Mathew
 

Similar to Circuit breakers @ API World 2016 (15)

Mathworks CAE simulation suite – case in point from automotive and aerospace.
Mathworks CAE simulation suite – case in point from automotive and aerospace.Mathworks CAE simulation suite – case in point from automotive and aerospace.
Mathworks CAE simulation suite – case in point from automotive and aerospace.
 
Faultdec
FaultdecFaultdec
Faultdec
 
2018 Update in Diabetes Technology: Closed Loop, CGM, and More
2018 Update in Diabetes Technology: Closed Loop, CGM, and More2018 Update in Diabetes Technology: Closed Loop, CGM, and More
2018 Update in Diabetes Technology: Closed Loop, CGM, and More
 
Alarm System for Medicine Reminder Based on Microcontroller
Alarm System for Medicine Reminder Based on MicrocontrollerAlarm System for Medicine Reminder Based on Microcontroller
Alarm System for Medicine Reminder Based on Microcontroller
 
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...
 
Using Artificial Intelligence in the field of Diagnostics_Case Studies.ppt
Using Artificial Intelligence in the field of Diagnostics_Case Studies.pptUsing Artificial Intelligence in the field of Diagnostics_Case Studies.ppt
Using Artificial Intelligence in the field of Diagnostics_Case Studies.ppt
 
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
 
UTC Telecom & Technology 2015 - Battery Backup Workshop
UTC Telecom & Technology 2015 - Battery Backup WorkshopUTC Telecom & Technology 2015 - Battery Backup Workshop
UTC Telecom & Technology 2015 - Battery Backup Workshop
 
The Selfish Stack [FutureStack16 NYC]
The Selfish Stack [FutureStack16 NYC]The Selfish Stack [FutureStack16 NYC]
The Selfish Stack [FutureStack16 NYC]
 
Vemma World ! 2010
Vemma World ! 2010Vemma World ! 2010
Vemma World ! 2010
 
Monitoring Complex Systems - Chicago Erlang, 2014
Monitoring Complex Systems - Chicago Erlang, 2014Monitoring Complex Systems - Chicago Erlang, 2014
Monitoring Complex Systems - Chicago Erlang, 2014
 
Making the Smart Home More Insightful
Making the Smart Home More InsightfulMaking the Smart Home More Insightful
Making the Smart Home More Insightful
 
Making the Smart Home More Insightful
Making the Smart Home More InsightfulMaking the Smart Home More Insightful
Making the Smart Home More Insightful
 
Acc 281 Education Organization -- snaptutorial.com
Acc 281   Education Organization -- snaptutorial.comAcc 281   Education Organization -- snaptutorial.com
Acc 281 Education Organization -- snaptutorial.com
 
Consumer Perception of Job Seekers in updating their Job Profiles on Job Portals
Consumer Perception of Job Seekers in updating their Job Profiles on Job PortalsConsumer Perception of Job Seekers in updating their Job Profiles on Job Portals
Consumer Perception of Job Seekers in updating their Job Profiles on Job Portals
 

Recently uploaded

Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 

Recently uploaded (20)

Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 

Circuit breakers @ API World 2016