O'Reilly logo

Applied Akka Patterns by Wade Waldron, Michael Nash

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Good Data Flow

In Chapter 4, you saw some of the ways that you can implement individual actors and some of the pitfalls you can encounter when doing so. Now you need to consider how you can use those actors to build up systems. A single actor alone isn’t much help to us. It’s only by combining them that we unlock the real potential of Akka. In this chapter, we take a look at some patterns to follow when using multiple actors. We also introduce the concept of Akka Streams, which provides a domain-specific language for streaming messages.

Throughput Versus Latency

Before we go too far discussing how to combine actors effectively, let’s digress briefly to talk about throughput versus latency.

When we measure our code to determine its performance characteristics, often we are measuring how long a particular action takes. We measure from the moment that action is initiated, to the moment it completes. It might take 10 milliseconds or perhaps 10 seconds. In either case, we call this latency.

Sometimes, instead of measuring how long a particular action takes, we will instead measure how many actions can occur in a specific amount of time. Here we aren’t concerned with how long each individual action takes, just how many of them we can complete within a fixed amount of time. For example, we might measure how many actions we can perform in 10 seconds. In this case, we are measuring throughput.

Whether you measure latency or throughput, you always need to look at the values ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required