Why I Love Akka: Video With Hugh McKee
Take a moment to watch Hugh McKee, Developer Advocate, speaker, and O'Reilly author, describe how Akka makes his life easier, and why Akka is a great match for cloud native applications. Note: some edits have been made to transcript below to improve flow and readability.
"There was so much joy for me when I wrapped my head around doing things with Akka and actor systems. It was so much fun to build systems that never failed, where we focused on building new features that considered failure as an architectural feature of the entire system."
How does Akka make your life easier?
"Akka is fundamentally different from the ways that you build systems using traditional, imperative, or even asynchronous reactive programming models. The concept of actors in Akka is really interesting, representing this fundamental building block that you can use to assemble systems. I've used the analogy of having a simple LEGO block that you can use to build things. People can build these incredible structures using LEGO blocks, and it's the same thing with actors. The other thing I like is there's some simple behavioral characteristic of actors that are different–some people say it's hard–and I think, people initially think it's hard because it is different. The difference is where the fun starts, because once you start to wrap your head around how you can take different actors that are working together to solve a problem, to me it was like, "Wow."
When I first started understanding the concept of actors and started building systems with actors, it was like, "Wow, we just solved this problem that I thought would be really hard to solve, and I know it would have been really hard to solve using traditional programming techniques, and here it was easy."
I'm talking about things like concurrency, things that would have been very complicated with say, thread-based programming, were trivial with actors. In addition, you can do things when you're not constrained to a single JVM, for example having actors collaborate with each other in a clustered, distributed environment. I was just in heaven–it was so much fun to build systems with actors and solve problems that I thought would have been so hard to do. When we came up with solutions, it was like, "Oh my God, this is such a cool solution. I can't believe what we're doing here." And that's the fun part.
Again, there is this transition into actors and clusters that you have to make, but as developers and architects we have to wrap our heads around new technologies all the time. There was so much joy for me when I wrapped my head around doing things with actor systems. It was so much fun to build systems that never failed, constantly creating a new system where we were thinking about failure as an architectural feature. To be able to build systems where you're going, "Yep, when this fails, this is what we're going to do, and this is how our actors that we're coding are going to behave." Then, to see that the solutions actually worked was just absolutely incredible. So to me Akka is the best thing I've ever seen, and I've been doing software development for a very long time. The actor model and building systems with actors is honestly the coolest thing I've ever seen."
Why is Akka the ideal match for cloud native applications?
With cloud-native applications, the challenge is that you're running in a distributed environment. There's a lot of people that still think of this new paradigm the same as before–building a single codebase, a single program, a single monolith, where the reality is that we're running in a distributed environment.
This is where Akka really shines. Akka is 10 years old now, and for a good portion of those 10 years, the engineers and the contributors that have been creating Akka have been hardening and building and adding features to all these actor systems running in a distributed environment. There are incredible patterns and ways that you can build a system that runs in a cloud-native distributed environment using Akka–it's built to have actors that are running not in a single JVM, but in multiple JVMs in collaboration over the network. The abstraction layer that Akka provides really lifts us up into a realm where we onlky need to care about how individual actors interact with each other in this distributed environment.
When people first hear about at-most-once delivery of messages with Akka, it can give some concern because you think, "Well, wait a minute, I want messages that are always delivered, or delivered exactly once." This is difficult to do in a distributed environment, and these are hard lessons that developers have to learn. There are three patterns of messaging in a distributed environment, and the least powerful one is at-most-once delivery. With Akka, this is no longer a problem and you can build systems that can handle this in a distributed, cloud-native environment.
Akka also gives you the fine-grained control. Again, when people first do distributed systems and distributed messaging, they're looking at a coarse-grained level. Microservices, for example, are coarse-grained compared to actors, which are very, very fine-grained, lightweight things. Actor systems running in a distributed environment often have tens of thousands to even millions of running actor instances, all communicating with each other happily in a distributed environment. I've been showing people a visualization of actors and how they react to nodes leaving and joining an Akka Cluster, including JVMs shutting down and starting up, and how Akka actors react to that. It's just incredible how the technology works in a cloud-native environment."
Inspired by what Hugh has to say about Akka? Why not sit down with us to see Akka in action? We'll demo what Akka looks like in production as part of a subscription to Lightbend Platform, including observability, telemetry, and system health monitoring as well as Akka resilience and persistence enhancements.