@michaelneale
www.CloudBees.com
@michaelneale
github.com/michaelneale
currently: trying to make less reliable things more
reliable.
Some things we use to get it done:
- scala (back end apps)
- ruby (chef, rails, proxymachine, lots)
- java (jenkins and plugins)
- erlang (“agents” and lots more..)
Exceptions. Errors.
What The Hell Is That Process Doing?
and how it relates to..
On Call PTSD
Exception handling is wrong...
But it seems harmless...
Erlang says no no no...
Question: a process on server not responding
Answer:
1) panic
2) take time thinking about underlying cause
3) bounce the bastard and pray **
FACT: Answer#3 will often work so well, you
often don’t really spend time to think about
doing #2**



** FibreError?
Imagine a programming environment:
 - unlimited process spawning
 - concurrency someone else’s problem
 - don’t try to handle errors - let it fail
Erlang
Built for stability, and not bothering me.
Anything else is gravy


I wasn’t an erlang programmer
Process isolation
- it works so well
- nothing shared
- has worked so well for so long with OSes
- in erlang - each ‘process’ is like a process !
nginx    Example: My Host OS

     haproxy               Erlang process

                         supervisor
                            ...
                       p1         p999



Each: own heap, garbage collector
Erlang is:
- A vm based runtime (light !)
- language with prolog heritage (!)
- compiler
- interpreter
- debug tools - batteries included
- OTP - an application (server?) platform
Erlang is:
- Not OO
- no shared state **
- state kept in “term stores” - mini DBs
- processes easy to hot swap
- Quasi functional programming
    (immutable variables, higher order)
- distributed (if you want)
OTP
- Open Telecommunications Platform
- not about telco !
- network stacks/apis, supervisor trees
- toolkit for reliable servers (middleware)
- behaviours
State in erlang




files
         Host + real kernel
                        Erlang process

DETS                supervisor
             ...
ETS                p1                    p999



              Send                       Receive
Erlang processes, like OS processes


- Can only send messages to each other
- Can fail independently
- Can be restarted, safely, independently
- Easy to write apps for - Old School !
Better


- Tiny overhead (can have 100K+ of them !)
- perfect for supervisory agents
- distribute: run on every box if you like !
- lots of processes == lots of concurrency
- if you need to block, block !
Have used erlang for


- Supervisory agents - controllers
- Autoscaling services (realtime data analytics)
- misc backend systems
- fun command line tools !
- is “lite” VM (startup, footprint)
Supervisor configuration


- Declare rules for restarting, failure
- So you don’t have to intervene !
- can hot reload changes
- can have dependent processes
Restart just busted process
Program 1 (module with behaviour)
Program 2 (module with behaviour)
Anyway, that is why we use Erlang, also...
- RabbitMQ
- Riak (nosql DB)
- CouchDB (nosql DB)
- Probably your telephone exchange
Alternative approaches:
- Use “native” with daemontools/monit etc
- Akka (Scala) has similar supervisor
- library for your favourite language
- ephemeral “state less” apps
- Write software without bugs
- Or just restart everything 400 times a day
What is not awesome:
- OTP boiler plate
- VM not as fast as some
- No one seems to like the language
- tools? IDEs?
Thank you

Osdc 2011 michael_neale

  • 1.
  • 2.
    @michaelneale github.com/michaelneale currently: trying tomake less reliable things more reliable.
  • 3.
    Some things weuse to get it done: - scala (back end apps) - ruby (chef, rails, proxymachine, lots) - java (jenkins and plugins) - erlang (“agents” and lots more..)
  • 4.
    Exceptions. Errors. What TheHell Is That Process Doing? and how it relates to..
  • 5.
  • 6.
  • 7.
    But it seemsharmless...
  • 10.
  • 11.
    Question: a processon server not responding Answer: 1) panic 2) take time thinking about underlying cause 3) bounce the bastard and pray **
  • 12.
    FACT: Answer#3 willoften work so well, you often don’t really spend time to think about doing #2** ** FibreError?
  • 14.
    Imagine a programmingenvironment: - unlimited process spawning - concurrency someone else’s problem - don’t try to handle errors - let it fail
  • 15.
    Erlang Built for stability,and not bothering me. Anything else is gravy I wasn’t an erlang programmer
  • 16.
    Process isolation - itworks so well - nothing shared - has worked so well for so long with OSes - in erlang - each ‘process’ is like a process !
  • 17.
    nginx Example: My Host OS haproxy Erlang process supervisor ... p1 p999 Each: own heap, garbage collector
  • 18.
    Erlang is: - Avm based runtime (light !) - language with prolog heritage (!) - compiler - interpreter - debug tools - batteries included - OTP - an application (server?) platform
  • 19.
    Erlang is: - NotOO - no shared state ** - state kept in “term stores” - mini DBs - processes easy to hot swap - Quasi functional programming (immutable variables, higher order) - distributed (if you want)
  • 23.
    OTP - Open TelecommunicationsPlatform - not about telco ! - network stacks/apis, supervisor trees - toolkit for reliable servers (middleware) - behaviours
  • 27.
    State in erlang files Host + real kernel Erlang process DETS supervisor ... ETS p1 p999 Send Receive
  • 28.
    Erlang processes, likeOS processes - Can only send messages to each other - Can fail independently - Can be restarted, safely, independently - Easy to write apps for - Old School !
  • 29.
    Better - Tiny overhead(can have 100K+ of them !) - perfect for supervisory agents - distribute: run on every box if you like ! - lots of processes == lots of concurrency - if you need to block, block !
  • 30.
    Have used erlangfor - Supervisory agents - controllers - Autoscaling services (realtime data analytics) - misc backend systems - fun command line tools ! - is “lite” VM (startup, footprint)
  • 31.
    Supervisor configuration - Declarerules for restarting, failure - So you don’t have to intervene ! - can hot reload changes - can have dependent processes
  • 32.
  • 33.
    Program 1 (modulewith behaviour)
  • 34.
    Program 2 (modulewith behaviour)
  • 35.
    Anyway, that iswhy we use Erlang, also... - RabbitMQ - Riak (nosql DB) - CouchDB (nosql DB) - Probably your telephone exchange
  • 36.
    Alternative approaches: - Use“native” with daemontools/monit etc - Akka (Scala) has similar supervisor - library for your favourite language - ephemeral “state less” apps - Write software without bugs - Or just restart everything 400 times a day
  • 37.
    What is notawesome: - OTP boiler plate - VM not as fast as some - No one seems to like the language - tools? IDEs?
  • 38.