SlideShare a Scribd company logo
How does your
application behave
when everything goes
wrong?
Emerson Macedo
@emerleite
Who am I?
Emerson Macedo
@emerleite
Software
Engineer
Who am I?
Software
Engineer
TheConf 2018 - How does your app behave when everything goes wrong
Almost
Languages
ALL
TheConf 2018 - How does your app behave when everything goes wrong
daddy of
two kids
TheConf 2018 - How does your app behave when everything goes wrong
Rio de Janeiro São Paulo&
#desapega
630K
BRAZILIANS
OLX
IS FOR
EVERYONE
Announce for the first
time every month
25%
OF ITEMS
SOLD
During first 24H
TheConf 2018 - How does your app behave when everything goes wrong
OLX Brazil – Biz Growth
3M+ Brazilians
announce every month
500K+ Ads	
inserted every day

63% of items sold
during first week

2M+ items sold		
per month – 50 per minute
TheConf 2018 - How does your app behave when everything goes wrong
"Anything that can go wrong
will go wrong"
Major Edward A. Murphy
2016
I’m an
aerospace
engineer
2016
I’m an
aerospace
engineer
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
Expectation x Reality
TheConf 2018 - How does your app behave when everything goes wrong
Expectation
Reality
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
https://www.rgoarchitects.com/Files/fallacies.pdf
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
Talking to
External services
Your
Application
External
Service
Happy path
• Body Level One
• Body Level Two
• Body Level Three
• Body Level Four
• Body Level Five
Your
Application
External
Service
Happy path
• Body Level One
• Body Level Two
• Body Level Three
• Body Level Four
• Body Level Five
Request
200 OK
Your
Application
External
Service
Happy path
• Body Level One
• Body Level Two
• Body Level Three
• Body Level Four
• Body Level Five
Request
200 OK
Success
Your
Application
External
Service
Unhappy path
Your
Application
External
Service
Request
5XX ERROR
Unhappy path
Your
Application
External
Service
Request
5XX ERROR
Fail
Unhappy path
Architectural
Patterns (stability)
Patterns and
antipatterns
for stability
Request Cache
Your
Application
Cache
External
Service
Request Cache
Your
Application
Cache
External
Service
Cache read (service URI) - NOT FOUND
Request Cache
Your
Application
Cache
External
Service
Request
Cache read (service URI) - NOT FOUND
Request Cache
Your
Application
Cache
External
Service
Request
200 OK
Cache read (service URI) - NOT FOUND
Request Cache
Your
Application
Cache
External
Service
Request
200 OK
Update cache (service URI) - SHORT TTL
Cache read (service URI) - NOT FOUND
Request Cache
Your
Application
Cache
External
Service
Request
200 OK
Update cache (service URI) - SHORT TTL
Cache read (service URI) - NOT FOUND
Request Cache
Success
Your
Application
Cache
External
Service
Request Cache
Your
Application
Cache
External
Service
Cache read (service URI) - FOUND
Request Cache
Your
Application
Cache
External
Service
Cache read (service URI) - FOUND
Request Cache
Success
Request	Timeout
Your
Application
External
Service
Request Timeout
Your
Application
External
Service
Request
TIMEOUT (ms)
Request Timeout
Your
Application
External
Service
Request
TIMEOUT (ms)
Fail Fast
Request Timeout
Request Retry
Your
Application
External
Service
Request Retry
Your
Application
External
Service
Request Retry
Request
TIMEOUT / ERROR
Your
Application
External
Service
Retry
Request Retry
Your
Application
External
ServiceRequest
200 OK
Retry
Request Retry
Your
Application
External
ServiceRequest
200 OK
Retry
Request Retry
Success
Your
Application
External
Service
Request Retry
Your
Application
External
Service
Request Retry
Request
TIMEOUT / ERROR
Your
Application
External
Service
Retry
Request	Retry
Your
Application
External
ServiceRequest
TIMEOUT / ERROR
Retry
Request	Retry
Your
Application
External
ServiceRequest
TIMEOUT / ERROR
Retry
Request	Retry
Fail
Circuit Breaker
Circuit Breaker
Circuit Breaker
https://martinfowler.com/bliki/CircuitBreaker.html
Your
Application
State
External
Service
Circuit Breaker
Your
Application
State
External
Service
Circuit Breaker
Circuit State - CLOSED
Your
Application
State
External
Service
Circuit Breaker
Request
200 OK
Circuit State - CLOSED
Your
Application
State
External
Service
Circuit Breaker
Request
200 OK
Circuit State - CLOSED
Success
Your
Application
State
External
Service
Circuit Breaker
Your
Application
State
External
Service
Circuit Breaker
Circuit State - CLOSED
Your
Application
State
External
Service
Circuit Breaker
Request
TIMEOUT / ERROR
Circuit State - CLOSED
Your
Application
State
External
Service
Circuit Breaker
Request
TIMEOUT / ERROR
Fail
Circuit State - CLOSED
Your
Application
State
External
Service
Circuit Breaker
Request
TIMEOUT / ERROR
Fail
Circuit State - CLOSED
Circuit State - OPEN
Your
Application
State
External
Service
Circuit	Breaker
Your
Application
State
External
Service
Circuit	Breaker
Circuit State - OPEN
Your
Application
State
External
Service
Circuit	Breaker
Fail
Circuit State - OPEN
Your
Application
State
External
Service
Circuit Breaker
Your
Application
State
External
Service
Circuit Breaker
Circuit State - HALF OPEN
Your
Application
State
External
Service
Circuit Breaker
Request
TIMEOUT / ERROR
Circuit State - HALF OPEN
Your
Application
State
External
Service
Circuit Breaker
Request
TIMEOUT / ERROR
Fail
Circuit State - HALF OPEN
Your
Application
State
External
Service
Circuit Breaker
Request
TIMEOUT / ERROR
Fail
Circuit State - HALF OPEN
Circuit State - OPEN
Your
Application
State
External
Service
Circuit Breaker
Your
Application
State
External
Service
Circuit Breaker
Circuit State - HALF OPEN
Your
Application
State
External
Service
Circuit Breaker
Request
200 OK
Circuit State - HALF OPEN
Your
Application
State
External
Service
Circuit Breaker
Request
200 OK
Success
Circuit State - HALF OPEN
Your
Application
State
External
Service
Circuit Breaker
Request
200 OK
Success
Circuit State - HALF OPEN
Circuit State - CLOSED
What about business
requirements?
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
Your system must
keep working
Patterns and
antipatterns
for stability
No matter the fallback
strategy, it can have an impact
on the business of the system
Nygard, Michael - Release It
TheConf 2018 - How does your app behave when everything goes wrong
Therefore, it’s essential to
involve the system’s stakeholders
when deciding how to handle
calls when the circuit is open
Nygard, Michael - Release It
Backup Battery
A backup battery provides power
to a system when the primary
source of power is unavailable 
Wikipedia
TheConf 2018 - How does your app behave when everything goes wrong
Your
Application
Battery
External
Service
Backup Battery
Your
Application
Battery
External
Service
Request
Backup Battery
Your
Application
Battery
External
Service
Request
200 OK
Backup Battery
Your
Application
Battery
External
Service
Request
200 OK
Backup Battery
Success
Your
Application
Battery
External
Service
Request
200 OK
Charge battery (service URI) - LONG TTL
Backup Battery
Success
Your
Application
Battery
External
Service
Backup Battery
Your
Application
Battery
External
Service
Request
Backup Battery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Backup Battery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Battery response (service URI) - FOUND
Backup Battery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Battery response (service URI) - FOUND
Success
Backup Battery
Your
Application
Battery
External
Service
Backup	Ba4ery
Your
Application
Battery
External
Service
Request
Backup	Ba4ery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Backup	Ba4ery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Battery response (service URI) - NOT FOUND
Backup	Ba4ery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Battery response (service URI) - NOT FOUND
Fail
Backup	Ba4ery
Your
Application
Battery
External
Service
Backup	Ba4ery
Your
Application
Battery
External
Service
Charger
Backup	Ba4ery
Your
Application
Battery
External
Service
Charger
Async
BATCH
Backup	Ba4ery
Your
Application
Battery
External
Service
Request
Charger
Async
BATCH
Backup	Ba4ery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Charger
Async
BATCH
Backup	Ba4ery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Battery response (service URI) - FOUND
Charger
Async
BATCH
Backup	Ba4ery
Your
Application
Battery
External
Service
Request
TIMEOUT / ERROR
Battery response (service URI) - FOUND
SuccessCharger
Async
BATCH
Backup	Ba4ery
Backup Battery
Backup Battery
vs
Request Cache
A request cache is a trusted
information stored and
reused to avoid external
service overload 
A backup battery provides power
to a system when the primary
source of power is unavailable 
Wikipedia
A request cache should
have a short time to
live (a.k.a TTL) 
A backup battery should
have a long time to live
(a.k.a TTL) 
Battery Backup Examples
Battery Backup Examples
Credit Card Limit Approval
Battery Backup Examples
Credit Card Limit Approval
Account Information
Battery Backup Examples
Credit Card Limit Approval
Account Information
Listing Offer
Battery Backup Examples
Credit Card Limit Approval
Account Information
Listing Offer
Video Playback Authorization
I’ve been doing this
Battery Backup as an
architectural stability
pattern for the last 5 years
Lessons Learned
1 - Measure
everything
Grafana or Similar
2 - Do not rely on
external services
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
3 - Be resilient
for everything
TheConf 2018 - How does your app behave when everything goes wrong
4 - Your users
are your target
TheConf 2018 - How does your app behave when everything goes wrong
5 - Be creative
and find solutions
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
TheConf 2018 - How does your app behave when everything goes wrong
That’s all folks
Emerson Macedo
@emerleite
https://blog.emerleite.com

