SlideShare a Scribd company logo
1 of 39
Download to read offline
Thinking in a Highly Concurrent,
Mostly-functional Language
Code Motion
Rome, April 11th 2014
Francesco Cesarini
Founder & Technical Director
@francescoC
francesco@erlang-solutions.com
Thinking in a Highly Concurrent,
Mostly-functional Language
QCON London, March 12th, 2009
Erlang Training and Consulting Ltd
Francesco Cesarini
francesco@erlang-consulting.com
© 2014 – Erlang Solutions Ltd
counter_loop(Count) ->
receive
increment ->
counter_loop(Count + 1);
{count, To} ->
To ! {count, Count},
counter_loop(Count)
end.
Erlang
© 2014 – Erlang Solutions Ltd
Tim Bray, Director of Web Technologies – Sun Microsystems
© 2014 – Erlang Solutions Ltd
Tim Bray, Director of Web Technologies – Sun Microsystems
© 2014 – Erlang Solutions Ltd
Syntax
© 2014 – Erlang Solutions Ltd
Concurrency
© 2014 – Erlang Solutions Ltd
activity(Joe,75,1024)
Erlang Highlights: Concurrency
Creating a new process using spawn
-module(ex3).
-export([activity/3]).
activity(Name,Pos,Size) ->
…………
Pid = spawn(ex3,activity,[Joe,75,1024])
© 2014 – Erlang Solutions Ltd
Erlang Highlights: Concurrency
Processes communicate by asynchronous
message passing
Pid ! {data,12,13}
receive
{start} -> ………
{stop} -> ………
{data,X,Y} -> ………
end
receive
{start} -> ………
{stop} -> ………
{data,X,Y} -> ………
end
© 2014 – Erlang Solutions Ltd
Products: AXD301 Switch - 1996
A Telephony-Class, scalable (10 –
160 GBps) ATM switch
Designed from scratch in less than
3 years
AXD 301 Success factors:
!  Competent organisation and people
!  Efficient process
!  Excellent technology (e.g. Erlang/OTP)
© 2014 – Erlang Solutions Ltd
Products: AXD301 Switch - 1996
Erlang: ca 1.5 million lines of code
!  Nearly all the complex control logic
!  Operation & Maintenance
!  Web server and runtime HTML/
JavaScript generation
C/C++: ca 500k lines of code
!  Third party software
!  Low-level protocol drivers
!  Device drivers
Java: ca 13k lines of code
!  Operator GUI applets
© 2014 – Erlang Solutions Ltd
Concurrency Modeling
Model for the natural
concurrency in your problem
In the old days, processes were
a critical resource
!  Rationing processes led to complex and
unmanageable code
Nowadays, processes are very
cheap: if you need a process –
create one!
Example: AXD301 process model
1st prototype:
6 processes/call
2 processes/call
1 process/all calls
2 processes/
call transaction
4-5 processes/
call transaction
© 2014 – Erlang Solutions Ltd
1+1 Redundancy – Good ol’ Telecoms
Data path
Control signalling
Device board
Control plane
User plane
Active Standby
Stable-state
replication
~ 35 000 calls
per processor pair
No ongoing sessions
lost at “failover”
© 2014 – Erlang Solutions Ltd
First IM Proxy Prototype - 2000
multiplexing
multiplexingde-multiplexing
de-multiplexing
state/error handling
users
sockets listener
sockets
© 2014 – Erlang Solutions Ltd
First IM Proxy Prototype - 2000
multiplexing
multiplexingde-multiplexing
state/error handling
users
sockets listener
sockets supervisor
simple 1-1
© 2014 – Erlang Solutions Ltd
Products: EjabberD IM Server - 2002
A distributed XMPP server
Started as an Open Source
Project by Alexey Shchepin
Commercially Supported by
Process-One (Paris)
!  40% of the XMPP IM market
!  Used as a transport layer
!  Manages 30,000 users / node
© 2014 – Erlang Solutions Ltd
Products: EjabberD IM Server - 2002
A distributed XMPP server
Started as an Open Source
Project by Alexey Shchepin
Commercially Supported by
Process-One (Paris)
!  40% of the XMPP IM market
!  Used as a transport layer
!  Manages 30,000 users / node
MongooseIM is a fork (2014)
!  Open Source, supported by Erlang Solutions
!  Used for Messaging and Device Management
!  1 million users / node
© 2014 – Erlang Solutions Ltd
Fully Replicated Cluster – Ejabberd 2002
s2s
muc
c2s
sm
s2s
muc
c2s
sm
s2s
muc
c2s
sm
Fully replicated
Mnesia database
Client must re-connect
if one of its session
handlers dies
Loadbalancer
© 2014 – Erlang Solutions Ltd
Share-nothing Architecture – Messaging Gateway
© 2014 – Erlang Solutions Ltd
Share-nothing Architecture – Messaging Gateway
DBMS
POP
IMAP
SMTP
...
Router/FE Router/FE Router/FE Router/FE
POP
IMAP
SMTP
...
POP
IMAP
SMTP
...
tunnel tunnel
HTTP
HTTP
© 2014 – Erlang Solutions Ltd
Erlang Concurrency Under Stress – Pre-SMPThroughput/Second
Simultaneous Requests
100% CPU
Line 1 Balanced Erlang System
Line 2 Erlang System with bottle necks
© 2014 – Erlang Solutions Ltd
Erlang Concurrency Under Stress – Pre-SMP
YAWS Throughput
(KBytes/second)
Simultaneous Requests
© 2014 – Erlang Solutions Ltd
Erlang Concurrency Under Stress – Post-SMP
© 2014 – Erlang Solutions Ltd
Stress Tests With SMP
I/O Starvation
TCP/IP Congestion
Memory Spikes
Timeout Fine-tuning
OS Limitations
ERTS Configuration Flags
Shut down Audit Logs
© 2014 – Erlang Solutions Ltd
SMP bottlenecks – pre 2008
© 2014 – Erlang Solutions Ltd
SMP bottlenecks – post 2008
Erlang VM
Scheduler #1
Scheduler #2
run queue
Scheduler #2
Scheduler #N
run queue
run queue
migration
logic
migration
logic
© 2014 – Erlang Solutions Ltd
Big Bang Benchmark – post 2008
" 
© 2014 – Erlang Solutions Ltd
Mandelbrot- 2013
" 
© 2014 – Erlang Solutions Ltd
Now for the Bottlenecks
" 
© 2014 – Erlang Solutions Ltd
Now for the Bottlenecks
" 
© 2014 – Erlang Solutions Ltd
Now for the Bottlenecks
© 2014 – Erlang Solutions Ltd
Now for the Bottlenecks www.concurix.com
© 2014 – Erlang Solutions Ltd
Now for the Bottlenecks
© 2014 – Erlang Solutions Ltd
Clusters and SD Erlang
© 2014 – Erlang Solutions Ltd
Riak and other scalable architectures
© 2014 – Erlang Solutions Ltd
“To scale the radical concurrency-oriented
programming paradigm to build reliable
general-purpose software, such as server-
based systems, on massively parallel
machines (10^5 cores).”
! ! ! ! ! !"
Release Statement of Aims
© 2014 – Erlang Solutions Ltd
“Limitations exist on all levels. You would not
want an Erlang VM to run with 10^5
schedulers.”
! ! ! ! ! !"
Release
© 2014 – Erlang Solutions Ltd
Release
Push the responsibility for scalability from the programmer to
the VM
Analyze performance and scalability
Identify bottlenecks and prioritize changes and extensions
Tackle well-known scalability issues
Ets tables (shared global data structure)
Message passing, copying and frequently communicating
processes
© 2014 – Erlang Solutions Ltd

