RFR: 8322732: ForkJoinPool may underutilize cores in async mode

Doug Lea dl at openjdk.org
Fri May 10 12:23:13 UTC 2024


On Fri, 10 May 2024 07:34:40 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> This set of changes address causes of poor utilization with small numbers of cores due to overly aggressive contention avoidance. A number of further adjustments were needed to still avoid most contention effects in deployments with large numbers of cores
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 978:
> 
>> 976:      * of two, at least 2. See above.
>> 977:      */
>> 978:     static final int INITIAL_QUEUE_CAPACITY = 1 << 7;
> 
> @DougLea Interesting change—what impact did you notice when doubling this?

The goal is to reduce the worst form of contention: when queue arrays are laid out adjacently in memory. Increasing sizes has some impact but with diminishing returns. Thanks for the comment as a reminder that I haven't rechecked this lately in light of other layout changes. Will do.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1596684587


More information about the core-libs-dev mailing list