erlang - because s**t happens
DESCRIPTION
Erlang begins and ends with Fault Tolerance. Fault Tolerance is - formally! - baked into the very genes of Erlang/OTP - something that ends up being amazingly useful when you are building any kind of system. Remember, your clients (and co-workers!) will find new ways to break things, ways that you could never have imagined in your wildest dreams. This, this is the reason to use Erlang. Once you get it, it completely changes the way you approach development, and you will find yourself writing "erlang" in whatever language you happen to be using (Mind you, writing tail-recursive code in java is a recipe for disaster, but thats another story…) In this talk, I'll get into this buddha-nature of Erlang/OTP, pointing out how the various features of the language tie together into one seamless Fault Tolerant whole. It'll probably run 45 minutes or so, not counting questions…TRANSCRIPT
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Erlang :
Because S**t
happensMahesh Paolini-Subramanya (@dieswaytoofast)V.P. R&D, Ubiquiti Networks
AGILITY
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Horror! The Horror!
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Dude! WTF?!?!
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Surely you Tested?
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Fault ToleranceFrom
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
erlang…
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Parallel
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Parallel
Independent
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Parallel
Independent
Asynchronous message passing
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Parallel
Independent
Asynchronous message passing
No shared state
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Parallel
Independent
Asynchronous message passing
No shared state
Immutable data structures
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
** exception error: no match of
right hand side value
{error,unhappy}
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
** exception error: no match of
right hand side value
{error,unhappy}
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Let it crash
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Let it crash
(all the co-operating ones , that is)
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Let it crash
(all the co-operating ones , that is)
Supervisors can restart them
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Processes!
Let it crash
(all the co-operating ones , that is)
Supervisors can restart them
(When necessary!)
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
mnesia ‘n stuff
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Fault Tolerant System
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
LOOSE C
OUPLING
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Loose Coupling
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Loose Coupling
Breeds Trust
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Loose Coupling
Breeds Trust
Devotes Brainpower appropriately
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Loose Coupling
Breeds Trust
Devotes Brainpower appropriately
Minimizes bugs
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Fault Tolerance
60 - 90% of all SW projects fail
10 – 25% of all SW projects get abandoned
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six - Systems
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six - Systems
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
MONIT
ORING
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Monitoring?
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Monitoring?Dashboards
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Monitoring?Dashboards
Out of band systems
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Monitoring?Dashboards
Out of band systems
Polyglot safety
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six - Systems
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six - Systems
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable StoragePOLYGLO
T
PERSISTENCE
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
(The day it all changed)
Friday, June 29th 2012
• People
• Vendors
• Fraud
Fault Tolerance
The Business
Beware the Black Swan
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Fault Tolerant
Organization
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Concurrency
The Big Six - Organizations
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Concurrency
Error encapsulation
Fault detection
The Big Six - Organizations
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six
Concurrency
Fault detection
Fault Identification
Error Encapsulation
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six - Organizations
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Concurrency
Error encapsulation
Fault detection
Fault identification
Code upgrade
The Big Six - Organizations
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
The Big Six - Organizations
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
From
http://www.erlang.org/download/armstrong_thesis_2003.pdf
• Concurrency
• Error encapsulation
• Fault detection
• Fault identification
• Code upgrade
• Stable Storage
The Big Six - Organizations
Is It Safe?
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
Concurrency
Fault detection
Fault Identification
Error Encapsulation
Code upgrade
Stable Storage
EVERYWHERE!!!
V 1.0 © Ubiquiti Networks, Inc. All Rights Reserved
Erlang – because s**t happens
@dieswaytoofast