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
110
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
440
Modular Design in Elixir (ElixirConf EU 2019)
mkaszubowski
2
910
The Big Ball of Nouns
mkaszubowski
0
130
Modular Design in Elixir
mkaszubowski
1
410
Our three years with Elixir
mkaszubowski
0
280
Concurrency Basics for Elixir
mkaszubowski
0
150
Distributed Elixir
mkaszubowski
0
190
Software Architecture
mkaszubowski
0
160
Let it crash - fault tolerance in Elixir/OTP
mkaszubowski
0
520
Other Decks in Programming
See All in Programming
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
2
430
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
4
2.1k
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
1.1k
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
100
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
0
160
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
260
KagglerがMixSeekを触ってみた
morim
0
340
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
210
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
170
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
560
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
660
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
120
Leo the Paperboy
mayatellez
4
1.6k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
780
The Cult of Friendly URLs
andyhume
79
6.8k
Scaling GitHub
holman
464
140k
Building an army of robots
kneath
306
46k
What's in a price? How to price your products and services
michaelherold
247
13k
Navigating Weather and Climate Data
rabernat
0
150
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
150
Joys of Absence: A Defence of Solitary Play
codingconduct
1
320
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
160
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!