RFR: 8254699: Suboptimal PreTouchParallelChunkSize defaults and limits
tschatzl at openjdk.java.net
Mon Nov 30 13:17:55 UTC 2020
On Sun, 29 Nov 2020 16:47:58 GMT, Amit Pawar <github.com+71302734+amitdpawar at openjdk.org> wrote:
> This PR fixes lower and default value of JVM flag PreTouchParallelChunkSize. Its default value is 1GB and is used by both G1GC and ParallelGC to pretouch the pages. Following test showed that reducing the chunk size improves JVM startup time and GC pause time.
> Tests are: (Test machine 2P 64C/128T with 1TB memory)
> 1. JVM startup time test with AdaptiveSizePolicy disabled: Pretouch 1TB of memory with/without transparent large page support and used time command to measure the time taken.
> Command: time ./jdk/bin/java -XX:+AlwaysPreTouch -XX:+<UseParallelGC or UseG1GC>-Xmx900g -Xms900g -Xmn800g -XX:SurvivorRatio=400 -Xlog:gc*=debug:file=gc.log -XX:ParallelGCThreads=128 -XX:PreTouchParallelChunkSize=<chunk size> -version
> 2. JVM startup and GC pause time test with AdaptiveSizePolicy enabled: SPECjbb composite run with 1TB heap and transparent large page support was enabled.
> Test results are recorded in XL file. [PreTouchParallelChunkSize_TestResults.xlsx](https://github.com/openjdk/jdk/files/5612448/PreTouchParallelChunkSize_TestResults.xlsx)
> Test results shows:
> 1. With AdaptiveSizePolicy disabled.
> 1. G1GC improved upto ~14% on large page disabled and ~5% on enabled.
> 2. ParallelGC improved upto ~15% on large page disabled and ~5% on enabled.
> 3. Tests showed improvement from 64KB for default page size and 2MB for lage page size.
> 4. Please check "JVM_Startup_Summary" sheet in XL file for more detail.
> 2. SPECjbb composite test with UseAdaptiveSizePolicy + UseLargePages enabled.
> 1. Pretouch takes up-to 30-90% less time for memory range 32MB-4GB. This happens because memory less than 1GB also pretouched with multiple threads.
> 2. Same also helps to bring down GC pause time and this is dependent on memory size. Effect is larger when expansion size is smaller.
> 3. Please check SPECjbb_Summary sheet in XL file for more detail.
> Default value of PreTouchParallelChunkSize is changed to 4MB and based your suggestion it can be changed to right value. Please check and review this PR.
Looks good, but could you undo the changes in pretouchTask.cpp? These break the rule to have all gang tasks with a "Running .... with ... workers" message. Also, this message is then printed for all pretouch actions - even when resizing the heap which can be quite annoying.
Instead, the method could use a `GCTraceTime` instance to time the method. However I do not think this is really necessary or desired - imho in this case the caller should decide on whether it wants some log output, but others may have a different opinion :)
Since a CSR is needed for changes to product flags like this, I started one with [JDK-8257419](https://bugs.openjdk.java.net/browse/JDK-8257419). Probably also needs a release note.
Changes requested by tschatzl (Reviewer).
More information about the hotspot-gc-dev