THE ACTOR
MODEL
WHO?
Mike Nash
- VP Capabilities
- BoldRadius Solutions
THE ACTOR MODEL
A model of computation
An architectural approach
Implementations
DR. CARL HEWITT
▸ Designed the Planner language
▸ "pattern-directed invokation from
assertions and goals"
▸ used in robotics and AI
▸ The Actor Model
▸ Work spans 30 years
▸ Initial paper in 1973 with Peter Bishop and
Richard Steiger
▸ In collaboration with MITs AI Lab
DR. CARL HEWITT
▸ Languages
▸ Scheme
▸ ACT-1
▸ SALSA
▸ Caltrop
▸ ActorScript
THE ACTOR MODEL
A mathematical model of concurrent computation where...
▸ actors are the universal primitive of computation
▸ An actor
▸ receives messages and acts on them
▸ sends messages
THE ACTOR MODEL
Inspired by physics, general relativity and
quantum mechanics
Actor model theory explores theoretical topics in
the actor model
No shared state between actors
Actors encapsulate state
RECEIVES MESSAGES
▸ Only way to interact with an actor is to send it
a message
▸ Messages should be immutable
▸ All computation is in response to a message
▸ An actor is potential energy, a message turns
it into kinetic energy
SENDS MESSAGES
An actor can send messages to other actors
This is its only way to communicate
Messages are processed sequentially, concurrent
to the sender
CREATES CHILD ACTORS
Actors create other actors to handle sub-tasks
Parent communicates with them via messages as
usual
CHANGES BEHAVIOR
An actor can change its behavior for subsequent
messages
This provides the basis for a finite state machine
IMPLEMENTIONS
HARDWARE
Caltech Cosmic Cube
- 1981
- 64 Intel 8086/87 processors
- 6-dimensional hypercube network
HARDWARE
J-Machine
- 1988
- MIT VLSI Architecture group
- Designed for concurrent smalltalk and the
actor model
SOFTWARE
▸ Erlang
▸ Elixir
▸ Ada Tasks
▸ Pony
▸ Common Lisp Actors
▸ Akka
AKKA
A practical application of the Actor Model on the
JVM
Large ecosystem of related libraries
AKKA CORE
Actors within a single JVM
Written in Scala
Interoperable from Java, Clojure, Groovy
Use any JVM library
Supports pub/sub as well as point-to-point
TESTKIT
▸ Allows asynchronous actors to be tested
synchronously
▸ Allows mock actors to be used as test probes
▸ Allows internal actor methods to be tested
▸ Allows asynchronous actors to be tested
together
AGENTS
▸ Encapsulate a single value
▸ Conflict free reads
▸ Queued writes
▸ Writes expressed as a function
(_ + 1)
AKKA REMOTING
▸ Actors in different JVMs can exchange
messages
▸ Pluggable serialization
▸ Pluggable transport
AKKA CLUSTER
▸ Builds on remoting
▸ Avoid fixed addressing
▸ Handles cluster membership
▸ Cluster-aware routers
▸ Cluster singletons
▸ Auto fail-over
▸ Cluster events available
AKKA CLUSTER SHARDING
▸ Builds on cluster
▸ Node affinity for messages
▸ No single point of failure
▸ Supports distributed domain
AKKA DATA REPLICATION
▸ Supports automatic replication of data in a cluster
▸ Data must be represented with conflict-free replicated types
▸ Eventually consistent with short lag
AKKA HTTP
▸ Expose actors to the web
▸ Client and server
▸ Routing
▸ Requests and responses as messages
▸ Includes HTTP TestKit
AKKA STREAMS
▸ Solves the back-pressure problem
▸ DSL to define flows
▸ Sources and Sinks
▸ Akka HTTP builds on this
AKKA CONTRIB
▸ Community contributions to Akka
▸ Reliable proxy
▸ Message throttling
▸ Aggregators
▸ Receive pipeline
AKKA TYPED
▸ Next major version
▸ Actors support types
▸ Both messages and behaviors
▸ Under active development
CONCLUSION
The Actor model predates Akka
Akka provides the actor model on the JVM
Akka optionally provides remoting, clustering and much more

