RFR: Heap region count selection should only consider max heap size
Roman Kennke
rkennke at redhat.com
Fri Jul 13 08:32:27 UTC 2018
This sounds good. Thanks!
Am 13. Juli 2018 10:10:08 MESZ schrieb Aleksey Shipilev <shade at redhat.com>:
>We have borrowed the simple region count heuristics from G1. There, G1
>wants to have larger regions,
>because reasons: https://bugs.openjdk.java.net/browse/JDK-8019902.
>Shenandoah generally wants larger
>regions too, and it claims max heap size under pressure.
>
>In Shenandoah, initial heap size only serves as the guidance for
>initial committed heap. But current
>heuristics is very sensitive to the -Xms setting, because it would
>affect the number of regions in
>the heap, which would affect the max TLAB size available for allocs,
>and some of our internal time
>and memory overhead processing the regions.
>
>Let's just depend on max_heap_size to consistently get larger regions:
>
>diff -r c458d4021216
>src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
>--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp Fri Jul
>13 08:48:07 2018 +0200
>+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp Fri Jul
>13 10:05:25 2018 +0200
>@@ -590,13 +590,14 @@
> if (ShenandoahMinRegionSize > ShenandoahMaxRegionSize) {
>err_msg message("Minimum (" SIZE_FORMAT "K) should be larger than
>maximum (" SIZE_FORMAT "K).",
> ShenandoahMinRegionSize/K, ShenandoahMaxRegionSize/K);
> vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize or
>-XX:ShenandoahMaxRegionSize", message);
> }
>- size_t average_heap_size = (initial_heap_size + max_heap_size) /
>2;
>- region_size = MAX2(average_heap_size / ShenandoahTargetNumRegions,
>- ShenandoahMinRegionSize);
>+
>+ // We rapidly expand to max_heap_size in most scenarios, so that
>is the measure
>+ // for usual heap sizes. Do not depend on initial_heap_size here.
>+ region_size = max_heap_size / ShenandoahTargetNumRegions;
>
> // Now make sure that we don't go over or under our limits.
> region_size = MAX2(ShenandoahMinRegionSize, region_size);
> region_size = MIN2(ShenandoahMaxRegionSize, region_size);
>
>
>Baseline, -Xms100g -Xmx100g:
>
> [0.002s][info][gc,init] Region size in bytes: 33554432
> [0.002s][info][gc,init] Region size byte shift: 25
> [0.002s][info][gc,init] Humongous threshold in bytes: 33554432
> [0.002s][info][gc,init] Max TLAB size in bytes: 33554432
> [0.002s][info][gc,init] Number of regions: 3200
>
>Benchmark (size) Mode Cnt Score
>Error Units
>IntArray.test 10000 avgt 5 177.701 ±
>0.890 ns/op
>IntArray.test:·gc.alloc.rate 10000 avgt 5 3120083.269 ±
>14055.559 MB/sec
>
>
>Baseline, -Xmx100g:
>
> [0.002s][info][gc,init] Region size in bytes: 16777216
> [0.002s][info][gc,init] Region size byte shift: 24
> [0.002s][info][gc,init] Humongous threshold in bytes: 16777216
> [0.002s][info][gc,init] Max TLAB size in bytes: 16777216
> [0.002s][info][gc,init] Number of regions: 6400
>
>Benchmark (size) Mode Cnt Score
>Error Units
>IntArray.test 10000 avgt 5 196.804 ±
>1.212 ns/op
>IntArray.test:·gc.alloc.rate 10000 avgt 5 2821176.375 ±
>19671.323 MB/sec
>
>
>Patched, -Xmx100g:
>
> [0.002s][info][gc,init] Region size in bytes: 33554432
> [0.002s][info][gc,init] Region size byte shift: 25
> [0.002s][info][gc,init] Humongous threshold in bytes: 33554432
> [0.002s][info][gc,init] Max TLAB size in bytes: 33554432
> [0.002s][info][gc,init] Number of regions: 3200
>
>Benchmark (size) Mode Cnt Score
>Error Units
>IntArray.test 10000 avgt 5 177.776 ±
>0.540 ns/op
>IntArray.test:·gc.alloc.rate 10000 avgt 5 3121506.259 ±
>8809.584 MB/sec
>
>
>Thanks,
>-Aleksey
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
More information about the shenandoah-dev
mailing list