RFR 8080623 CPU overhead in FJ due to spinning in awaitWork (original) (raw)

Paul Sandoz paul.sandoz at oracle.com
Tue May 19 17:55:27 UTC 2015


Hi,

https://bugs.openjdk.java.net/browse/JDK-8080623

diff -r ea3ca5cfc3c6 src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java --- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java Tue May 19 20:04:29 2015 +0300 +++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java Tue May 19 19:54:00 2015 +0200 @@ -1328,13 +1328,9 @@ /** * Number of times to spin-wait before blocking. The spins (in * awaitRunStateLock and awaitWork) currently use randomized

This is a quick fix from Doug to reduce the CPU usage in F/J computations that was introduced with the fix for JDK-805624 to reduce thread construction. Many thanks to Staffan Friberg for doing the performance work and analysis.

The F/J pool makes a worker thread spin for a bit while waiting for more work to become available rather than immediately blocking. This results in higher CPU usage and can cause performance regressions since there is less CPU resources available to other threads or applications.

The interim fix is to turn off spinning. This has the effect of making questionable cases worse (e.g. parallel streams with an inappropriate small number elements).

It will be back ported to 8u60 and it is planned that a better solution will be introduced in 9 (and time permitting it may be possible to backport that).

Paul.



More information about the core-libs-dev mailing list