More Related Content

Similar to Thinking in a Highly Concurrent, Mostly-functional Language - Cesarini

NDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsNDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsTorben Hoffmann
 
Erlang latest version & opensource projects
Erlang latest version & opensource projectsErlang latest version & opensource projects
Erlang latest version & opensource projectsDigikrit
 
Erlang from behing the trenches by Francesco Cesarini
Erlang from behing the trenches by Francesco CesariniErlang from behing the trenches by Francesco Cesarini
Erlang from behing the trenches by Francesco CesariniNaresh Jain
 
EMC Atmos for service providers
EMC Atmos for service providersEMC Atmos for service providers
EMC Atmos for service providerssolarisyougood
 
Machine Learning With Spark
Machine Learning With SparkMachine Learning With Spark
Machine Learning With SparkShivaji Dutta
 
10 years in Network Protocol testing L2 L3 L4-L7 Tcl Python Manual and Automa...
10 years in Network Protocol testing L2 L3 L4-L7 Tcl Python Manual and Automa...10 years in Network Protocol testing L2 L3 L4-L7 Tcl Python Manual and Automa...
10 years in Network Protocol testing L2 L3 L4-L7 Tcl Python Manual and Automa...Mullaiselvan Mohan
 
NTTs Journey with Openstack-final
NTTs Journey with Openstack-finalNTTs Journey with Openstack-final
NTTs Journey with Openstack-finalshintaro mizuno
 
