I am using an application with G1 GC. Is there any parameter to trigger major GC when old gen utilization goes above a certain level? Right now, my heap usage looks like below
Heap Usage:
G1 Heap:
regions = 1504
capacity = 1577058304 (1504.0MB)
used = 1183184896 (1128.373046875MB)
free = 393873408 (375.626953125MB)
75.02480364860372% used
G1 Young Generation:
Eden Space:
regions = 540
capacity = 823132160 (785.0MB)
used = 566231040 (540.0MB)
free = 256901120 (245.0MB)
68.78980891719745% used
Survivor Space:
regions = 15
capacity = 15728640 (15.0MB)
used = 15728640 (15.0MB)
free = 0 (0.0MB)
100.0% used
G1 Old Generation:
regions = 580
capacity = 738197504 (704.0MB)
used = 600176640 (572.373046875MB)
free = 138020864 (131.626953125MB)
81.30298961292614% used
Though the old gen utilization is above 80%, major GC is not triggered. If i run the following, a major GC is triggered and most of the objects in my old gen are collected. Is there a way to trigger such major GCs periodically?
jmap -histo:live <pid>
GC related options provided on JVM startup
-server -Xms1503m -Xmx1503m -Xss512k -XX:ReservedCodeCacheSize=240m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m -XX:+UseG1GC -XX:MaxGCPauseMillis=2000 -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=30
With G1, the initial marking phase is triggered by the occupancy fraction, ie how full the heap is. By default, the initiating occupancy fraction is 45% but that is the fraction of the whole heap, not the old gen.
You can change this using the -XX:InitiatingHeapOccupancyPercent flag and set it to something less than 45. It seems a bit odd that you're seeing the old gen. 80% full. Since G1 does some phases concurrently with application threads maybe you're promoting at such a rate that the heap is filling up faster than G1 is reclaiming but that seems unlikely.
There's also an experimental flag, -XX:G1MixedGCLiveThresholdPercent that you might want to look at. There's more information here:
https://www.oracle.com/technetwork/articles/java/g1gc-1984535.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.