Erlang FTW!

945 views
897 views

Published on

In the Brave New World of cloud computing, fault tolerance is king. Fault tolerance at all levels - the platform, how and where the data is stored, the services and APIs that are used, and even the ability to recover from bugs ("features"?) in the code. This emphasis has resulted in the growing use of actor programming over object-oriented programming, and in particular, the growing influence of Erlang wherever Reliability and Scalability are prized.
This talk will explore the reason why Erlang is particularly suited for Cloud Applications and Services, and why it should be the basis for your App's infrastructure

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
945
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • Erlang is everywhere. You don’t realize it, but you’re using it. It just works
  • Its how the world works. ‘Synchronous’ and ‘semaphore’ and ‘mutex’ are all (artificial) programming constructs
  • Its how the world works. ‘Synchronous’ and ‘semaphore’ and ‘mutex’ are all (artificial) programming constructs
  • Its how the world works. ‘Synchronous’ and ‘semaphore’ and ‘mutex’ are all (artificial) programming constructs
  • Corresponds to how we think, and helps deal with edge-cases much *much* better!
  • Why wait? Just log on to a node
  • Testing is infinitely easier. Trivial to simulate (its all messages!)
  • Soft real-time. Brief discussion of instrumentation and ‘reductions’
  • Yeah, yeah. And my fish has a bicycle
  • Productivity
  • Because you don’t know how you are going to end up scaling!
  • Really?Yeah, really. Except for FFTs No defensive code, distribution, efficiency
  • Part and parcel of The Erlang WayYou can almost claim that This is how we build Reliable systems!
  • The language is designed from the ground up for concurrency.Why does this even matter? Hold your horses, we’ll get to that in just a moment
  • ‘Distributed’ problems mean you spend a huge chunk of your time dealing with theadminstrivia of distribution.With erlang you get that for free!
  • Ok, not really true. You still have to deal with ‘deep problems’ (hard core parallelization issues, etc.)But you’d have to deal with that anyhow!
  • “Actors”  Think “OO” + “Processes”. Its just that these processes are really cheap
  • Whyerlang? Why not <insert language here>
  • Yup. You can (and people do!) use assembler
  • Don’t shoot yourself in the foot before you get started…
  • Yeah, yeah. Understandable lies. But the bottlenecks are pretty far down the road (and much further than you would have gotten before!)
  • Yeah, yeah. Understandable lies. But the bottlenecks are pretty far down the road (and much further than you would have gotten before!)
  • One process per session + immutable variables = happiness
  • Garbage Collection, Referential Integrity, Testing!!!
  • Syntactic sugar, but so easy to understand
  • Simple, encapsulated, and discreet casses.
  • And even for JVMs hot-swap is limited to the body of methods
  • Erlang has very useful abstractions that help deal with binary data
  • Trivially easy to process
  • Ridiculously light-weight processes. Trivial to create, Automatically GCd.
  • “Let it Crash!”
  • Yeah, yeah. Understandable lies. But the bottlenecks are pretty far down the road (and much further than you would have gotten before!)
  • Erlang FTW!

    1. 1. Erlang FTW! { Mahesh Paolini-Subramanya (@dieswaytoofast) V.P. Ubiquiti Networks James Aimonetti (@jamesaimonetti)
    2. 2. Erlang Everywhere
    3. 3. Why Erlang?
    4. 4.  HorizontalScalability
    5. 5.  HorizontalScalability
    6. 6.  Horizontal  VerticalScalability
    7. 7.  Horizontal  VerticalScalability
    8. 8.  Live!Hot Swapping
    9. 9.  Live!Hot Swapping
    10. 10. Asynchronous Processing
    11. 11. Asynchronous Processing
    12. 12. Asynchronous Processing
    13. 13. Supervision
    14. 14. Live Debugging
    15. 15. Stack Traces
    16. 16. Predictability
    17. 17. Why Erlang?
    18. 18. 4x – 10x less code
    19. 19.  Faster to create4x – 10x less code
    20. 20.  Faster to create  Easier to reason about4x – 10x less code
    21. 21.  Faster to create  Easier to reason about  Fewer bugs4x – 10x less code
    22. 22.  Faster to create  Easier to reason about  Fewer bugs  Speedy refactoring4x – 10x less code
    23. 23. vsScalability
    24. 24. Speed
    25. 25. Reliability
    26. 26.  Concurrency by default  Error encapsulation  Fault detection  Fault identification  Code upgrade  Stable Storage From http://www.erlang.org/download/armstrong_thesis_2003.pdfConcurrency Oriented
    27. 27. My Blue Heaven My Blue HeavenConcurrency HellConcurrency Oriented
    28. 28. My Blue Heaven My Blue Heaven Deep Problem s Concurrency Hell Deep Problem sConcurrency Oriented
    29. 29. Cheap Actors
    30. 30.  Shared vs shared-nothingOO vs Actors
    31. 31.  Shared vs shared-nothing  Inheritance vs BehaviorOO vs Actors
    32. 32.  Shared vs shared-nothing  Inheritance vs Behavior  Sync vs AsyncOO vs Actors
    33. 33. Why Not Java? (Ruby/…)
    34. 34. Why not assembler?
    35. 35.  Trivial thread management (hint: none)Erlang Architecture
    36. 36.  Trivial thread management (hint: none)  Trivial monitoring / load-balancingErlang Architecture
    37. 37.  Trivial thread management (hint: none)  Trivial monitoring / load-balancing  One process per sessionErlang Architecture
    38. 38.  X = 1.Immutable Variables
    39. 39.  X = 1.  X = 2. Huh?Immutable Variables
    40. 40.  X = 1.  X = 2.  X = X + 1. Huh?Immutable Variables
    41. 41.  [ do_something_with(X) || X <- ListOfItems ]List Comprehensions
    42. 42. function greet( Gender, Name ) if Gender == male then print( "Hello, Mr. %s!", Name ) else if Gender == female then print( "Hello, Mrs. %s!", Name ) else print( "Hello, %s!", Name )end vs greet( male, Name ) -> print_out( “Hello Mr. ”, Name ); greet( female, Name ) -> print_out( “Greetings Mrs. ”, Name ); greet( _, Name ) -> print_out( “Wotcher ”, Name ). Functions From http://learnyousomeerlang.com/
    43. 43. Module:code_change( OldVersion, OldState, Stuff ) -> NewState = whatever_you_need_to_do( OldVersion, OldState, Stuff ), { ok, NewState }. vsMonkey Patching?Really?You sure?Functions
    44. 44. << Header:16, Checksum:4, Payload/binary >>.Bit Syntax
    45. 45. [ process_payload(Payload) || <<_Header:16, _Checksum:4, Payload/binary>> <= BunchOfData ].Binary Comprehensions!
    46. 46. … proc:spawn( fun( X ) -> do_stuff( X ) end ), … do_stuff( OnePerson ) -> change_the_world( OnePerson ).Processes
    47. 47. if ( X instanceof Integer ) { try { change_position( X ); } catch ( ArithmeticException a ) { // cant happen. ignore } catch ( PositionException p ) { // why would this happen? } catch ( Exception e ) { // The other code has this here } catch ( Throwable t ) { // Dunno why this was in the other code vs }} proc:spawn( fun( X ) -> change_position( X ) end ), Defensive Programming
    48. 48.  mahesh#dieswaytoofast.com / @dieswaytoofast  james#2600hz.com / @jamesaimonettiQuestions

    ×