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
62
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
180
Modular Design in Elixir (ElixirConf EU 2019)
mkaszubowski
2
490
The Big Ball of Nouns
mkaszubowski
0
85
Modular Design in Elixir
mkaszubowski
1
280
Our three years with Elixir
mkaszubowski
0
160
Concurrency Basics for Elixir
mkaszubowski
0
88
Distributed Elixir
mkaszubowski
0
84
Software Architecture
mkaszubowski
0
93
Let it crash - fault tolerance in Elixir/OTP
mkaszubowski
0
290
Other Decks in Programming
See All in Programming
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
220
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
42
18k
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
160
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
Rails と人魚の話/rails-and-mermaid
sanfrecce_osaka
0
100
Goのエラースタックトレースの歴史と今後
sonatard
6
470
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
620
Ruby Pattern Matching
bkuhlmann
0
920
CQRS/ES avec Symfony, c’est (trop) bien !
jeremyfreeagent
1
640
VS Code をプロダクトにどう取り込むか
onomax
1
330
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
Folding Cheat Sheet #3
philipschwarz
PRO
0
120
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
13
1.5k
Building an army of robots
kneath
300
41k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
220
21k
Practical Orchestrator
shlominoach
181
9.7k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
The Invisible Side of Design
smashingmag
294
49k
What the flash - Photography Introduction
edds
64
11k
Building Adaptive Systems
keathley
30
1.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
13
1.5k
Rails Girls Zürich Keynote
gr2m
91
13k
No one is an island. Learnings from fostering a developers community.
thoeni
15
2.1k
Creatively Recalculating Your Daily Design Routine
revolveconf
209
11k
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!