First, by default JVM 1.8 setting, this program metaspace never over 20M, Old Gen never over 80M, Suvivor just around 6M - 24M.
With New Space can bump up to 1.4G, shows this Java Program create many objects for only a very short time and won't last for long. As it is a client program, GC time actually VS memory usage, we can sacrifice some GC time for much less memory as 1.4G is really large.
1st try:
-XX:MaxHeapSize=256M -XX:MaxMetaspaceSize=64M -XX:MetaspaceSize=24M -XX:NewRatio=2 -XX:CompressedClassSpaceSize=16M -XX:-UseParallelGC
Not bad, with doubled GC pause but I only use 1/5 memory
2nd try:
-XX:MaxHeapSize=128M -XX:MaxMetaspaceSize=64M -XX:MetaspaceSize=24M -XX:MaxNewSize=96M -XX:NewRatio=2 -XX:SurvivorRatio=14 -XX:CompressedClassSpaceSize=16M -XX:-UseParallelGC
Not bad, with 4 times GC pause but I only use 1/10 memory, acceptable since it is just a client program.
3rd try:
-XX:MaxHeapSize=64M -XX:MaxMetaspaceSize=64M -XX:MetaspaceSize=24M -XX:MaxNewSize=32M -XX:NewRatio=2 -XX:SurvivorRatio=3 -XX:CompressedClassSpaceSize=16M -XX:-UseParallelGC
Not good, dramatically increased to 2.3 seconds GC pause, 64M seems really a little over :)
Keep trying difference 256MB allocation.
No comments:
Post a Comment