Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Design for Retry (Nodevember)
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Aria Stewart
November 15, 2014
Programming
61
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Design for Retry (Nodevember)
Aria Stewart
November 15, 2014
More Decks by Aria Stewart
See All by Aria Stewart
Nuts and Bolts of Internationalization
aredridel
0
250
Design for Retry (Oneshot Budapest)
aredridel
0
73
Other Decks in Programming
See All in Programming
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
110
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
390
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
450
最近”作らせてる” ローカルAIアプリの話
akit37
0
140
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
160
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
450
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.9k
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
120
残高管理から台帳サービスへの進化
artoy
0
170
The Rails Doctrine Decade
koic
2
510
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
480
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
420
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
300
Accessibility Awareness
sabderemane
1
240
How to Think Like a Performance Engineer
csswizardry
28
2.9k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Mind Mapping
helmedeiros
1
390
WCS-LA-2024
lcolladotor
0
850
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Transcript
None
Hi! I'm Aria Stewart, that's @aredridel on just about every
service out there. Right now I'm an engineer at PayPal, working on the open source Kraken.js framework.
I'm going to talk about errors. It's going to be
okay.
We all know HTTP
if (err) { alert(err.message); } else { doMyThing(); }
2xx OK 3xx Go elsewhere 4xx Tell user what they
did wrong 5xx Bail out and log an error I'd call this Error avoidance
You can't avoid errors
Here's the secret Handle errors instead
4xx Tell the user what they did wrong 5xx Save
that request and do something with it later.
Retry it 5xx are errors the requestor can handle
But you can't just do things twice? We must make
operations idempotent
Idempotency Repeated actions have no effect, give the same result
This means being smart about IDs. Don't recycle! Check if things are already done. They are? Just give the same answer again.
Causes! • database down • bug in a service •
Deploy in progress • power failure • kicked a cable • Network congestion • Capacity exceeded • Microbursts
• Tree fell on the data center • earthquake •
tornado • birds, snakes and aeroplanes • Black Friday • Slashdot effect • Interns • QA tests • DoS attack
You need a queue
Lots of ways to do it Database on the nodes
Log file Queue server
gearman Queues built in There are many alternatives, but gearmand
is very simple. The memcache of job queues.
Three statuses: • OK (Like 200) • FAIL (Like 400)
• ERROR (Like 500)
design so ERROR can be retried.
gearmand automatically tries a job ERROR again. And again. And
again.
If it isn't sure it worked? Tries it again.
You cannot know if an error is a failure.
Error handling gets simpler • Exception? ERROR. • Database down?
ERROR. • Downstream service timeout? ERROR. Maybe you retry right away.
How many of you have used a job queue?
You have used a job queue
Let me tell you about one TRILLIONS of messages MILLIONS
of nodes 100% availability (at least partial) for years. 32 years. Resilient to MILLIONS of bad actors. It is attached to the most malicious network.
EMAIL. 250 OK 4xx RETRY 5xx Fail
Responsibility for messages 250 - accept responsibility 4xx - reject
responsibility 5xx - return responsibility
reject responsibility. If there's an error? Fail fast. The requester
can retry.
Fail fast. Queue work you can't reject. Reject everything you
can if there is an error.
You need a smart client. Keeps outstanding requests. Resubmit. Try
a different server! Try a second queue service. Maybe have a fallback plan.
Smart Clients on the device Toto, we're not in AWS
anymore.
Ever lose an email because you've been logged out?
Latency + Mutable state = Distributed system CAP Theorem Applies!
C = Consistency If there's state that one part knows
of that another doesn't? That's inconsistency.
Job queues are controlled inconsistency.
Ever try to write email on the web while not
on the Internet? It's cloud easy!
This is really good for offline- first design! Being offline
is the ultimate retriable error.
Some ideas
Queue things in localStorage
Use third-party storage
Integrate third-party services with this approach.
Use different strategies for available resources vs contended
Thank you! I hope you have lots of ideas queued
up. Save your ideas and unspool them onto Twitter when you get home. Let me know if this changed how you think about designing applications!