More Related Content

PDF
ACRUMEN Slides for Arlington Ruby (Practice for DevConf)
PDF
DevConf OpenSanca 2018 - How does your application behaves when everything go...
PDF
How your app behaves when everything goes wrong - Ruby Conf BR 2017
PDF
Reliability Patterns for Fun and Profit
PPTX
Reliability and Reslience
PPTX
Opportunities to Improve System Reliability and Resilience by Donald Belcham
PPTX
Cloud patterns forwardjs April Ottawa 2019
PDF
Building resilient applications
ACRUMEN Slides for Arlington Ruby (Practice for DevConf)
DevConf OpenSanca 2018 - How does your application behaves when everything go...
How your app behaves when everything goes wrong - Ruby Conf BR 2017
Reliability Patterns for Fun and Profit
Reliability and Reslience
Opportunities to Improve System Reliability and Resilience by Donald Belcham
Cloud patterns forwardjs April Ottawa 2019
Building resilient applications

Similar to TheConf 2018 - How does your app behave when everything goes wrong (20)

PPTX
Reliability and Resilience
PPTX
Circuit Breaker Pattern
PDF
An exception occurred - Please try again
PPTX
Getting to NO NINES
PPTX
Building Cloud Ready Apps
PDF
Architecting for Failures in micro services: patterns and lessons learned
PDF
Production Readiness Strategies in an Automated World
PPTX
Circuit breaker pattern
PPTX
Designing Fault Tolerant Microservices
PDF
Introduction of failsafe
PDF
[WSO2Con EU 2017] Resilience Patterns with Ballerina
PPTX
Cloud patterns at Carleton University
PDF
Reliability and Resilience Patterns
PDF
Expect the unexpected: Prepare for failures in microservices
PPTX
JDD 2017: Resilience of the external system call with circuit breaker (Jacek ...
PDF
High Availability (HA) Explained
PPTX
Micrsoft Ignite Toronto - BRK3508 - 8 Cloud Design Patterns you ought to know
PPTX
Cloud Design Patterns - Hong Kong Codeaholics
PPTX
DoT NeT resiliency framework - Polly.pptx
PDF
The anatomy of a cascading failure
Reliability and Resilience
Circuit Breaker Pattern
An exception occurred - Please try again
Getting to NO NINES
Building Cloud Ready Apps
Architecting for Failures in micro services: patterns and lessons learned
Production Readiness Strategies in an Automated World
Circuit breaker pattern
Designing Fault Tolerant Microservices
Introduction of failsafe
[WSO2Con EU 2017] Resilience Patterns with Ballerina
Cloud patterns at Carleton University
Reliability and Resilience Patterns
Expect the unexpected: Prepare for failures in microservices
JDD 2017: Resilience of the external system call with circuit breaker (Jacek ...
High Availability (HA) Explained
Micrsoft Ignite Toronto - BRK3508 - 8 Cloud Design Patterns you ought to know
Cloud Design Patterns - Hong Kong Codeaholics
DoT NeT resiliency framework - Polly.pptx
The anatomy of a cascading failure
Ad

More from Emerson Macedo (19)

PDF
ElixirConf 2019 - 10M Monthly Ad Insertions with Phoenix and Broadway
PDF
The Conf 2019 - Elixir - Emerson Macedo
PDF
Wanna be a manager? Not today - QCon São Paulo 2019
PDF
Beyond your daily coding - The Conf Brazil 2017 Keynote
PDF
CEJS 2016 - Please learn that shit
PDF
How Elixir helped us scale our Video User Profile Service for the Olympics
PDF
QCon SP 2016 - Video Authorization: from chaos to 25ms response time
PDF
Qcon Rio 2015 - Microservices
PDF
Microservices Case: GloboTV e Globosat Play
PDF
Secomp 2011 - Node.JS - Introdução
PDF
Jogos com NodeJS e Browser - QCON SP 2011
PDF
Javascript Orientado a Objetos - Fisl12
PDF
1 encontro Node.JS Brasil
PDF
BrazilJS - Node.JS Realtime Web Applications
PDF
RubyMasters 2011 - Beyond Ruby with NodeJS
PDF
Node.JS - Campus Party Brasil 2011
PDF
Beyond Ruby with NodeJS - RubyConf Brasil 2010
PDF
DevInRio 2010 - NodeJS
PDF
Nodejs - A performance que eu sempre quis ter
ElixirConf 2019 - 10M Monthly Ad Insertions with Phoenix and Broadway
The Conf 2019 - Elixir - Emerson Macedo
Wanna be a manager? Not today - QCon São Paulo 2019
Beyond your daily coding - The Conf Brazil 2017 Keynote
CEJS 2016 - Please learn that shit
How Elixir helped us scale our Video User Profile Service for the Olympics
QCon SP 2016 - Video Authorization: from chaos to 25ms response time
Qcon Rio 2015 - Microservices
Microservices Case: GloboTV e Globosat Play
Secomp 2011 - Node.JS - Introdução
Jogos com NodeJS e Browser - QCON SP 2011
Javascript Orientado a Objetos - Fisl12
1 encontro Node.JS Brasil
BrazilJS - Node.JS Realtime Web Applications
RubyMasters 2011 - Beyond Ruby with NodeJS
Node.JS - Campus Party Brasil 2011
Beyond Ruby with NodeJS - RubyConf Brasil 2010
DevInRio 2010 - NodeJS
Nodejs - A performance que eu sempre quis ter
Ad

Recently uploaded (20)

PPTX
Tartificialntelligence_presentation.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Big Data Technologies - Introduction.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Empathic Computing: Creating Shared Understanding
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Tartificialntelligence_presentation.pptx
A Presentation on Artificial Intelligence
Encapsulation_ Review paper, used for researhc scholars
20250228 LYD VKU AI Blended-Learning.pptx
Spectral efficient network and resource selection model in 5G networks
Per capita expenditure prediction using model stacking based on satellite ima...
Getting Started with Data Integration: FME Form 101
Digital-Transformation-Roadmap-for-Companies.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
The Rise and Fall of 3GPP – Time for a Sabbatical?
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Big Data Technologies - Introduction.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Unlocking AI with Model Context Protocol (MCP)
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Network Security Unit 5.pdf for BCA BBA.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Empathic Computing: Creating Shared Understanding
Agricultural_Statistics_at_a_Glance_2022_0.pdf

TheConf 2018 - How does your app behave when everything goes wrong