Building Stateful Clustered Microservices with Java, Actors, and Kubernetes

by | Oct 26, 2019 | Voxxed Days Cluj-Napoca 2019

Hugh McKee is a developer advocate at Lightbend. He has had a long career building applications that evolved slowly, that inefficiently utilized their infrastructure, and were brittle and prone to failure. Hugh has learned from his past mistakes, battle scars, and a few wins. And the learning never stops. Now his focus is on helping other developers and architects build resilient, scalable, reactive, distributed systems. Hugh frequently speaks at conferences. He is the author of Designing Reactive Systems: The Role Of Actors In Distributed Architecture.

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.