The Akka team at Lightbend and overall Akka community are delighted to announce the immediate availability of Akka 2.6. As Akka is at the core of Lightbend Platform, this Q/A post covers six questions that Java and Scala architects and developers should read to get an idea of what major features went into the release, which optimizations and bug fixes were added, and what other Lightbend technologies benefit from the features in Akka 2.6. As always, you can get started with the latest version on the Akka website here: https://akka.io/docs/
There are many things to include, and the top 3 highlights we chose are:
We have to say that this is Akka Typed, the new version of Akka Actors, so to speak.
In Akka, messages are sent via a location transparent handle to the actor, called an ActorRef. It’s this ActorRef in Akka Typed that has a message type parameter, as well as the corresponding type in the behavior of the actor. This means that, unlike in the past, you can now only send messages that are part of that actor’s defined message protocol, and the compiler will help with catching mistakes early. The message protocol becomes very explicit and can also describe interactions by passing typed ActorRefs in the messages, for example describing what response message you can expect. In the end it gives all the benefits that we are used to from strongly typed programs. To see how this looks like in code you can find a Hello World example in the documentation.
While introducing these new APIs, we took the opportunity to rework and improve the usability experience of all main modules, such Akka Persistence and Cluster Sharding. The goal was to make them more guided for the most common usage without limiting the flexibility to go beyond that.
Ultimately, this makes the Akka Typed APIs more approachable, more guided, and provides a better experience by, for example, catching mistakes early when writing the program. This goes further in helping teams try to understand what the system does later on; namely, understanding interactions between actors. This is especially helpful when revisiting old code, investigating a bug, or when trying to navigate and understand code written by someone else. Notably, refactoring in a safe way also becomes much easier.
To get started with Akka Typed we recommend the quickstart guides.
API design is always challenging; naming is hard, as we know, but we also needed to consider different kinds of target users and many subjective opinions about moving forward. There have been many iterations to come up with the new APIs.
It’s a good time to mention that the classic APIs are still fully supported and existing applications can continue to use the classic APIs, but for new projects we recommend using the new Akka Typed API. It is currently not planned to deprecate or remove the classic API, and it’s also possible to use the new Actor APIs together with classic actors in the same ActorSystem. This means you can introduce Akka Typed for new functionality, or migrate at your own pace, and we hope you like the end result as much as we do :-)
Switching to Artery as transport for actor messaging is very nice to get off our backs. This is a major performance improvement and solves issues that have not been possible to fix in classic remoting. For example, Akka Cluster heartbeat messages and internal system messages are now sent over a different channel than application-level messages, which creates better isolation and stability.
In terms of isolation, Akka internal actors and tasks are now running on a separate dispatcher instead of sharing the default dispatcher with application-level actors. This should improve overall stability and reduce the risk of thread starvation problems. For example, Akka Cluster itself is implemented with actors and those should run undisturbed even if application-level actors are blocking all threads in the default thread pool.
This release influences several other Lightbend technologies:
With Akka 2.6 providing a new stable foundation for the Akka ecosystem as well at Lightbend Platform, the team plans to turn their attention to some of the other satellite projects. Next up are:
In the issue tracker over at GitHub we label issues that would be easy to get started contributing with “good first issue” or “help wanted”. Digging in to other issues in the tracker is of course welcome as well. Unless the task is very simple it can be good to discuss it a bit with the team in the issue or on the akka/dev gitter channel before digging in. We hope to see you there!
Want to see Akka in action? Schedule a demo to see what Akka Actors, Akka Cluster, Akka Streams, and more look like in production, featuring observability and metrics provided by Lightbend Console and Lightbend Telemetry.