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

Failing Gracefully with the Actor Model

Failing Gracefully with the Actor Model

Patterns for resiliency using the Actor Model

Roger Johansson

May 03, 2017
Tweet

More Decks by Roger Johansson

Other Decks in Programming

Transcript

  1. Roger Johansson Akka.NET and Proto.Actor Founder Solution Architect - Betsson

    Group Twitter: @rogeralsing Github: rogeralsing Mail: [email protected] Github.com/rogeralsing/presentations http://Proto.Actor
  2. An escalator can never break: it can only become stairs.

    You should never see an Escalator Temporarily Out Of Order sign, just Escalator Temporarily Stairs. Sorry for the convenience. -Mitch Hedberg
  3. Three axioms: Send – an actor can send messages to

    other actors Create – an actor can create new actors Become – an actor can decide how to handle it’s next message
  4. ”An island of consistency in a sea of concurrency” ”Shared

    nothing”, ”Black box” ”Location transparent”, ”Distributable by design”
  5. Implementations: BEAM – Erlang, Elixir, LFE JVM – Akka, Orbit

    .NET – Akka.NET, Proto.Actor, Microsoft Orleans Go – Proto.Actor
  6. /c2 /b2 /b1 /a1 /a2 /b3 /c3 /c4 /c5 /

    /c1 OneForOne supervisor AllForOne supervisor /b1 /b3
  7. ! ! ! ! Router Worker 1 Worker 2 Worker

    3 Return first reply Consumer
  8. ! ! ! ! Router Worker 2 Worker 3 Require

    same reply from at least N workers Consumer Worker 1
  9. 1 2 1 2 3 3 4 4 Router Worker

    1 Worker 2 Worker 3 Limit concurrent access to a resource
  10. Worker 1 Producer Work to be done Send work Worker

    2 Work to be done Send work Work Done Work Done
  11. Node A 433 Node B 24345 Node C 82327 Hash:

    989123 Node E 943772 Grain Id: Roger Names: Roger Actors: Roger : User
  12. Node A 433 Node B 24345 Node C 82327 Hash:

    989123 Node E 943772 Node F 987234 Grain Id: Roger Names: Roger Actors: Roger : User