Actor-based
Concurrency

with F# and Akka.NET

by Akim Boyko github / twitter

The adj. reactive has 2 senses

  • participating readily in reactions
  • tending to react to a stimulus

The Reactive Manifesto

  • Responsive
    The system responds in a timely manner if at all possible
  • Resilient
    The system stays responsive in the face of failure
  • Elastic
    The system stays responsive under varying workload

Alan Kay`s Definition Of Object Oriented

  1. Everything is an Object
  2. Objects communicate by sending and receiving messages
  3. Objects have their own memory
  4. Every object is an instance of a class
  5. The class holds the shared behavior for its instances

What is actor?

An actor is a computational entity that, in response to a message it receives, can concurrently:
  • send a finite number of messages to other actors;
  • create a finite number of new actors;
  • designate the behavior to be used for the next message it receives

Actor Encapsulation

  • No direct access is possible to the actor behavior
  • Only messages can be sent to known addresses

Actor-Internal Evaluation Order

  • An actor is single-threaded

Reliable Messaging

  • all messages can be persisted
  • can include unique correlation IDs
  • delivery can be retries until successful

The Actor Model is anthropomorphic

  • Individual failure is handled by the team leader (supervisor)
  • That is able to handle error and restart child if needed
  • Actors work together in teams (systems)

Strategies

  • OneForOneStrategy
  • AllForOneStrategy
  • others…

What`s a good use-case for Akka and Akka.NET?

  • Data collection and mining
  • General purpose numbers crunching
  • Real-time analysis and probabilistic programming
  • Active and reinforcement machine learning
  • Simulation: Master/Worker, Compute Grid, MapReduce, etc
  • Streaming/Reactive Streaming: bounded and unbounded
  • Gaming and Betting
  • stackoverflow.com: Good use case for Akka

Reactive in .NET landscape