Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Stateful Apps with OTP
Search
Maciej Kaszubowski
April 20, 2017
Programming
0
86
Stateful Apps with OTP
Maciej Kaszubowski
April 20, 2017
Tweet
Share
More Decks by Maciej Kaszubowski
See All by Maciej Kaszubowski
Error-free Elixir
mkaszubowski
0
280
Modular Design in Elixir (ElixirConf EU 2019)
mkaszubowski
2
660
The Big Ball of Nouns
mkaszubowski
0
88
Modular Design in Elixir
mkaszubowski
1
370
Our three years with Elixir
mkaszubowski
0
210
Concurrency Basics for Elixir
mkaszubowski
0
100
Distributed Elixir
mkaszubowski
0
110
Software Architecture
mkaszubowski
0
120
Let it crash - fault tolerance in Elixir/OTP
mkaszubowski
0
400
Other Decks in Programming
See All in Programming
PHPのバージョンアップ時にも役立ったAST
matsuo_atsushi
0
120
2024年のWebフロントエンドのふりかえりと2025年
sakito
3
250
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
120
ファインディLT_ポケモン対戦の定量的分析
fufufukakaka
0
740
仕様変更に耐えるための"今の"DRY原則を考える / Rethinking the "Don't repeat yourself" for resilience to specification changes
mkmk884
4
650
Writing documentation can be fun with plugin system
okuramasafumi
0
120
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.3k
SwiftUI Viewの責務分離
elmetal
PRO
1
240
第3回 Snowflake 中部ユーザ会- dbt × Snowflake ハンズオン
hoto17296
4
370
一休.com のログイン体験を支える技術 〜Web Components x Vue.js 活用事例と最適化について〜
atsumim
0
530
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
1
570
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
150
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
42
7.2k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Rails Girls Zürich Keynote
gr2m
94
13k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
240
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
450
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Transcript
Stateful Apps with OTP Maciej Kaszubowski
Realtime Apps with OTP Maciej Kaszubowski
Background
Http Server Client
Architecture Server Mobile Mobile Kurento Mobile Websocket Websocket & REST
WebRTC
Challenges
Async communication with Kurento
Async communication with Clients
Handling Concurrent Calls
Deploys, migrations & Restarts
A lot can go wrong
A lot can go wrong & Errors are dangerous
How to deal with this?
init callback
init callback
init callback
init callback
init callback
init callback
Dealing with failures
RoomServer
RoomServer
Let it FAIL
Room Supervisor RoomServer
Room Supervisor RoomServer
Room Supervisor RoomServer
After the restart, the state is gone
Room Supervisor BackupServer RoomServer
None
Room Supervisor BackupServer RoomServer
None
None
Multiple calls
Room Supervisor BackupServer RoomServer
Common Room Supervisor Room Supervisor Backup Server Room Server Room
Supervisor Backup Server Room Server
Common Room Supervisor Room Supervisor Backup Server Room Server Room
Supervisor Backup Server Room Server
Common Room Supervisor Room Supervisor Backup Server Room Server Room
Supervisor Backup Server Room Server
Common Room Supervisor Room Supervisor Backup Server Room Server
PubSub
Status Updates Server Mobile Join Mobile Room status
MyApp.Endpoint.broadcast( “room_id”, “update_status”, status )
apps/ | |—— domain/ |—— web/
Status Updates Server Mobile Mobile Subscribe Subscribe
Status Updates Server Mobile Mobile Join
Status Updates Server Mobile Mobile Status update Status update
Status Updates
Status Updates
Status Updates
Status Updates
Status Updates
Status Updates
History
History Server Call History Subscribe Status update
History
History
History
Conclusions
Simpler system
Testing is easy
Changes are easy
Great performance
We should learn from the Erlang community
A lot of fun!
Thanks!