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

Build Reliable Systems with Virtual Actors

Build Reliable Systems with Virtual Actors

Actor model is a computational model specifically suited for building distributed, high-performance, fault tolerant systems. However, the popular actor model platforms still leave many distributed system problems to the developers.

Virtual Actors is an abstraction over actor model which helps developers deal with reliability and distributed resource management at the same time retaining the best traits of actor model.

Orleans was the first framework which implements runtime for virtual actors. In this talk I’ll explain what are virtual actors and show you how to use them to build reliable, distributed applications.

Avatar for Sebastian Belczyk

Sebastian Belczyk

September 15, 2016

Other Decks in Programming

Transcript

  1. @sbelczyk 5 Objects vs Actors OO by Alan Key: Everything

    is an object Objects have their own memory Objects communicate by sending and receiving messages Every object is an instance of a class Actor model by Carl Hewitt: Everything is an actor Actors have their own memory Actor communicate by asynchronously sending and receiving messages Actors respond to messages by: • Sending a finite number of messages • Creating a finite number of actors • Changing behavior Actors process only one message at the time Actor Thinking, Dale Schumacher, QCon SF 2011 [http://bit.ly/1NtV3ta]
  2. Communication Asynchronous via message passing Each actor has an address

    When you create an actor you obtain its address Address can be passed in a message Retrieved from commonly accessible store Addresses are globally unique @sbelczyk 6
  3. Challenges of the classic actor platforms Managing actor lifecycle Handling

    failures and recovery of actors Managing placement of actors (distributed resources management) @sbelczyk 10
  4. Virtual Actors First priority – simplify distributed computing Second priority

    – empower experienced users By default make decision which makes sense for most of the cases and allow fine tuning for edge cases @sbelczyk 11 Orleans and Akka Actors: A Comparison [http://bit.ly/25KAuzC]
  5. Send the first message to an actor Send the second

    message to the actor Actor not used for a defined time @sbelczyk 14 Instantiate Deliver the message Doesn’t exist In memory Deliver the message In memory Persist state In memory Persisted
  6. Send a message to an inactive actor Send a message

    to an actor which crashed when processing last message @sbelczyk 15 Read sate In memory Persisted Deliver the message Read sate Instantiate Doesn’t exist Persisted Deliver the message
  7. @sbelczyk 16 Developer Runtime • Domain modeling • Defining actors

    • Defining and managing internal state of actors • Managing interactions between actors • Manage actors lifecycle • Manage actors placement • Manage hardware and software failures
  8. Team @sbelczyk 17 Awesome developers who are not afraid of

    any domain (with the exception of holy domain of cargo shipping) Distributed systems ninja aka distributed hydra dragon slayer
  9. ActOp @sbelczyk 18 Optimizing Distributed Actor Systems for Dynamic Interactive

    Services by Andrew Newell, Gabriel Kliot, Ishai Menache, Aditya Gopalan, Soramichi Akiyama, Mark Silberstein; EuroSys ’16, April 18-21, 2016, London, United Kingdom
  10. Optimizing Halo 4 Presence Service ActOp – optimized placement strategy

    • Automatically detects frequently communicating actors and migrates them to the same server transparently to running application • Based on: “scalable distributed graph partitioning algorithm which does not rely on a single server to store the whole communication graph, thereby enabling efficient actor placement even for applications with rapidly changing graphs” @sbelczyk 19
  11. Orleans Extends functionality of traditional actor systems like Akka and

    Erlang/OTP Creates actors on demand and manages its lifecycle Automatically handles software and hardware failures by instantiating the failed actor upon the next call to it Actor location is hidden from application so runtime can migrate actors across network while application is running Automatic scaleout for stateless actors (so called reentrant grains in Orleans) @sbelczyk 20
  12. Programming model and runtime assumptions Request - repsonse communication by

    default Automatic actor placement and balancing Timeouts for all messages Ensures actor isolation by copying all messages Code generators for emitting the serialization and deserialization code for all actors invocations @sbelczyk 21
  13. Performance @sbelczyk 22 Orleans: Distributed Virtual Actors for Programmability and

    Scalability, Philip A. Bernstein, Sergey Bykov, Alan Geller, Gabriel Kliot, Jorgen Thelin; Microsoft Research [http://bit.ly/2ca5tTV]
  14. Performance @sbelczyk 23 Orleans: Distributed Virtual Actors for Programmability and

    Scalability, Philip A. Bernstein, Sergey Bykov, Alan Geller, Gabriel Kliot, Jorgen Thelin; Microsoft Research [http://bit.ly/2ca5tTV]
  15. The full story It’s built to be available and partition

    tolerant (AP) [see] Messaging Delivery Guarantees • Messages by default have timeouts • At-most-once by default [see] • At-least-once if you decide to use retries [see] Orleans doesn’t allow code hotswapping Doesn’t support transactions (Akka supports transactions between actors on the same node) @sbelczyk 24
  16. Carl Hewitt about orleans „Orleans is an important step in

    furthering a goal of the Actor Model that application programmers need not be so concerned with low-level system detailsi.” ie.g. threads, throttling, load distribution, cores, persistence, automated storage reclamation, locks, location transparency, channels, ports, etc @sbelczyk 25 Actor Model of Computation: Scalable Robust Information Systems, Carl Hewitt [http://bit.ly/2cqGI3V]
  17. Resources Orleans: Distributed Virtual Actors for Programmability and Scalability http://bit.ly/2ca5tTV

    Optimizing Distributed Actor Systems for Dynamic Interactive Services http://bit.ly/2cmNIN1 Orbit (virtual actors framework for JVM) https://github.com/orbit/orbit Actor Thinking, QCon SF 2011 http://bit.ly/1NtV3ta Orleans and Akka Actors: A Comparison http://bit.ly/25KAuzC Actor Model of Computation: Scalable Robust Information Systems http://bit.ly/2cqGI3V @sbelczyk 27