Explaining AKKA Thread Pool Execturor Config parameters

6,452 views
Skip to first unread message

Maatary Okouya

unread,
Oct 11, 2015, 3:27:55 PM10/11/15
to Akka User List
Hi, 

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: 

  1. fork-join-executor {
  2. # Min number of threads to cap factor-based parallelism number to
  3. parallelism-min = 8
  4.  
  5. # The parallelism factor is used to determine thread pool size using the
  6. # following formula: ceil(available processors * factor). Resulting size
  7. # is then bounded by the parallelism-min and parallelism-max values.
  8. parallelism-factor = 3.0
  9.  
  10. # Max number of threads to cap factor-based parallelism number to
  11. parallelism-max = 64
  12.  
  13. # Setting to "FIFO" to use queue like peeking mode which "poll" or "LIFO" to use stack
  14. # like peeking mode which "pop".
  15. task-peeking-mode = "FIFO"
  16. }

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.

Viktor Klang

unread,
Oct 12, 2015, 3:55:26 AM10/12/15
to Akka User List
Hi Maatary,

On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya <maatar...@gmail.com> wrote:
Hi, 

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: 

  1. fork-join-executor {
  2. # Min number of threads to cap factor-based parallelism number to
  3. parallelism-min = 8
  4.  
  5. # The parallelism factor is used to determine thread pool size using the
  6. # following formula: ceil(available processors * factor). Resulting size
  7. # is then bounded by the parallelism-min and parallelism-max values.
  8. parallelism-factor = 3.0
  9.  
  10. # Max number of threads to cap factor-based parallelism number to
  11. parallelism-max = 64
  12.  
  13. # Setting to "FIFO" to use queue like peeking mode which "poll" or "LIFO" to use stack
  14. # like peeking mode which "pop".
  15. task-peeking-mode = "FIFO"
  16. }

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 ?

It means that the factor given in "parallelism-factor" will be what the available number of processors will be multiplied with.

Scenario:

available processors = 4
parallelism-factor = 0.6

ceil(4 * 0.6) == 3

this means that the resulting desired parallelism is 3

Does that make sense?



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.

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,

Maatary Okouya

unread,
Oct 12, 2015, 6:01:12 AM10/12/15
to Akka User List
Thank you victor.

However,

1 - does it means that akka configuration is not related to the number of cores but the processor only ? So wether your processor has two cores or 4 cores or just 1, is not taken into account at all, i.e. in deciding how much thread you would allocate in your thread pool?

Or

2 - by processor u actually mean "a core" I.e in "4 processors" your actually mean a quad-core processor or dual-core processor hyper-threaded.


Could you please clarify this "processor" thing in term of typical machine configuration ?


You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/eR4fShuWm6w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Viktor Klang

unread,
Oct 12, 2015, 6:08:52 AM10/12/15
to Akka User List
On Mon, Oct 12, 2015 at 12:00 PM, Maatary Okouya <maatar...@gmail.com> wrote:
Thank you victor.

However,

1 - does it means that akka configuration is not related to the number of cores but the processor only ? So wether your processor has two cores or 4 cores or just 1, is not taken into account at all, i.e. in deciding how much thread you would allocate in your thread pool?
 
Or

2 - by processor u actually mean "a core" I.e in "4 processors" your actually mean a quad-core processor or dual-core processor hyper-threaded.


Could you please clarify this "processor" thing in term of typical machine configuration ?

No, it's about the number of processors available to the JVM. It's about what the OS reports.
https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#availableProcessors()

So for a computer with 2 CPU-slots with 4 cores each with HyperThreading, it would be 2 * 4 * 2 = 16 processors



--
Cheers,

Maatary Okouya

unread,
Oct 12, 2015, 6:26:30 AM10/12/15
to akka-user
Understood, Many thanks. 

Viktor Klang

unread,
Oct 12, 2015, 6:29:20 AM10/12/15
to Akka User List
Happy hAkking!

Maatary Okouya

unread,
Oct 12, 2015, 6:44:56 AM10/12/15
to akka-user
Just to be clear, the meaning of parallelism is not stricto sensus. In other words, when i think  parallelism, i think parallel execution. While given that we are not at 1 thread per OS reported processor, but 3, i conclude that this is more like a concurrency factor. I mean concurrent is not parallel.  That was the my original confusion i.e. understanding what is meant by parallelism here. 

But i guess this is parallel in the loose sense, as in scala parallel collection. They can be fully operated in parallel but r actually operated concurrently. 

I just wanted to be clear on the semantic? Is my understanding right ? We are talking of parallelism in a loose sense and not stricto sensus. 

Viktor Klang

unread,
Oct 12, 2015, 6:53:41 AM10/12/15
to Akka User List
On Mon, Oct 12, 2015 at 12:44 PM, Maatary Okouya <maatar...@gmail.com> wrote:
Just to be clear, the meaning of parallelism is not stricto sensus. In other words, when i think  parallelism, i think parallel execution. While given that we are not at 1 thread per OS reported processor, but 3, i conclude that this is more like a concurrency factor. I mean concurrent is not parallel.  That was the my original confusion i.e. understanding what is meant by parallelism here. 

But i guess this is parallel in the loose sense, as in scala parallel collection. They can be fully operated in parallel but r actually operated concurrently. 

I just wanted to be clear on the semantic? Is my understanding right ? We are talking of parallelism in a loose sense and not stricto sensus. 

Id' recommend reading up on the following for understanding ForkJoinPool: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ForkJoinPool.html
 
We chose to use the same nomenclature (inventing our own would be weird, don't you agree?)



--
Cheers,

Maatary Okouya

unread,
Oct 12, 2015, 6:14:20 PM10/12/15
to akka-user
Oh thanks. Great material
Reply all
Reply to author
Forward
0 new messages