SlideShare a Scribd company logo
Introduction to Distributed
          Erlang
 Basic principles and a little more
About us




 Developing a new breed of platform for social
 networking games
 Scalability is a must
 Back-end developed with Erlang/OTP
    And lots of other good stuff
 Front-end developed with Flex 4
About me




      More stickers than a 40 years old RV!
Agenda and non-agenda

 Quick recap of message passing
 Core principles of Erlang remoting
 Global registry and process groups
 Nothing on Erlang syntax {<<"sorry">>}
 Nothing on custom networking nor OTP
    OTP is what you'll use in reality
Why Erlang for concurrency?

  Immutability painted all over it
  Designed to handle thousands of processes
     Spawned (not started nor forked)
  Processes communicate asynchronously
  Passing messages by value
Message sending

  As easy as:

  Pid ! Message
  Sends a message to a process inbox
  Like with mail delivery:
     Not sure if the letter reached its destination
     Needs a letter back if a response is needed
RSVP

 Add address on the envelope for a response
RSVP (client)
                                 Client is also
                                Server's public
                                     API
send(Sid, Message) ->
  Sid!{self(), Message},
  receive
    {From, Response} ->
       io:format("Client ~p from ~p~n",
                 [Response, From])
  after
    1000 -> bail
  end.
RSVP (server)

start() ->
  spawn(fun()-> serve() end).
serve() ->
  receive
    {From, Message} ->
       io:format("Server ~p from ~p~n",
                 [Message, From]),
      From!{self(), {ack, Message}},
       serve()
  end.
Process registration

  Allows process naming:

  register(my_pid, Pid).
  Frees application from passing Pids around:

  my_pid ! Message.
RPC strikes back

  Call MFA on single or multiple nodes
  Declined in zillions of variations:
    Blocking or not
    Parallelized, including pmap
  Makes code location aware
  Heterogeneous styles:
    Pid ! Message
    rpc:call(N,M,F,A)
Node connectivity

  Triggered by:

  rpc:call ...
  net_adm:ping(node@host)
  Nodes shake hands and share information
      Processes, registrations...
  Transitive mechanism
     Node 1 ➟ Node 2 and Node 2 ➟ Node3
     then: Node 1 ➟ Node 3
Erlang Port Mapper Daemon
Erlang's magic cookie

  Passed on startup:

  erl -sname n1 -setcookie=secret
  Proper node and host naming required
  Coarse grained security
     Party time or bust!
Global process registry

  Location transparency:

  global:register_name(gbs, Sid).
  global:whereis_name(gbs) ! Message.
  Wired-in name conflict resolution
  Still need to ping nodes
Process group (1/3)

  Distributed named process group
     Processes join and leave:

    pg2:create(mypg2).

    pg2:join(mypg2, Sid).

    pg2:leave(mypg2, Sid).
Process group (2/3)

  pg2 can be used to send messages to:
    all processes:

    pg2:get_members(mypg2)
    local processes:

    pg2:get_local_members(mypg2)
    closest / random process:

    pg2:get_closest_pid(mypg2)
Process group (3/3)

  Also: pg (experimental)
Ping pong pang relief

  net_adm:world and net_adm:world_list
    Ease node discovery on hosts
    Requires hosts list
  Node discovery with nodefinder
    UDP multicast
    S3 list for AWS
Probing further
Thank you!

More Related Content

PDF
MessagePack Rakuten Technology Conference 2010
Sadayuki Furuhashi
 
PDF
Zeromq anatomy & jeromq
Dongmin Yu
 
PPTX
What I learned about APIs in my first year at Google
Tim Burks
 
PDF
Socket programming using java
UC San Diego
 
PPT
Easy Steps to implement UDP Server and Client Sockets
babak danyal
 
PDF
Socket programming
Rajivarnan (Rajiv)
 
PPT
Networking & Socket Programming In Java
Ankur Agrawal
 
MessagePack Rakuten Technology Conference 2010
Sadayuki Furuhashi
 
Zeromq anatomy & jeromq
Dongmin Yu
 
What I learned about APIs in my first year at Google
Tim Burks
 
Socket programming using java
UC San Diego
 
Easy Steps to implement UDP Server and Client Sockets
babak danyal
 
Socket programming
Rajivarnan (Rajiv)
 
