3. THE ACTOR MODEL
A model 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
A mathematical 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
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
8. 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
9. 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
10. CREATES CHILD ACTORS
Actors create other actors to handle sub-tasks
Parent communicates with them via messages as
usual
11. CHANGES BEHAVIOR
An actor can change its behavior for subsequent
messages
This provides the basis for a finite state machine
17. 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
18. 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
19. AGENTS
▸ Encapsulate a single value
▸ Conflict free reads
▸ Queued writes
▸ Writes expressed as a function
(_ + 1)
20. AKKA REMOTING
▸ Actors in different JVMs can exchange
messages
▸ Pluggable serialization
▸ Pluggable transport
21. AKKA CLUSTER
▸ Builds on 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
▸ Expose actors to the web
▸ Client and server
▸ Routing
▸ Requests and responses as messages
▸ Includes HTTP TestKit
25. AKKA STREAMS
▸ Solves the back-pressure problem
▸ DSL to define flows
▸ Sources and Sinks
▸ Akka HTTP builds on this
26. AKKA CONTRIB
▸ Community contributions to Akka
▸ Reliable proxy
▸ Message throttling
▸ Aggregators
▸ Receive pipeline
27. AKKA TYPED
▸ Next major version
▸ Actors support types
▸ Both messages and behaviors
▸ Under active development
28. CONCLUSION
The Actor model predates Akka
Akka provides the actor model on the JVM
Akka optionally provides remoting, clustering and much more