Chapter 16. Performance tips
In this chapter
- Key parameters of performance in actor systems
- Eliminating bottlenecks to improve performance
- Optimizing CPU usage with dispatcher tuning
- Changing the use of thread pools
- Performance improvements by changing thread releasing
We’ve pretty much run the gamut of Akka’s actor functionality thus far in the book. We started with structuring your applications to use actors, how to deal with state and errors, and how to connect with external systems and deal with persistence. You’ve also seen how you can scale out using clusters. We’ve used the Akka actors like a black box: you send messages to the ActorRef, and your receive method implementation is called with the message. The fact that you don’t need to know the internals of Akka is one of its biggest strengths. But there are times when you need more control over the performance metrics of an actor system. In this chapter we’ll show how you can customize and configure Akka to improve the overall performance.
Performance tuning is hard to do, and it’s different for every application. This is because the performance requirements vary, and all the components in a system will affect each other in different ways. The general approach is to find out which part is slow, and why. Based on the answer to those questions, find a solution. In this chapter we’ll focus on improving performance by configuring the threading backend that actors run on.
Here’s how the chapter progresses: