8
votes

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.

1
ceil = ceiling, or the next integer which is just above the given value. I.e. ceil(4.8) = 5, ceil(4.2) = 5, ceil(5.1) = 6Ashalynd
parallelism-factor is, roughly, how many threads per available processor you want to haveAshalynd
So it has nothing to do with the number of core per processors ?MaatDeamon
this does not compute for me. Wether i have a multi-core processor or a 1 core processor does not make any difference. This does not make sense. Beside what machine actually has more than 1 Physical processor, within the realm of general purpose machine. It is always 1 processor that is either 2, 4, 6, or 8 core based. Those are the typical processors we have. And you are telling me that even with a 8 core, i will have the same thread pool size as with 1 core ?MaatDeamon
How can you know in advance where your program is going to run?Ashalynd

1 Answers

5
votes

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.