An Akka and a Kubernetes expert walk into a bar. They order drinks and try to figure out what is better for building distributed applications. Does Akka Cluster have a place in the age of Kubernetes? Does Kubernetes bring any value to those who are building applications using Akka? Akka Cluster is a mature choice to achieve full elasticity for your distributed JVM services. The Kubernetes orchestrator offers a growing set of features - think resilience or custom scaling metrics - that ultimately overlap with Akka's. This talk explores integration patterns between the two. Friends or foes?
4. @ticofab
@adamsand0rQuestions we try to answer
1. Can Kubernetes make an application reactive?
2. If so, what value does Akka Cluster provide on top of Kubernetes?
3. Is Akka Cluster suitable for a microservice architecture?
4. How can Akka Cluster and Kubernetes work together?
8. The key to Distribution is Location Transparency
MESSAGE DRIVEN
=
LOCATION TRANSPARENCY
9. @ticofab
@adamsand0r
Fault Tolerance Resilience
“The component is being hit
but keeps going, possibly
with reduced functionality”
“Upon failure, a component
is able to jump back to a
fully functional fresh state”
What is Resilience?
12. @ticofab
@adamsand0rHow does Akka help us achieve elasticity?
T1000
Actor
“John”
“John”
target?
• contains its own state
• can only communicate
via async messaging
t1000.getTarget()
Single JVMJVM 1
JVM 2
• unit of computation
Akka’s building
blocks are Actors
target:
Sarah
Actor
• contains behaviour
14. @ticofab
@adamsand0rHow does Akka help us achieve resilience?
Supervisor Actor
Actor
Every actor:
is created by a supervisor,
to whom failure handling is
delegated
USING A COMPONENT
≠
HANDLING ITS FAILURES
15. @ticofab
@adamsand0rHow does Akka help us achieve resilience?
Skynet
actor
T1000
actor
TooManyHolesException
X
Fresh
restart
try {
walk();
} catch (OutOfLegsException e) {
}
legsAvailable = false;
pullWithArms();
T800
instance
walk();
18. @ticofab
@adamsand0rK8s creates nodes and helps form cluster
JVM JVM
pod-1 pod-2 pod-3 pod-4
vm-1 vm-2
Actor Actor ActorActor Actor ActorActors
JVM
Akka Cluster node
Pods
VM
Kubernetes node
JVMJVM
19. @ticofab
@adamsand0rLots of cloud providers
Google Kubernetes Engine
GKE
Azure Kubernetes Service
AKS
Elastic Container
Service for Kubernetes
EKS
( )
28. @ticofab
@adamsand0rEngine requirements
🔄 Allow a FAST bi-directional channel between paired devices
👥 Manage many devices concurrently
📱 Hold state for each device (location, matched devices..)
21
30. @ticofab
@adamsand0rActor-based architecture (single node)
WS
Listener
Phone
Manager
1
Phone 1
Phone 2
Phone 3
2
3
match 3 match 1
New phone
connected!
New phone
connected!
Do you match
with phone 2 ?
Do you match
with phone 3 ? Do you match
with phone 3 ?
New phone
connected!
You matched
with me!
48. @ticofab
@adamsand0rConclusions
Kubernetes is a great
infrastructure choice for your
clustered application
⚙
It provides location
transparency with cluster
formation
🖇
It introduces resilience at
an infrastructure level
+
Akka has a great
programming model, ready
to scale up from day 1
📬
Akka Cluster enables direct
communication between
stateful services
📟
And resilience is
built in your service
.
50. @ticofab
@adamsand0rReferences
Jonas Bonér: Reactive Microservices Architecture (O'Reilly)
Sam Newman: Building Microservices (O’Reilly)
Jamie Allen, “Reactive is a Product”, React Sphere 2018
Akka docs (https://goo.gl/MJ1o41)
iHeart blog post (https://goo.gl/h2eN7X)
Wade Waldron, Cognitive Class, Introduction to Reactive Systems
53. • Watch the video and see where we can shorten (50 min is too long)
• Add a couple of cases where Akka Cluster can be superseded by K8S
(like if you need distributed working with stateless services).
• See if we can have an equal amount of speaking time and maybe
rebalance
• Add more jokes
• Microservices architecture from Neal Ford slides
• Add 3d-thing “cluster on top of cluster”
• Remove the solar system
• Remove one of the CloudMatch videos
•