Distributing State in Akka.Cluster Applications

Consistent Hash Distributions and Clustered Routers

One of the most frequently asked questions about Akka.Cluster I receive is “how do I reliably distribute state in an Akka.NET Cluster?”

Akka.Cluster is primarily for building highly available, soft real-time applications in server-side environments - and one of the concepts that is essential to delivering “soft real-time” is statefulness.

Stateful applications are becoming more and more common because they execute types of work that are infeasible and impractical with stateless CRUD applications, but they also introduce new types of challenges such as:

  • How do I evenly distribute state across my cluster? No “hotspots.”
  • How do I find the state I need within my cluster?
  • What happens to my state if a stateful node goes down?
  • How do I guarantee that my state is modified safely? Consistent histories for state, in other words.

We can address, at a high level, all of these questions using a tool built into Akka.Cluster: consistent hash routers and Cluster.Sharding.

As of a few moments ago, we released Akka.NET 1.1 - the biggest feature release we’ve done for Akka.NET since releasing 1.0 last year! We have other major Akka.NET feature releases planned for later this year, but this is the first and one of the most long-awaited ones.

Akka.Cluster is released from beta

The biggest change in this release is the first stable release of Akka.Cluster, which has been in various beta stages since August 2014. During that time it’s been used as a beta package by hundreds of users who have given the Akka.NET project large amounts of bug reports and feedback.

Since that time we’ve covered Akka.Cluster in a huge range of multi-node tests, designed to ensure the cluster behaves correctly under a variety of network conditions (including some rather hostile ones) and it’s performed well.

We’ve also replaced the underlying Helios 1.4.1 transport with a brand new Helios 2.1.1 transport, which delivers up to 5x the throughput with a tremendously lower memory footprint than the previous versions.

Release of the Multi-node TestKit, Multi-node Test Runner

One tool that has proven utterly indispensable in the development of Akka.Cluster, Akka.Remote, Akka.Cluster.Tools, and Akka.Cluster.Sharding is the Akka.Remote.TestKit package - commonly referred to as the “multi-node testkit.”

This library is an extension of the Akka.TestKit that developers use for unit testing simple actors, and it offers capabilities designed for facilitating distributed unit tests for Akka.NET ActorSystems that are using Akka.Remote, Akka.Cluster, or any of the other high availability (HA) modules.

The Akka.Remote.TestKit is designed to allow you to do the to following:

  1. Run a unit test across multiple processes simultaneously, simulating how servers or virtual machines would behave in the real-world;
  2. Offers a dead-simple Domain Specific Language (DSL) that allows you to describe...

It’s been a while since we’ve published an official roadmap update for Akka.NET. We are still on track to achieve the goals of the previous roadmap, but with a few minor changes that I will explain here.

Akka.NET 1.1 - Akka.Cluster Release to Market; Akka.Streams Beta

We’ve publicly committed to releasing Akka.NET 1.1 on June 14th, 2016:

This release has the following goals:

  1. Officially releasing Akka.Cluster to market, signifying “it is ready for full-blown production use;”
  2. Deploy Helios 2.0 transport to production, which is significantly faster, more memory efficient, and more reliable than the current Helios 1.4.1-based transport;
  3. Releasing the MultinodeTestRunner and the Akka.Remote.TestKit, used for testing distributed systems built with Akka.NET; and
  4. Releasing the very first beta of the new Akka.Streams module, which you can read more about here.

Akka.Cluster has been available as a beta package for nearly two years and has had thousands of users. It is currently serving production workloads both on Linux and on Windows for a variety of different types of customers. During this period we have collected lots of bug reports, feedback, and data that has been used to help improve its reliability and performance.

This will be a tremendous opportunity for Akka.NET users to build high availability systems of all shapes and sizes on any cloud they wish.

Akka.NET 1.5 - TLS, New Serializer, Faster Transports

The next major release we have planned following Akka.NET 1.1 is Akka.NET 1.5. This release will introduce some breaking changes at the dependency level.

We are making the following two important changes: