Chapter 14. Clustering

 

In this chapter

  • Dynamically scaling actors in a cluster
  • Sending messages into the cluster with cluster-aware routers
  • Building a clustered Akka app

In chapter 6 you learned how to build a distributed application with a fixed number of nodes. The approach we took, using static membership, is simple but provides no out-of-the-box support for load balancing or failover. A cluster makes it possible to dynamically grow and shrink the number of nodes used by a distributed application, and removes the fear of a single point of failure.

Many distributed applications run in environments that aren’t completely under your control, like cloud computing platforms or data centers located across the world. The larger the cluster, the greater the chance of failure. Despite this, there are complete means of monitoring and controlling the lifecycle of the cluster. In the first section of this chapter, we’ll look at how a node becomes a member of the cluster, how you can listen to membership events, and how you can detect that nodes have crashed in the cluster.

First we’ll build a clustered app that counts the number of occurrences of each word in a piece of text. Within the context of this example, you’ll learn how routers can be used to communicate with actors in the cluster, how you can build a resilient, coordinated process consisting of many actors in the cluster, and how to test a clustered actor system.

14.1. Why use clustering?

14.2. Cluster membership

14.3. Clustered job processing

14.4. Summary

sitemap