Reputation: 5962
BalancingDispatcher is now deprecated for assigning actors to directly but BalancingPool for routers uses BalancingDispatcher.
As we don't configure the BalancingDispatcher directly, I'd like to know if the BalancingDispatcher is configured with threads equal to number of workers?
If we're producing the BalancingPool in code instead of config, does this still work the same way?
Thanks in advance for any help/info! May be better suited question to ask in the Akka mailing group. Or I should just read the source.
Upvotes: 1
Views: 385
Reputation: 13130
The BalancingPool
does indeed set up the balancing dispatcher for you for the routees. The number of threads and the executor used can be configured by providing the pool-dispatcher
setting. By default it uses a fork join executor, so you can give it the following settings:
pool-dispatcher {
fork-join-executor { # force it to allocate exactly 5 threads
parallelism-min = 5
parallelism-max = 5
}
# executor = "thread-pool-executor" // can even change the executor here
#thread-pool-executor {
# core-pool-size-min = 1
# core-pool-size-factor = 2.0
# core-pool-size-max = 5
#}
}
if you'd like it to use exactly 5 threads. You can refer to the dispatcher docs to understand how to configure dispatchers and what executors are.
PS: In general Akka questions are usually best served on the akka-user mailing list, where the team monitors and helps out on all threads, however there's also an active SO community so "it depends" :-)
Upvotes: 1