SlideShare a Scribd company logo
Practical Fault Tolerance
in Elixir
Alexei Sholik
Elixir Club Kyiv, 17 Mar 2018
About me
Backend engineer at Contractbook.co.
Co-host at BeamEaters podcast.
Contributor to Elixir.
github.com/alco
What is fault tolerance?
Practical Fault Tolerance in Elixir - Alexei Sholik
Why it’s important
Why do only
Erlang/Elixir communities
seem to care about it?
A practical example
(demo)
“Let it crash”
is not the full story
Fail fast → restart → try again
Practical Fault Tolerance in Elixir - Alexei Sholik
Building blocks of fault tolerance
Process
Practical Fault Tolerance in Elixir - Alexei Sholik
Practical Fault Tolerance in Elixir - Alexei Sholik
Error
Link
Practical Fault Tolerance in Elixir - Alexei Sholik
Monitor
Practical Fault Tolerance in Elixir - Alexei Sholik
def call(process, request, timeout) do
monitor = Process.monitor(process)xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
send(process, {:"$gen_call", {self(), monitor}, request})
receive
{^monitor, reply} ->
Process.demonitor(monitor, [:flush])
{:ok, reply}
{:DOWN, ^monitor, _, _, reason} ->⁣xxxxxxxxxxxxxxxxxxxxxxxxxxxx
exit(reason)
after timeout ->
Process.demonitor(monitor, [:flush])
exit(:timeout)
end
end
Task
Supervisor
Bohrbug
Heisenbug
Improving our example
(demo)
...
DB
SuperDocs.Web.Endpoint
<request process>
<db_connection process>
Ecto’s connection pool
supervisor
DB
SuperDocs.Web.Endpoint
<request process>
<db_connection process>
SuperDocs.TaskSup
User.send_confirmation_email
...
Durable message queue
hex.pm/packages/amqp
DB
SuperDocs.Web.Endpoint
<request process>
<db_connection process>
RabbitMQ
SuperDocs.TaskSup
ImportService.import_documents_for
AMQPClient
AMQPWorker AMQPWorker
...
Other tools and techniques
Remote error tracking
Sentry, Rollbar, log aggregators
Exponential backoff
hex.pm/packages/db_connection
hex.pm/packages/gen_retry
Alternative supervisor
hex.pm/packages/director
And so on...
Recap
● Trust in OTP…
● ...but don’t dismiss other tools
● Anticipate failures
● Isolate failures
● Fail fast, restart, try again
● Why do computers fail and what can be done about it?
● Making reliable distributed systems in the presence of software
errors
● It's About the Guarantees
● On Erlang, State and Crashes
● Error Kernels
Reading material
Thank you!
Questions?

More Related Content

PPTX
Unit testing CourseSites Apache Filter
PDF
Health Monitoring
PDF
Volt ruby framework
PPTX
Swift LA Meetup at eHarmony- What's New in Swift 2.0
PDF
Callbacks and control flow in Node js
PDF
Source Plugins
PPTX
Avoiding Callback Hell with Async.js
DOCX
Client server part 12
Unit testing CourseSites Apache Filter
Health Monitoring
Volt ruby framework
Swift LA Meetup at eHarmony- What's New in Swift 2.0
Callbacks and control flow in Node js
Source Plugins
Avoiding Callback Hell with Async.js
Client server part 12

What's hot (8)

DOC
Reverse123
PDF
Антон Молдован "Building data intensive stateful services with Orleans"
PDF
Automation puzzlers
PDF
WebDriver Waits
PDF
Implicit and Explicit waits in Selenium WebDriwer, how to.
PPSX
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
PDF
Testing For Unicorns [IMWorld]
PPTX
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
Reverse123
Антон Молдован "Building data intensive stateful services with Orleans"
Automation puzzlers
WebDriver Waits
Implicit and Explicit waits in Selenium WebDriwer, how to.
JS Fest 2018. Сергей Пузанков. E2E-тестирование фронтенда c Hermione
Testing For Unicorns [IMWorld]
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
Ad

Similar to Practical Fault Tolerance in Elixir - Alexei Sholik (20)

PDF
Principles of the Play framework
PDF
Phoenix for laravel developers
PPTX
JEEConf 2017 - How to find deadlock not getting into it
PDF
Intro to Asynchronous Javascript
PDF
Re-Design with Elixir/OTP
PDF
Python concurrency: libraries overview
PPTX
Understanding reactive programming with microsoft reactive extensions
PDF
Asynchronous web apps with the Play Framework 2.0
PPTX
From Web to Flux @DevoxxBE 2023.pptx
ODP
The why and how of moving to php 5.4/5.5
PDF
Silicon Valley JUG: JVM Mechanics
PDF
Openstack taskflow 簡介
PDF
From Elixir to Akka (and back) - ElixirConf Mx 2017
PDF
Flask patterns
PDF
Extensions vs Services: Digging Deeper - Neil Bartlett
ODP
Concurrency on the JVM
PPT
香港六合彩 &raquo; SlideShare
PDF
Elixir and elm
PDF
JVM Mechanics: When Does the JVM JIT & Deoptimize?
KEY
Concurrent programming with Celluloid (MWRC 2012)
Principles of the Play framework
Phoenix for laravel developers
JEEConf 2017 - How to find deadlock not getting into it
Intro to Asynchronous Javascript
Re-Design with Elixir/OTP
Python concurrency: libraries overview
Understanding reactive programming with microsoft reactive extensions
Asynchronous web apps with the Play Framework 2.0
From Web to Flux @DevoxxBE 2023.pptx
The why and how of moving to php 5.4/5.5
Silicon Valley JUG: JVM Mechanics
Openstack taskflow 簡介
From Elixir to Akka (and back) - ElixirConf Mx 2017
Flask patterns
Extensions vs Services: Digging Deeper - Neil Bartlett
Concurrency on the JVM
香港六合彩 &raquo; SlideShare
Elixir and elm
JVM Mechanics: When Does the JVM JIT & Deoptimize?
Concurrent programming with Celluloid (MWRC 2012)
Ad