Introduction to the Actor Model

  • 1.
  • 2.
    WHO? Mike Nash - VPCapabilities - BoldRadius Solutions
  • 3.
    THE ACTOR MODEL Amodel of computation An architectural approach Implementations
  • 4.
    DR. CARL HEWITT ▸Designed the Planner language ▸ "pattern-directed invokation from assertions and goals" ▸ used in robotics and AI ▸ The Actor Model ▸ Work spans 30 years ▸ Initial paper in 1973 with Peter Bishop and Richard Steiger ▸ In collaboration with MITs AI Lab
  • 5.
    DR. CARL HEWITT ▸Languages ▸ Scheme ▸ ACT-1 ▸ SALSA ▸ Caltrop ▸ ActorScript
  • 6.
    THE ACTOR MODEL Amathematical model of concurrent computation where... ▸ actors are the universal primitive of computation ▸ An actor ▸ receives messages and acts on them ▸ sends messages
  • 7.
    THE ACTOR MODEL Inspiredby physics, general relativity and quantum mechanics Actor model theory explores theoretical topics in the actor model No shared state between actors Actors encapsulate state
  • 8.
    RECEIVES MESSAGES ▸ Onlyway to interact with an actor is to send it a message ▸ Messages should be immutable ▸ All computation is in response to a message ▸ An actor is potential energy, a message turns it into kinetic energy
  • 9.
    SENDS MESSAGES An actorcan send messages to other actors This is its only way to communicate Messages are processed sequentially, concurrent to the sender
  • 10.
    CREATES CHILD ACTORS Actorscreate other actors to handle sub-tasks Parent communicates with them via messages as usual
  • 11.
    CHANGES BEHAVIOR An actorcan change its behavior for subsequent messages This provides the basis for a finite state machine
  • 12.
  • 13.
    HARDWARE Caltech Cosmic Cube -1981 - 64 Intel 8086/87 processors - 6-dimensional hypercube network
  • 14.
    HARDWARE J-Machine - 1988 - MITVLSI Architecture group - Designed for concurrent smalltalk and the actor model
  • 15.
    SOFTWARE ▸ Erlang ▸ Elixir ▸Ada Tasks ▸ Pony ▸ Common Lisp Actors ▸ Akka
  • 16.
    AKKA A practical applicationof the Actor Model on the JVM Large ecosystem of related libraries
  • 17.
    AKKA CORE Actors withina single JVM Written in Scala Interoperable from Java, Clojure, Groovy Use any JVM library Supports pub/sub as well as point-to-point
  • 18.
    TESTKIT ▸ Allows asynchronousactors to be tested synchronously ▸ Allows mock actors to be used as test probes ▸ Allows internal actor methods to be tested ▸ Allows asynchronous actors to be tested together
  • 19.
    AGENTS ▸ Encapsulate asingle value ▸ Conflict free reads ▸ Queued writes ▸ Writes expressed as a function (_ + 1)
  • 20.
    AKKA REMOTING ▸ Actorsin different JVMs can exchange messages ▸ Pluggable serialization ▸ Pluggable transport
  • 21.
    AKKA CLUSTER ▸ Buildson remoting ▸ Avoid fixed addressing ▸ Handles cluster membership ▸ Cluster-aware routers ▸ Cluster singletons ▸ Auto fail-over ▸ Cluster events available
  • 22.
    AKKA CLUSTER SHARDING ▸Builds on cluster ▸ Node affinity for messages ▸ No single point of failure ▸ Supports distributed domain
  • 23.
    AKKA DATA REPLICATION ▸Supports automatic replication of data in a cluster ▸ Data must be represented with conflict-free replicated types ▸ Eventually consistent with short lag
  • 24.
    AKKA HTTP ▸ Exposeactors to the web ▸ Client and server ▸ Routing ▸ Requests and responses as messages ▸ Includes HTTP TestKit
  • 25.
    AKKA STREAMS ▸ Solvesthe back-pressure problem ▸ DSL to define flows ▸ Sources and Sinks ▸ Akka HTTP builds on this
  • 26.
    AKKA CONTRIB ▸ Communitycontributions to Akka ▸ Reliable proxy ▸ Message throttling ▸ Aggregators ▸ Receive pipeline
  • 27.
    AKKA TYPED ▸ Nextmajor version ▸ Actors support types ▸ Both messages and behaviors ▸ Under active development
  • 28.
    CONCLUSION The Actor modelpredates Akka Akka provides the actor model on the JVM Akka optionally provides remoting, clustering and much more