eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.27k stars 721 forks source link

Eden initial size problem #11866

Open 1a2s3d4f1 opened 3 years ago

1a2s3d4f1 commented 3 years ago

Java -version output

openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b08)
Eclipse OpenJ9 VM (build openj9-0.24.0, JRE 1.8.0 Windows 7 amd64-64-Bit Compres
sed References 20210120_972 (JIT enabled, AOT enabled)
OpenJ9   - 345e1b09e
OMR      - 741e94ea8
JCL      - ab07c6a8fd based on jdk8u282-b08)

Summary of problem

Use Balanced gc: When set -Xmx1024M -Xms1023M. The eden initial committed size is Xmns value. If set Xmx=Xms, the eden initial committed size is Xmnx value。

Use the app to test gc java -Xmx1024M -Xms1024M -Xmns2M -Xmnx1000M -verbose:gc -Xverbosegclog -Xgcpolicy:balanced -jar app.jar 1

Diagnostic files

MC server gc log: Xmx=Xms:verbosegc.20210203.095225.2492.zip Xmx≠Xms:verbosegc.20210203.100915.2992.zip

Test gclog(Use this app): Xmx=Xms:verbosegc.20210203.102236.3028.zip Xmx≠Xms:verbosegc.20210203.102409.1604.zip

dmitripivkine commented 3 years ago

Yes, I see behaviour you are talking about and it is confusing obviously. Current implementation overwrites Eden initial size by Eden max size if fully expanded heap is detected. @amicic @cedrichansen Is it intentional or some kind of side effect? Can it be improved?

cedrichansen commented 3 years ago

That is expected behaviour. Whenever the heap size is equal to -Xmx value, eden will be set to -Xmnx value.

Whether this is desirable or not, is another question.

See below for basic idea behind eden sizing logic: https://github.com/eclipse/openj9/blob/339a3a6c0c2bfeab644ab8db8c67b6f91c3aa947/runtime/gc_vlhgc/SchedulingDelegate.cpp#L1078

We are aware of this as being a potential area of improvement, and are working on refining this logic.