When building microservices or web apps, we often take the path of least resistance and go with a stateless approach. The justification is that going the stateful route is too hard and too complicated. Based on the state of the tools that we typically use to build apps, going stateless is a wise decision given that the commonly used backend toolsets and frameworks tend to shy away from dealing with distributed, clustered systems.
However, with the spectacular rise of Kubernetes, many developers are diving head first into the clustered world. This mass migration to the clustered, scalable, and resilient Kubernetes playing field opens up new opportunities for how we build systems. One of the new ways of doing things is the actor model. In the pre-Kubernetes world, everything is an object; in the post-Kubernetes world, everything is an actor. Actors are fundamental building blocks, like objects, that are stateful, are inherently concurrent, and with the Akka Toolkit, systems of actors naturally exist and collaborate in clustered environments.
In this talk, we will explore some theory and code of a live actor system based microservice running in a clustered Kubernetes environment.
5. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
6. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
7. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
8. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
9. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
10. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
11. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
12. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
13. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
14. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
15. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
16. The actor model in computer science is a mathematical model of
concurrent computation that treats "actors" as the universal primitives
of concurrent computation. In response to a message that it receives,
an actor can: make local decisions, create more actors, send more
messages, and determine how to respond to the next message
received. Actors may modify their own private state, but can only affect
each other through messages (avoiding the need for any locks).
Wikipedia
17. Kubernetes (K8s) is an open-source system for
automating deployment, scaling, and management
of containerized applications.
18. Kubernetes (K8s) is an open-source system for
automating deployment, scaling, and management
of containerized applications.
elastic
resilient
26. The enabler of these characteristics is a Cloud-Ready Message Driven Model.
Lightbend codified these principles into the Reactive Manifesto in 2013; 24,000+ signatories around the world so far.
Responsive Resilient Elastic
React to
Users
React to
Failures
React to
Load Variance
Low latency / High
performance
Real-time / NRT
Graceful, Non-catastrophic
Recovery
Self-Healing
Responsive in the face of
changing loads
Reactive Systems
27. The enabler of these characteristics is a Cloud-Ready Message Driven Model.
Lightbend codified these principles into the Reactive Manifesto in 2013; 24,000+ signatories around the world so far.
Responsive Resilient Elastic
React to
Users
React to
Failures
React to
Load Variance
Low latency / High
performance
Real-time / NRT
Graceful, Non-catastrophic
Recovery
Self-Healing
Responsive in the face of
changing loads
Reactive Systems
53. Akka Reactive Systems and Kubernetes
Responsive Resilient Elastic
React to
Users
React to
Failures
React to
Load Variance
Low latency / High
performance
Real-time / NRT
Graceful, Non-catastrophic
Recovery
Self-Healing
Responsive in the face of
changing loads
a beautiful relationship