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
91
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
310
Modular Design in Elixir (ElixirConf EU 2019)
mkaszubowski
2
710
The Big Ball of Nouns
mkaszubowski
0
93
Modular Design in Elixir
mkaszubowski
1
370
Our three years with Elixir
mkaszubowski
0
230
Concurrency Basics for Elixir
mkaszubowski
0
110
Distributed Elixir
mkaszubowski
0
140
Software Architecture
mkaszubowski
0
130
Let it crash - fault tolerance in Elixir/OTP
mkaszubowski
0
450
Other Decks in Programming
See All in Programming
生成AI時代のフルスタック開発
kenn
10
2.4k
AI時代のリアーキテクチャ戦略 / Re-architecture Strategy in the AI Era
dachi023
0
190
Use Perl as Better Shell Script
karupanerura
0
590
Doma で目指す ORM 最適解
nakamura_to
1
160
Cloudflare Realtime と Workers でつくるサーバーレス WebRTC
nekoya3
0
150
Interface vs Types ~型推論が過多推論~
hirokiomote
1
220
ts-morph実践:型を利用するcodemodのテクニック
ypresto
1
520
What Spring Developers Should Know About Jakarta EE
ivargrimstad
1
510
OpenTelemetryで始めるベンダーフリーなobservability / Vendor-free observability starting with OpenTelemetry
seike460
PRO
0
160
少数精鋭エンジニアがフルスタック力を磨く理由 -そしてAI時代へ-
rebase_engineering
0
120
SpringBootにおけるオブザーバビリティのなにか
irof
1
870
技術懸念に立ち向かい 法改正を穏便に乗り切った話
pop_cashew
0
150
Featured
See All Featured
Making Projects Easy
brettharned
116
6.2k
Docker and Python
trallard
44
3.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.2k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
BBQ
matthewcrist
88
9.7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.8k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
34
2.3k
Gamification - CAS2011
davidbonilla
81
5.3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
14
1.5k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Git: the NoSQL Database
bkeepers
PRO
430
65k
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!