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
85
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
270
Modular Design in Elixir (ElixirConf EU 2019)
mkaszubowski
2
580
The Big Ball of Nouns
mkaszubowski
0
87
Modular Design in Elixir
mkaszubowski
1
360
Our three years with Elixir
mkaszubowski
0
200
Concurrency Basics for Elixir
mkaszubowski
0
100
Distributed Elixir
mkaszubowski
0
110
Software Architecture
mkaszubowski
0
110
Let it crash - fault tolerance in Elixir/OTP
mkaszubowski
0
390
Other Decks in Programming
See All in Programming
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
0
160
Scaling your build logic
antalmonori
1
100
情報漏洩させないための設計
kubotak
5
1.3k
Fibonacci Function Gallery - Part 2
philipschwarz
PRO
0
210
ゼロからの、レトロゲームエンジンの作り方
tokujiros
3
1.1k
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
630
AHC041解説
terryu16
0
420
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
7
1.4k
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
300
盆栽転じて家具となる / Bonsai and Furnitures
aereal
0
1.9k
Jaspr Dart Web Framework 박제창 @Devfest 2024
itsmedreamwalker
0
150
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
370
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
51
7.3k
Building Adaptive Systems
keathley
38
2.4k
Mobile First: as difficult as doing things right
swwweet
222
9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
How GitHub (no longer) Works
holman
312
140k
A Tale of Four Properties
chriscoyier
157
23k
Designing for humans not robots
tammielis
250
25k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
BBQ
matthewcrist
85
9.4k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
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!