Building Scalable Systems
What you can Learn from Erlang
First Stop: 1973
Actor Model
• Carl Hewitt
Actor Model Principle
• An actor can:
• Send Messages to other Actors
• Create other Actors
• Process Next Message
Share Nothing
“An Island of Sanity in a Sea of Concurrency"
Actor
State
Actor
State
Actor
State
Actor
State
Actor
State
Naturally scalable
Next stop: 1986
Birth of Erlang
Joe Armstrong, Robert Virding, Mike Williams, Bjarne Däcker
Share Nothing with Lightweight
Processes
Let it Crash
Handle Failures with Process Links
and Supervisors
Next stop: 1998
Erlang VM released as Open
Source
Erlang strength lies in the VM
Vertical scaling:
Multicore and Scheduler
Horizontal scaling:
Clustering
Transparent, well almost
Erlang strengths match
Server applications properties
• Server apps are most of the time IO bound
• Server apps are often memory bound.
Network
Stack
Accepted connections
Requests processing
Server threads
Pool
Thread
Thread
Thread
Thread
Thread
Thread
Thread
Thread
Thread
…
Client
Requests
X
X
X
Connections Pool
i.e. Apache
Network
Stack
Accepted connections
Requests processing
Lightweight processes
Client
Requests
…
One Connection per
Thread
Erlang webservers
i.e. Yaws, Cowboy, etc.
Design comparison
• Number of requests handled in
peak time: 1Ks to 10ks
• Throughput: reduce quickly
when max concurrency
reached
• More complex code
• Number of concurrent requests
handle in peak time: 100Ks to
1Ms
• Throughput: Higher for large
number of concurrent requests.
• Simple code, no pool to
manage
Design with worker thread pools Design with Erlang processes
Back to 2016
Erlang is still the Reference for
Scalable Systems
Makes it easier to build
Advanced Concurrency Patterns
New languages using the
Erlang VM: Elixir, LFE, etc
Inspiration for new languages /
Frameworks:
Go, Scala, Akka, Clojure, …
Next Stop ?

Building Scalable Systems: What you can learn from Erlang - DotScale 2016