Introduction To Erlang Final
Introduction To Erlang   FinalIntroduction To Erlang   Final
Introduction To Erlang FinalSinarShebl
 
The design and implementation of a scalable concurrent virtual machine (Rober...
The design and implementation of a scalable concurrent virtual machine (Rober...The design and implementation of a scalable concurrent virtual machine (Rober...
The design and implementation of a scalable concurrent virtual machine (Rober...Ontico
 
The Verification Methodology Landscape
The Verification Methodology LandscapeThe Verification Methodology Landscape
The Verification Methodology LandscapeDVClub
 
Manufacturing Webinar AMS
Manufacturing Webinar AMSManufacturing Webinar AMS
Manufacturing Webinar AMSSplunk
 
Cloudtestr Webinar - 5 Ways to Maximize Test Automation Success
Cloudtestr Webinar - 5 Ways to Maximize Test Automation Success Cloudtestr Webinar - 5 Ways to Maximize Test Automation Success
Cloudtestr Webinar - 5 Ways to Maximize Test Automation Success Cloudtestr Inc.
 
Erlang及其应用
Erlang及其应用Erlang及其应用
Erlang及其应用Feng Yu
 
The design and implementation of a scalable concurrent virtual machine (Rober...
The design and implementation of a scalable concurrent virtual machine (Rober...The design and implementation of a scalable concurrent virtual machine (Rober...
The design and implementation of a scalable concurrent virtual machine (Rober...Ontico
 
An introduction to erlang
An introduction to erlangAn introduction to erlang
An introduction to erlangMirko Bonadei
 
T01520010220104023 t0152 pert 10
T01520010220104023 t0152 pert 10T01520010220104023 t0152 pert 10
T01520010220104023 t0152 pert 10Fenroy D-Messiah
 
Mool - Automated Log Analysis using Data Science and ML
Mool - Automated Log Analysis using Data Science and MLMool - Automated Log Analysis using Data Science and ML
Mool - Automated Log Analysis using Data Science and MLDataWorks Summit/Hadoop Summit
 

Similar to Thinking in a Highly Concurrent, Mostly-functional Language - Cesarini (20)

NDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsNDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business Needs
 
Erlang latest version & opensource projects
Erlang latest version & opensource projectsErlang latest version & opensource projects
Erlang latest version & opensource projects
 
DhevendranResume
DhevendranResumeDhevendranResume
DhevendranResume
 
Erlang from behing the trenches by Francesco Cesarini
Erlang from behing the trenches by Francesco CesariniErlang from behing the trenches by Francesco Cesarini
Erlang from behing the trenches by Francesco Cesarini
 
EMC Atmos for service providers
EMC Atmos for service providersEMC Atmos for service providers
EMC Atmos for service providers
 
Machine Learning With Spark
Machine Learning With SparkMachine Learning With Spark
Machine Learning With Spark
 
10 years in Network Protocol testing L2 L3 L4-L7 Tcl Python Manual and Automa...
10 years in Network Protocol testing L2 L3 L4-L7 Tcl Python Manual and Automa...10 years in Network Protocol testing L2 L3 L4-L7 Tcl Python Manual and Automa...
10 years in Network Protocol testing L2 L3 L4-L7 Tcl Python Manual and Automa...
 
NTTs Journey with Openstack-final
NTTs Journey with Openstack-finalNTTs Journey with Openstack-final
NTTs Journey with Openstack-final
 
Introduction To Erlang Final
Introduction To Erlang   FinalIntroduction To Erlang   Final
Introduction To Erlang Final
 
The design and implementation of a scalable concurrent virtual machine (Rober...
The design and implementation of a scalable concurrent virtual machine (Rober...The design and implementation of a scalable concurrent virtual machine (Rober...
The design and implementation of a scalable concurrent virtual machine (Rober...
 
The Verification Methodology Landscape
The Verification Methodology LandscapeThe Verification Methodology Landscape
The Verification Methodology Landscape
 
Manufacturing Webinar AMS
Manufacturing Webinar AMSManufacturing Webinar AMS
Manufacturing Webinar AMS
 
Cloudtestr Webinar - 5 Ways to Maximize Test Automation Success
Cloudtestr Webinar - 5 Ways to Maximize Test Automation Success Cloudtestr Webinar - 5 Ways to Maximize Test Automation Success
Cloudtestr Webinar - 5 Ways to Maximize Test Automation Success
 
Erlang及其应用
Erlang及其应用Erlang及其应用
Erlang及其应用
 
The design and implementation of a scalable concurrent virtual machine (Rober...
The design and implementation of a scalable concurrent virtual machine (Rober...The design and implementation of a scalable concurrent virtual machine (Rober...
The design and implementation of a scalable concurrent virtual machine (Rober...
 
An introduction to erlang
An introduction to erlangAn introduction to erlang
An introduction to erlang
 
T01520010220104023 t0152 pert 10
T01520010220104023 t0152 pert 10T01520010220104023 t0152 pert 10
T01520010220104023 t0152 pert 10
 
Mool - Automated Log Analysis using Data Science and ML
Mool - Automated Log Analysis using Data Science and MLMool - Automated Log Analysis using Data Science and ML
Mool - Automated Log Analysis using Data Science and ML
 
Vishal_Resume
Vishal_ResumeVishal_Resume
Vishal_Resume
 
CV (eng) Thomas Lindström
CV (eng) Thomas LindströmCV (eng) Thomas Lindström
CV (eng) Thomas Lindström
 

More from Codemotion

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Codemotion
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyCodemotion
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaCodemotion
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserCodemotion
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Codemotion
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Codemotion
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Codemotion
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 - Codemotion
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Codemotion
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Codemotion
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Codemotion
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Codemotion
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Codemotion
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Codemotion
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Codemotion
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...Codemotion
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Codemotion
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Codemotion
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Codemotion
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Codemotion
 

More from Codemotion (20)

Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
 
Pompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending storyPompili - From hero to_zero: The FatalNoise neverending story
Pompili - From hero to_zero: The FatalNoise neverending story
 
Pastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storiaPastore - Commodore 65 - La storia
Pastore - Commodore 65 - La storia
 
Pennisi - Essere Richard Altwasser
Pennisi - Essere Richard AltwasserPennisi - Essere Richard Altwasser
Pennisi - Essere Richard Altwasser
 
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
 
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
 
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
 
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 - Francesco Baldassarri  - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
 
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
 
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
 
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
 
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
 
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
 
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
 
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
 
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
 
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
 
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
 
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
 
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
 

Recently uploaded

UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 

Recently uploaded (20)

UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 

Thinking in a Highly Concurrent, Mostly-functional Language - Cesarini

  • 1. Thinking in a Highly Concurrent, Mostly-functional Language Code Motion Rome, April 11th 2014 Francesco Cesarini Founder & Technical Director @francescoC francesco@erlang-solutions.com
  • 2. Thinking in a Highly Concurrent, Mostly-functional Language QCON London, March 12th, 2009 Erlang Training and Consulting Ltd Francesco Cesarini francesco@erlang-consulting.com
  • 3. © 2014 – Erlang Solutions Ltd counter_loop(Count) -> receive increment -> counter_loop(Count + 1); {count, To} -> To ! {count, Count}, counter_loop(Count) end. Erlang
  • 4. © 2014 – Erlang Solutions Ltd Tim Bray, Director of Web Technologies – Sun Microsystems
  • 5. © 2014 – Erlang Solutions Ltd Tim Bray, Director of Web Technologies – Sun Microsystems
  • 6. © 2014 – Erlang Solutions Ltd Syntax
  • 7. © 2014 – Erlang Solutions Ltd Concurrency
  • 8. © 2014 – Erlang Solutions Ltd activity(Joe,75,1024) Erlang Highlights: Concurrency Creating a new process using spawn -module(ex3). -export([activity/3]). activity(Name,Pos,Size) -> ………… Pid = spawn(ex3,activity,[Joe,75,1024])
  • 9. © 2014 – Erlang Solutions Ltd Erlang Highlights: Concurrency Processes communicate by asynchronous message passing Pid ! {data,12,13} receive {start} -> ……… {stop} -> ……… {data,X,Y} -> ……… end receive {start} -> ……… {stop} -> ……… {data,X,Y} -> ……… end
  • 10. © 2014 – Erlang Solutions Ltd Products: AXD301 Switch - 1996 A Telephony-Class, scalable (10 – 160 GBps) ATM switch Designed from scratch in less than 3 years AXD 301 Success factors: !  Competent organisation and people !  Efficient process !  Excellent technology (e.g. Erlang/OTP)
  • 11. © 2014 – Erlang Solutions Ltd Products: AXD301 Switch - 1996 Erlang: ca 1.5 million lines of code !  Nearly all the complex control logic !  Operation & Maintenance !  Web server and runtime HTML/ JavaScript generation C/C++: ca 500k lines of code !  Third party software !  Low-level protocol drivers !  Device drivers Java: ca 13k lines of code !  Operator GUI applets
  • 12. © 2014 – Erlang Solutions Ltd Concurrency Modeling Model for the natural concurrency in your problem In the old days, processes were a critical resource !  Rationing processes led to complex and unmanageable code Nowadays, processes are very cheap: if you need a process – create one! Example: AXD301 process model 1st prototype: 6 processes/call 2 processes/call 1 process/all calls 2 processes/ call transaction 4-5 processes/ call transaction
  • 13. © 2014 – Erlang Solutions Ltd 1+1 Redundancy – Good ol’ Telecoms Data path Control signalling Device board Control plane User plane Active Standby Stable-state replication ~ 35 000 calls per processor pair No ongoing sessions lost at “failover”
  • 14. © 2014 – Erlang Solutions Ltd First IM Proxy Prototype - 2000 multiplexing multiplexingde-multiplexing de-multiplexing state/error handling users sockets listener sockets
  • 15. © 2014 – Erlang Solutions Ltd First IM Proxy Prototype - 2000 multiplexing multiplexingde-multiplexing state/error handling users sockets listener sockets supervisor simple 1-1
  • 16. © 2014 – Erlang Solutions Ltd Products: EjabberD IM Server - 2002 A distributed XMPP server Started as an Open Source Project by Alexey Shchepin Commercially Supported by Process-One (Paris) !  40% of the XMPP IM market !  Used as a transport layer !  Manages 30,000 users / node
  • 17. © 2014 – Erlang Solutions Ltd Products: EjabberD IM Server - 2002 A distributed XMPP server Started as an Open Source Project by Alexey Shchepin Commercially Supported by Process-One (Paris) !  40% of the XMPP IM market !  Used as a transport layer !  Manages 30,000 users / node MongooseIM is a fork (2014) !  Open Source, supported by Erlang Solutions !  Used for Messaging and Device Management !  1 million users / node
  • 18. © 2014 – Erlang Solutions Ltd Fully Replicated Cluster – Ejabberd 2002 s2s muc c2s sm s2s muc c2s sm s2s muc c2s sm Fully replicated Mnesia database Client must re-connect if one of its session handlers dies Loadbalancer
  • 19. © 2014 – Erlang Solutions Ltd Share-nothing Architecture – Messaging Gateway
  • 20. © 2014 – Erlang Solutions Ltd Share-nothing Architecture – Messaging Gateway DBMS POP IMAP SMTP ... Router/FE Router/FE Router/FE Router/FE POP IMAP SMTP ... POP IMAP SMTP ... tunnel tunnel HTTP HTTP
  • 21. © 2014 – Erlang Solutions Ltd Erlang Concurrency Under Stress – Pre-SMPThroughput/Second Simultaneous Requests 100% CPU Line 1 Balanced Erlang System Line 2 Erlang System with bottle necks
  • 22. © 2014 – Erlang Solutions Ltd Erlang Concurrency Under Stress – Pre-SMP YAWS Throughput (KBytes/second) Simultaneous Requests
  • 23. © 2014 – Erlang Solutions Ltd Erlang Concurrency Under Stress – Post-SMP
  • 24. © 2014 – Erlang Solutions Ltd Stress Tests With SMP I/O Starvation TCP/IP Congestion Memory Spikes Timeout Fine-tuning OS Limitations ERTS Configuration Flags Shut down Audit Logs
  • 25. © 2014 – Erlang Solutions Ltd SMP bottlenecks – pre 2008
  • 26. © 2014 – Erlang Solutions Ltd SMP bottlenecks – post 2008 Erlang VM Scheduler #1 Scheduler #2 run queue Scheduler #2 Scheduler #N run queue run queue migration logic migration logic
  • 27. © 2014 – Erlang Solutions Ltd Big Bang Benchmark – post 2008 " 
  • 28. © 2014 – Erlang Solutions Ltd Mandelbrot- 2013 " 
  • 29. © 2014 – Erlang Solutions Ltd Now for the Bottlenecks " 
  • 30. © 2014 – Erlang Solutions Ltd Now for the Bottlenecks " 
  • 31. © 2014 – Erlang Solutions Ltd Now for the Bottlenecks
  • 32. © 2014 – Erlang Solutions Ltd Now for the Bottlenecks www.concurix.com
  • 33. © 2014 – Erlang Solutions Ltd Now for the Bottlenecks
  • 34. © 2014 – Erlang Solutions Ltd Clusters and SD Erlang
  • 35. © 2014 – Erlang Solutions Ltd Riak and other scalable architectures
  • 36. © 2014 – Erlang Solutions Ltd “To scale the radical concurrency-oriented programming paradigm to build reliable general-purpose software, such as server- based systems, on massively parallel machines (10^5 cores).” ! ! ! ! ! !" Release Statement of Aims
  • 37. © 2014 – Erlang Solutions Ltd “Limitations exist on all levels. You would not want an Erlang VM to run with 10^5 schedulers.” ! ! ! ! ! !" Release
  • 38. © 2014 – Erlang Solutions Ltd Release Push the responsibility for scalability from the programmer to the VM Analyze performance and scalability Identify bottlenecks and prioritize changes and extensions Tackle well-known scalability issues Ets tables (shared global data structure) Message passing, copying and frequently communicating processes
  • 39. © 2014 – Erlang Solutions Ltd