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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
udit
December 12, 2018
Technology
58
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Road to masterless multi-node distributed system in Elixir
udit
December 12, 2018
More Decks by udit
See All by udit
Scalable dist-sys from grounds up
yudistrange
0
210
Other Decks in Technology
See All in Technology
LLMにもCAP定理があるという話
harukasakihara
0
390
SONiCの統計情報を取得したい
sonic
0
180
AIの性能が向上しても未解決な組織の重大問題は何か?/An Unsolved Organizational Problem in the Age of AI
moriyuya
4
680
200個のGitHubリポジトリを横断調査したかった
icck
0
130
AIネイティブな開発のサプライチェーンリスク対策 〜激動の開発現場でリスクに立ち向かう〜【ZennFes】
cscengineer
PRO
2
130
自宅LLMの話
jacopen
1
600
エンジニアリング戦略の作り方 / Crafting Engineering Strategy
iwashi86
21
7k
MCP Appsを作ってみよう
iwamot
PRO
4
670
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
130
SONiCで構築・運用する生成AI向けパブリッククラウドネットワーク ~実装編~
sonic
0
230
非エンジニアがClaudeと挑んだ「1ヶ月間プロダクト30本ノック」
askokc
0
590
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.4k
Featured
See All Featured
A better future with KSS
kneath
240
18k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
420
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
Music & Morning Musume
bryan
47
7.2k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
580
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
180
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
840
The Language of Interfaces
destraynor
162
27k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Amusing Abliteration
ianozsvald
1
200
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