Java GC Tutorials - Herong's Tutorial Examples - v1.10, by Dr. Herong Yang
Adaptive Size Policy for Best Throughput
This section provides a tutorial on how Adaptive Size Policy is used by the Parallel collector to our best Throughput goal.
In this second test, let's ask the Parallel collector to give us the best throughput performance using these JVM options:
-XX:MaxGCPauseMillis=1000 We don't care about latency: You can pause application as long as 1000 ms. -XX:GCTimeRatio=99 We want the best throughput: Give us the smallest percent of time or < 1% (or 1/(1+99)) for GC -Xmx1200m We don't care about footprint: You can use as much as 1.2GB heap
Here is what we got:
java -XX:+UseParallelGC -XX:MaxGCPauseMillis=1000 -XX:GCTimeRatio=99 -Xmx1200m -XX:AdaptiveSizePolicyOutputInterval=1 -Xlog:gc=debug,gc+heap=debug,gc+ergo=trace GarbageCollection2 ... Full after scavenge average_promoted 27943460 padded_average_promoted 31022564 free in old gen 13399408 GC(39) Heap before GC invocations=40 (full 10): PSYoungGen total 403968K, used 5120K [... GC(39) eden space 398336K, 0% used [... GC(39) from space 5632K, 90% used [... GC(39) to space 5632K, 0% used [... GC(39) ParOldGen total 156160K, used 143074K [... GC(39) object space 156160K, 91% used [... ... GC(39) PSYoungGen: 5120K->0K(403968K) GC(39) ParOldGen: 143074K->32480K(161280K) GC(39) Pause Full (Ergonomics) 144M->31M(552M) 7.945ms GC(39) Heap after GC invocations=40 (full 10): PSYoungGen total 403968K, used 0K [... GC(39) eden space 398336K, 0% used [... GC(39) from space 5632K, 0% used [... GC(39) to space 5632K, 0% used [... GC(39) ParOldGen total 161280K, used 32480K [... GC(39) object space 161280K, 20% used [... GC(39) UseAdaptiveSizePolicy actions to meet *** throughput goal *** GC(39) GC overhead (%) GC(39) Young generation: 14.39 (attempted to grow) GC(39) Tenured generation: 4.93 (attempted to grow) GC(39) Tenuring threshold: (attempted to decrease to balance GC costs) = 1 9853 578813952 544504864 34309088 ...
Not too bad. The Adaptive Size Policy did an ok job:
Table of Contents