Building Scalable Systems: What you can learn from Erlang - DotScale 2016
-
Upload
mickael-remond -
Category
Technology
-
view
556 -
download
1
Transcript of Building Scalable Systems: What you can learn from Erlang - DotScale 2016
![Page 1: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/1.jpg)
Building Scalable SystemsWhat you can Learn from Erlang
![Page 2: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/2.jpg)
![Page 3: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/3.jpg)
First Stop: 1973
![Page 4: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/4.jpg)
Actor Model
• Carl Hewitt
![Page 5: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/5.jpg)
Actor Model Principle
• An actor can:
• Send Messages to other Actors
• Create other Actors
• Process Next Message
![Page 6: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/6.jpg)
Share Nothing
![Page 7: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/7.jpg)
“An Island of Sanity in a Sea of Concurrency"
Actor
State
Actor
State
Actor
State
Actor
State
Actor
State
![Page 8: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/8.jpg)
Naturally scalable
![Page 9: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/9.jpg)
Next stop: 1986
![Page 10: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/10.jpg)
Birth of ErlangJoe Armstrong, Robert Virding, Mike Williams, Bjarne Däcker
![Page 11: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/11.jpg)
Share Nothing with Lightweight Processes
![Page 12: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/12.jpg)
Let it Crash
![Page 13: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/13.jpg)
Handle Failures with Process Links and Supervisors
![Page 14: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/14.jpg)
![Page 15: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/15.jpg)
Next stop: 1998
![Page 16: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/16.jpg)
Erlang VM released as Open Source
![Page 17: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/17.jpg)
Erlang strength lies in the VM
![Page 18: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/18.jpg)
Vertical scaling: Multicore and Scheduler
![Page 19: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/19.jpg)
Horizontal scaling: ClusteringTransparent, well almost
![Page 20: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/20.jpg)
Erlang strengths match Server applications properties
• Server apps are most of the time IO bound
• Server apps are often memory bound.
![Page 21: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/21.jpg)
NetworkStack
Accepted connections
Requests processingServer threads
Pool
Thread
Thread
Thread
Thread
Thread
Thread
Thread
Thread
Thread
…
ClientRequests
X
X
X
Connections Pooli.e. Apache
![Page 22: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/22.jpg)
NetworkStack
Accepted connections
Requests processingLightweight processes
ClientRequests
…
One Connection per Thread
Erlang webservers i.e. Yaws, Cowboy, etc.
![Page 23: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/23.jpg)
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
![Page 24: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/24.jpg)
Back to 2016
![Page 25: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/25.jpg)
Erlang is still the Reference for Scalable Systems
![Page 26: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/26.jpg)
Makes it easier to build Advanced Concurrency Patterns
![Page 27: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/27.jpg)
New languages using the Erlang VM: Elixir, LFE, etc
![Page 28: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/28.jpg)
Inspiration for new languages / Frameworks:
Go, Scala, Akka, Clojure, …
![Page 29: Building Scalable Systems: What you can learn from Erlang - DotScale 2016](https://reader036.fdocuments.in/reader036/viewer/2022081605/587f68451a28ab9b398b6483/html5/thumbnails/29.jpg)
Next Stop ?