Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Reasonable Concurrency with Actors and Elixir

Reasonable Concurrency with Actors and Elixir


Chris Keathley

October 02, 2015


  1. Reason-able Concurrency with Actors

  2. Reasonable “able to think, understand, or form judgments by a

    logical process.”
  3. None
  4. Concurrency

  5. What are we here for? (besides beer)

  6. What are we here for? Context

  7. What are we here for? Context Opinionated Statement

  8. What are we here for? Context Opinionated Statement Moralize

  9. What are we here for? Context Opinionated Statement Moralize repeat

  10. Context

  11. None
  12. None
  13. Holding things in your head is hard

  14. Elixir

  15. Elixir “Dynamic, Functional language designed for building scalable and maintainable

  16. Elixir Erlang VM

  17. Erlang VM Immutable Data Structures Elixir

  18. Erlang VM Immutable Data Structures Pattern Matching Elixir

  19. Erlang VM Immutable Data Structures Pattern Matching Hygienic Macros Elixir

  20. Erlang VM Immutable Data Structures Pattern Matching Hygienic Macros “Green”

    Processes Elixir
  21. None
  22. None
  23. #1

  24. #1 Elixir is OO

  25. #1 Elixir is OO And thats a good thing

  26. Object Oriented: the good parts

  27. smallTalk-72

  28. Message Passing

  29. Boundaries

  30. Encapsulate Errors

  31. Processes FTW.

  32. “concurrent processes with no data sharing provide a strong measure

    of fault isolation. A software error in a concurrent process should not influence processing in the other processes in the system.” - Joe Armstrong
  33. “As soon as two processes share any common resource…the possibility

    exists that a software error in one of the processes will corrupt the shared resource. Since eliminating all such software errors for large software systems is an unsolved problem I think that the only realistic way to build large reliable systems is by partitioning the system into independent parallel processes, and by providing mechanisms for monitoring and restarting these processes” - Joe Armstrong
  34. OTP

  35. OTP Actors

  36. OTP Actors Messages + Mailboxes

  37. OTP Actors Messages + Mailboxes Hot code swapping

  38. None
  39. None
  40. Moralizing

  41. State is in your app

  42. State Should be small

  43. State should be hidden

  44. #2

  45. #2 Failure

  46. #2 Failure Its time to get over it

  47. Failures are latent

  48. Failures are latent “The complexity of these systems makes it

    impossible for them to run without multiple flaws being present"
  49. Failures are latent “The high consequences of failure lead over

    time to the construction of multiple layers of defense against failure…The effect of these measures is to provide a series of shields that normally divert operations away from accidents”
  50. None
  51. None
  52. Supervisors

  53. None
  54. Supervisor Stack

  55. None
  56. None
  57. None
  58. Persistance

  59. None
  60. None
  61. None
  62. Supervisor Stack Database

  63. None
  64. None
  65. None
  66. None
  67. None
  68. Moralizing

  69. Failures Will Happen

  70. Failures should be

  71. Failures should be Seen

  72. Failures should be Seen Isolated

  73. Supervise Complexity

  74. Supervision Hierarchy

  75. Intentional Programming

  76. Let it Fail

  77. Thanks