How to configure and tune Akka Dispatchers

心已入冬 提交于 2019-12-02 21:03:15

This configuration depends on your hardware of course.

Say you have 2 available processors on your machine, then you can configure the number of threads that a given dispatcher will have via the parallelism-factor.

current number of thread = available processor * parallelism-factor

Then you can fix boundaries to control the result of this multiplication and avoid extreme values.

parallelism-min < current number of thread < parallelism-max

Now if you want to pick the right parallelism-factor + boundaries, you have to ask yourself how many actors at a given time your dispatcher will be responsible for.

It seems logical to assume that more actors means more threads but I strongly encourage you to monitor your system to find the root cause of your performance issues and not just randomly tweaking the configuration.

As a side note you should check the "throughput" parameter of your dispatcher as it allows you to configure the fairness of the actor's thread allocation. This can really make a big difference in case of batching-like process.

# Throughput defines the maximum number of messages to be
  # processed per actor before the thread jumps to the next actor.
  # Set to 1 for as fair as possible.
  throughput = 100 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!