Networking & Socket Programming In Java
Ankur Agrawal
 

What's hot (20)

PPT
Socket programming
chandramouligunnemeda
 
PPT
Socket Programming Tutorial
Jignesh Patel
 
PPT
Sockets
sivindia
 
PPT
Socket programming in C
Deepak Swain
 
PDF
Java sockets
Stephen Pradeep
 
PDF
Network programming Using Python
Karim Sonbol
 
KEY
The Real Time Web with XMPP
Jack Moffitt
 
PPT
Socket programming-tutorial-sk
sureshkarthick37
 
PPTX
Elementary TCP Sockets
Saksham Khurana
 
PDF
Briefly Rust - Daniele Esposti - Codemotion Rome 2017
Codemotion
 
PPTX
Fij
Rodrigo Vidal
 
PPT
Basic socket programming
Kristian Arjianto
 
PPT
Socket Programming
CEC Landran
 
PDF
Ios i pv4_access_lists
Mohamed Gamel
 
PPT
A Short Java Socket Tutorial
Guo Albert
 
PPTX
Socket programming in c
Md. Golam Hossain
 
PDF
Socket programming using C
Ajit Nayak
 
PPTX
Networking in python by Rj
Shree M.L.Kakadiya MCA mahila college, Amreli
 
PPT
Application Layer and Socket Programming
elliando dias
 
PDF
Vapor – Swift is not only for iOS anymore
Milan Vít
 
Socket programming
chandramouligunnemeda
 
Socket Programming Tutorial
Jignesh Patel
 
Sockets
sivindia
 
Socket programming in C
Deepak Swain
 
Java sockets
Stephen Pradeep
 
Network programming Using Python
Karim Sonbol
 
The Real Time Web with XMPP
Jack Moffitt
 
Socket programming-tutorial-sk
sureshkarthick37
 
Elementary TCP Sockets
Saksham Khurana
 
Briefly Rust - Daniele Esposti - Codemotion Rome 2017
Codemotion
 
Basic socket programming
Kristian Arjianto
 
Socket Programming
CEC Landran
 
Ios i pv4_access_lists
Mohamed Gamel
 
A Short Java Socket Tutorial
Guo Albert
 
Socket programming in c
Md. Golam Hossain
 
Socket programming using C
Ajit Nayak
 
Application Layer and Socket Programming
elliando dias
 
Vapor – Swift is not only for iOS anymore
Milan Vít
 
Ad

Similar to Introduction To Distributed Erlang (20)

PDF
Computer network (4)
NYversity
 
PDF
The 1990s Called. They Want Their Code Back.
Jonathan Oliver
 
PPT
Erlang OTP
Zvi Avraham
 
PPTX
CocoaConf: The Language of Mobile Software is APIs
Tim Burks
 
PDF
How to Leverage Go for Your Networking Needs
DigitalOcean
 
PDF
Communication in Python and the C10k problem
Jose Galarza
 
PDF
Fast and Reliable Swift APIs with gRPC
Tim Burks
 
ODP
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Marcelo Gornstein
 
PPT
Advanced Operating System, Distributed Operating System
Shikha Manrai
 
PDF
1032 cs208 g operation system ip camera case share.v0.2
Stanley Ho
 
PDF
OSI Model, Ports, and Protocols Cheat Sheet.pdf
infosec train
 
PDF
OSI MODEL, PORTS, AND PROTOCOLS CHEAT SHEET
priyanshamadhwal2
 
PPT
Rpc (Distributed computing)
Sri Prasanna
 
PDF
Mpi
Bertha Vega
 
PPT
Suman's PhD Candidacy Talk
Suman Srinivasan
 
PPTX
Build reliable, traceable, distributed systems with ZeroMQ
Robin Xiao
 
PPT
SIP for geeks
Kundan Singh
 
PDF
Introduction to Erlang Part 2
Dmitry Zinoviev
 
ZIP
OneTeam Media Server
Mickaël Rémond
 
ZIP
OneTeam Media Server
Mickaël Rémond
 
Computer network (4)
NYversity
 
The 1990s Called. They Want Their Code Back.
Jonathan Oliver
 
Erlang OTP
Zvi Avraham
 
CocoaConf: The Language of Mobile Software is APIs
Tim Burks
 
