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
Road to masterless multi-node distributed syste...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
udit
December 12, 2018
Technology
0
52
Road to masterless multi-node distributed system in Elixir
udit
December 12, 2018
Tweet
Share
More Decks by udit
See All by udit
Scalable dist-sys from grounds up
yudistrange
0
190
Other Decks in Technology
See All in Technology
作るべきものと向き合う - ecspresso 8年間の開発史から学ぶ技術選定 / 技術選定con findy 2026
fujiwara3
7
2.1k
DX Improvement at Scale
ntk1000
3
290
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
22k
AI Agentにおける評価指標とAgent GPA
tsho
1
300
男(監査)はつらいよ - Policy as CodeからAIエージェントへ
ken5scal
5
730
LLM活用の壁を超える:リクルートR&Dの戦略と打ち手
recruitengineers
PRO
1
250
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
Kaggleで鍛えたスキルの実務での活かし方 競技とプロダクト開発のリアル
recruitengineers
PRO
1
160
Windows ネットワークを再確認する
murachiakira
PRO
0
260
Secure Boot 2026 - Aggiornamento dei certificati UEFI e piano di adozione in azienda
memiug
0
140
Eight Engineering Unit 紹介資料
sansan33
PRO
1
6.9k
Kiro のクレジットを使い切る!
otanikohei2023
0
110
Featured
See All Featured
エンジニアに許された特別な時間の終わり
watany
106
240k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
190
Side Projects
sachag
455
43k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
370
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Evolving SEO for Evolving Search Engines
ryanjones
0
150
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
110
Paper Plane (Part 1)
katiecoart
PRO
0
5.1k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
370
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
68
Transcript
The Road to a in Elixir Masterless Multi-node Distributed System
BUILDING AND SERVICES SYSTEMS
•WHY THIS JOURNEY? •THE START •WHERE WE ARE •THE ROAD
AHEAD AGENDA
WHY THIS JOURNEY?
PLATFORM TO DISCOVER AND BUY THE BEST EXPERIENCES IN EVENTS,
TRAVEL AND FOOD IN CITIES ACROSS INDIA
FOUNDED IN 2014 10K+ EVENTS, 3M+ TICKETS IN 2018 ACQUIRED
BY PAYTM IN 2017
MAKE INSIDER A PLATFORM FOR HOSTING AND PARTICIPATING IN DIGITAL
EVENTS
LIVE QUIZ
A PLATFORM THAT ENABLES INTERACTIONS ON A LIVE VIDEO STREAM
interaction by Aman from the Noun Project
FLEXIBLE AND SCALABLE FUEL INTERACTIONS flexible by Anup from the
Noun Project PLATFORM TO
Elixir Functional Programming Immutable Data Structures Concurrency Fault Tolerance Battle
Tested VM Erlang Interoperability
THE START
M W W W W NODE
MASTER CANNOT HANDLE Problem PLAYERS
M W W W W NODE SM SM
UNNECESSARY CHANGE CALLS CASTS
PLAYER STATE TRANSFER GENSERVER ETS
M W W W W NODE C NODE B NODE
A
SENDING MESSAGE TO A PID OVER THE NETWORK COPIES THE
MESSAGE OVER THE NETWORK Problem
Manifold github.com/discordapp/manifold Batching of messages passed between nodes
MANIFOLD WORKS FOR FAN-OUTs WHAT ABOUT FAN-INs? Problem
SO MUCH CHATTER MESSAGE PASSING Problem BECAME EXPENSIVE
MQTT Publisher/Subscriber Messaging Protocol Built on top of TCP/IP Lightweight
and Bandwidth Efficient Quality of Service Data Agnostic Message Queueing Telemetry Transport
Distributed, Scalable and Highly Extensible MQTT message broker Written in
Erlang/OTP http://emqtt.io
E M Q W W W W M /connect /connect
/connect /connect
Problem GLOBAL LOCK ACROSS WORKERS TO HANDLE PLAYER CONNECTIONS
Workers subscribe to /connect/<slot id> Players connect to /connect/<slot id>
Slot = Hash(player_id) T P I O S C SLOTTED
E M Q W W W W M /connect/1 /connect/2
/connect/2 /connect/1
Problem CRASHES APPLICATION
SUPERVISION TREES
Master Worker Worker Worker App Supervisor Master Supervisor Worker Supervisor
CURRENT ARCHITECTURE IS TIGHTLY COUPLED TO QUIZ Problem
HOW TO SUPPORT STATES AND TRANSITIONS FOR DIFFERENT ENGAGEMENTS? Problem
FSM Event State Engagement State gen_statem in Erlang/OTP
WHERE WE ARE
M W W W W Director
WE HAVE IN PLACE BUILDING BLOCKS
HOW TO SCALE IN THE LONG RUN?
WE NEED TO THINK LONG TERM
INTERMISSION
THE ROAD AHEAD
Multi Node
M W W W W M W W W W
GM
libcluster https://github.com/bitwalker/libcluster Form clusters of Erlang nodes Static or Dynamic
Node Membership Custom Strategy to Deal with Nodes Joining/Leaving Notification when Nodes Join/Leave
Resilience
ETS Immortal https://github.com/danielberkompas/immortal Keep ETS alive using a heir process
Keep ETS alive when owner dies Give ownership back to owner after it reboots
NODE A NODE B MASTER MA WA WB MB WA
WA WA WB WB WB MB WB MA WB WB WB WA WA WA WA AND WORKER REPLICA
Masterless
M W W W W GM M W W W
W GM M W W W W GM NODE A NODE C NODE B
CRDT Conflict-free Coordination-free Commutative or Convergent
CRDT Flags Maps Counters Sets
https://kubernetes.io/ SETUP/TEARDOWN ON-DEMAND FOR EVENTS INFRASTRUCTURE
RECAP
• https://elixirschool.com/en/ • https://ferd.ca/the-zen-of-erlang.html • http://blog.plataformatec.com.br/ • http://basho.com/tag/riak/ • https://www.theerlangelist.com/
Resources
Books Litte Elixir and OTP https://www.manning.com/books/the-little-elixir-and-otp-guidebook Learn you some Erlang
http://learnyousomeerlang.com Designing for Scalability with Erlang/OTP http://shop.oreilly.com/product/0636920024149.do
DISTRIBUTED SYSTEMS ARE HARD ELIXIR MAKES THINGS EASIER
Thanks! @kirang89 @yudistrange https://bit.ly/2QVT7CB