Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Erlang FTW!

1,054 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

  • Be the first to comment

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

×