How to Leverage Go for Your Networking Needs
DigitalOcean
 
Communication in Python and the C10k problem
Jose Galarza
 
Fast and Reliable Swift APIs with gRPC
Tim Burks
 
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Marcelo Gornstein
 
Advanced Operating System, Distributed Operating System
Shikha Manrai
 
1032 cs208 g operation system ip camera case share.v0.2
Stanley Ho
 
OSI Model, Ports, and Protocols Cheat Sheet.pdf
infosec train
 
OSI MODEL, PORTS, AND PROTOCOLS CHEAT SHEET
priyanshamadhwal2
 
Rpc (Distributed computing)
Sri Prasanna
 
Suman's PhD Candidacy Talk
Suman Srinivasan
 
Build reliable, traceable, distributed systems with ZeroMQ
Robin Xiao
 
SIP for geeks
Kundan Singh
 
Introduction to Erlang Part 2
Dmitry Zinoviev
 
OneTeam Media Server
Mickaël Rémond
 
OneTeam Media Server
Mickaël Rémond
 
Ad

Recently uploaded (20)

PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Software Development Methodologies in 2025
KodekX
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Doc9.....................................
SofiaCollazos
 
The Future of Artificial Intelligence (AI)
Mukul
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 

Introduction To Distributed Erlang

  • 1. Introduction to Distributed Erlang Basic principles and a little more
  • 2. About us Developing a new breed of platform for social networking games Scalability is a must Back-end developed with Erlang/OTP And lots of other good stuff Front-end developed with Flex 4
  • 3. About me More stickers than a 40 years old RV!
  • 4. Agenda and non-agenda Quick recap of message passing Core principles of Erlang remoting Global registry and process groups Nothing on Erlang syntax {<<"sorry">>} Nothing on custom networking nor OTP OTP is what you'll use in reality
  • 5. Why Erlang for concurrency? Immutability painted all over it Designed to handle thousands of processes Spawned (not started nor forked) Processes communicate asynchronously Passing messages by value
  • 6. Message sending As easy as: Pid ! Message Sends a message to a process inbox Like with mail delivery: Not sure if the letter reached its destination Needs a letter back if a response is needed
  • 7. RSVP Add address on the envelope for a response
  • 8. RSVP (client) Client is also Server's public API send(Sid, Message) -> Sid!{self(), Message}, receive {From, Response} -> io:format("Client ~p from ~p~n", [Response, From]) after 1000 -> bail end.
  • 9. RSVP (server) start() -> spawn(fun()-> serve() end). serve() -> receive {From, Message} -> io:format("Server ~p from ~p~n", [Message, From]), From!{self(), {ack, Message}}, serve() end.
  • 10. Process registration Allows process naming: register(my_pid, Pid). Frees application from passing Pids around: my_pid ! Message.
  • 11. RPC strikes back Call MFA on single or multiple nodes Declined in zillions of variations: Blocking or not Parallelized, including pmap Makes code location aware Heterogeneous styles: Pid ! Message rpc:call(N,M,F,A)
  • 12. Node connectivity Triggered by: rpc:call ... net_adm:ping(node@host) Nodes shake hands and share information Processes, registrations... Transitive mechanism Node 1 ➟ Node 2 and Node 2 ➟ Node3 then: Node 1 ➟ Node 3
  • 14. Erlang's magic cookie Passed on startup: erl -sname n1 -setcookie=secret Proper node and host naming required Coarse grained security Party time or bust!
  • 15. Global process registry Location transparency: global:register_name(gbs, Sid). global:whereis_name(gbs) ! Message. Wired-in name conflict resolution Still need to ping nodes
  • 16. Process group (1/3) Distributed named process group Processes join and leave: pg2:create(mypg2). pg2:join(mypg2, Sid). pg2:leave(mypg2, Sid).
  • 17. Process group (2/3) pg2 can be used to send messages to: all processes: pg2:get_members(mypg2) local processes: pg2:get_local_members(mypg2) closest / random process: pg2:get_closest_pid(mypg2)
  • 18. Process group (3/3) Also: pg (experimental)
  • 19. Ping pong pang relief net_adm:world and net_adm:world_list Ease node discovery on hosts Requires hosts list Node discovery with nodefinder UDP multicast S3 list for AWS