admin管理员组

文章数量:1318979

For a Java 21 application with following resource definitions:

    resources:
      limits:
        cpu: "2"
        ephemeral-storage: 500Mi
        memory: 2500Mi
      requests:
        cpu: 500m
        memory: 2500Mi

I've come to realize that the InitialRAMPercentage flag has absolutely no effect on setting the initial heap size when using G1GC(default) with -XX:InitialRAMPercentage=50.0 -XX:MaxRAMPercentage=80.0 flags:

purple: max heap, orange: committed heap, green: used heap

Whereas using SerialGC, the InitialRAMPercentage works as expected with -XX:+UseSerialGC -XX:InitialRAMPercentage=50.0 -XX:MaxRAMPercentage=80.0 flags:

blue: max heap, green: committed heap, pink: used heap

I looked all over the JVM docs but couldn't find anything that talks about InitialRAMPercentage not working with G1GC, as well as reading the section of the JVM that sets the initial heap size from the argument: .cpp#L1661C7-L1661C22

If you have any insights into why this might be happening and the reasoning behind it, I would greatly appreciate your input!

本文标签: javaWhy does XXInitialRAMPercentage not work with G1GCStack Overflow