How to configure and tune Akka Dispatchers

前端 未结 1 717
深忆病人
深忆病人 2021-02-02 01:24

I\'m looking over the documentation here: http://doc.akka.io/docs/akka/2.3.3/java/dispatchers.html

We\'re using Akka in such a way where we have two separate dispatchers

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-02 01:44

    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 
    

    0 讨论(0)
提交回复
热议问题