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
第3回関東Kaggler会_AtCoderはKaggleの役に立つ
chettub
3
1k
CSS Linter による Baseline サポートの仕組み
ryo_manba
1
110
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
910
GoとPHPのインターフェイスの違い
shimabox
2
190
責務と認知負荷を整える! 抽象レベルを意識した関心の分離
yahiru
3
540
データベースのオペレーターであるCloudNativePGがStatefulSetを使わない理由に迫る
nnaka2992
0
150
GitHub Actions × RAGでコードレビューの検証の結果
sho_000
0
270
時計仕掛けのCompose
mkeeda
1
300
『GO』アプリ データ基盤のログ収集システムコスト削減
mot_techtalk
0
120
Linux && Docker 研修/Linux && Docker training
forrep
24
4.5k
Rails アプリ地図考 Flush Cut
makicamel
1
120
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
37
14k
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
51
7.4k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.8k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
100
18k
A designer walks into a library…
pauljervisheath
205
24k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
550
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
440
Designing for humans not robots
tammielis
250
25k
Embracing the Ebb and Flow
colly
84
4.6k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
RailsConf 2023
tenderlove
29
1k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
21
2.5k
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!