MaatDeamon MaatDeamon - 1 month ago 6
Scala Question

Explaining Akka Thread Pool Executor Config Parameters

As I understood that the fork-join-executor is the default dispatcher when non is provided when creating the actor system
Can someone explain me the following:

fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
parallelism-min = 8

# The parallelism factor is used to determine thread pool size using the
# following formula: ceil(available processors * factor). Resulting size
# is then bounded by the parallelism-min and parallelism-max values.
parallelism-factor = 3.0

# Max number of threads to cap factor-based parallelism number to
parallelism-max = 64

# Setting to "FIFO" to use queue like peeking mode which "poll" or "LIFO" to use stack
# like peeking mode which "pop".
task-peeking-mode = "FIFO"

ALthough i understand each word, i don't understand the full semantic of what is explained here.

  • What does mean ceil ? in ceil(available processors * factor)

  • What means factor-based parallelism ?

Can someone overall explain to me in english what means the configuration above. By reading many post here and there, i had somewhat understood that by default, akka, would set up a threadPoolexecutor that allocate and thread per core. Hence if you have 2 two core processor, you would end up with 4 threads. Which is how much parallel you can really be anyway. Above that it is concurrent but not full strictly speaking parallel. Although that is another issue.

So if someone could explain the above configuration in term of processor and core and the resulting number of threads with 2 examples of machine (per their processor configuration) that would be great.

Answer Source

This question was answered in depth on akka-user by Viktor Klang, in essence: we highly recommend reading up on the ForkJoinPool documentation in the JDK docs, which covers these question in great depth.