More from Elixir Club (20)

PDF
Kubernetes + Docker + Elixir - Alexei Sholik, Andrew Dryga | Elixir Club Ukraine
PDF
Integrating 3rd parties with Ecto - Eduardo Aguilera | Elixir Club Ukraine
PDF
— An async template - Oleksandr Khokhlov | Elixir Club Ukraine
PDF
BEAM architecture handbook - Andrea Leopardi | Elixir Club Ukraine
PDF
You ain't gonna need write a GenServer - Ulisses Almeida | Elixir Club Ukraine
PDF
— Knock, knock — An async templates — Who’s there? - Alexander Khokhlov | ...
PDF
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
PDF
Erlang cluster. How is it? Production experience. — Valerii Vasylkov | Elixi...
PDF
Promo Phx4RailsDevs - Volodya Sveredyuk
PDF
Web of today — Alexander Khokhlov
PDF
ElixirConf Eu 2018, what was it like? – Eugene Pirogov
PDF
Implementing GraphQL API in Elixir – Victor Deryagin
PDF
WebPerformance: Why and How? – Stefan Wintermeyer
PDF
GenServer in Action – Yurii Bodarev
PDF
Russian Doll Paradox: Elixir Web without Phoenix - Alex Rozumii
PDF
Phoenix and beyond: Things we do with Elixir - Alexander Khokhlov
PDF
Monads are just monoids in the category of endofunctors - Ike Kurghinyan
PDF
Craft effective API with GraphQL and Absinthe - Ihor Katkov
PDF
Elixir in a service of government - Alex Troush
PDF
Pattern matching in Elixir by example - Alexander Khokhlov
Kubernetes + Docker + Elixir - Alexei Sholik, Andrew Dryga | Elixir Club Ukraine
Integrating 3rd parties with Ecto - Eduardo Aguilera | Elixir Club Ukraine
— An async template - Oleksandr Khokhlov | Elixir Club Ukraine
BEAM architecture handbook - Andrea Leopardi | Elixir Club Ukraine
You ain't gonna need write a GenServer - Ulisses Almeida | Elixir Club Ukraine
— Knock, knock — An async templates — Who’s there? - Alexander Khokhlov | ...
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Erlang cluster. How is it? Production experience. — Valerii Vasylkov | Elixi...
Promo Phx4RailsDevs - Volodya Sveredyuk
Web of today — Alexander Khokhlov
ElixirConf Eu 2018, what was it like? – Eugene Pirogov
Implementing GraphQL API in Elixir – Victor Deryagin
WebPerformance: Why and How? – Stefan Wintermeyer
GenServer in Action – Yurii Bodarev
Russian Doll Paradox: Elixir Web without Phoenix - Alex Rozumii
Phoenix and beyond: Things we do with Elixir - Alexander Khokhlov
Monads are just monoids in the category of endofunctors - Ike Kurghinyan
Craft effective API with GraphQL and Absinthe - Ihor Katkov
Elixir in a service of government - Alex Troush
Pattern matching in Elixir by example - Alexander Khokhlov

Recently uploaded (20)

PPTX
Introduction to Artificial Intelligence
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
top salesforce developer skills in 2025.pdf
PDF
System and Network Administraation Chapter 3
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Transform Your Business with a Software ERP System
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Nekopoi APK 2025 free lastest update
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
Introduction to Artificial Intelligence
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Adobe Illustrator 28.6 Crack My Vision of Vector Design
top salesforce developer skills in 2025.pdf
System and Network Administraation Chapter 3
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Softaken Excel to vCard Converter Software.pdf
Understanding Forklifts - TECH EHS Solution
2025 Textile ERP Trends: SAP, Odoo & Oracle
Design an Analysis of Algorithms I-SECS-1021-03
Transform Your Business with a Software ERP System
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Nekopoi APK 2025 free lastest update
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Navsoft: AI-Powered Business Solutions & Custom Software Development
Operating system designcfffgfgggggggvggggggggg
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Odoo Companies in India – Driving Business Transformation.pdf
Reimagine Home Health with the Power of Agentic AI​

Practical Fault Tolerance in Elixir - Alexei Sholik