Reputation: 1108
I was trying to understand different parameters used to define JVM Heap size.
<jdkarg value="-Xmx20000M"/>
<jdkarg value="-Xms10000M"/>
<jdkarg value="-XX:NewSize=2500M"/>
<jdkarg value="-XX:NewRatio=1"/>
<jdkarg value="-XX:MaxNewSize=5000"/>
Here I know what is the meaning of these jdkarg, what is making me to confused, I read somewhere that if I define -XX:NewSize and -XX:NewRatio both then while stating jvm will allocate young generation size using -XX:NewSize not -XX:NewRatio.
So here I have some questions regarding this:
I tried a lot of googling but not found any conclusion. Any help to understand these arg together will be appreciated.
Update:
output I am getting is not as expected:
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
426624.0 426624.0 0.0 426624.0 1706752.0 1013097.7 17920000.0 7208855.8 137032.0 82118.0 1952 130.126 24 20.441 150.567
Here I am getting Old space as 17920000 i.e. 17500 MB and young space as 2500 MB which was my initial value.
Upvotes: 2
Views: 4724
Reputation: 16226
When we define -XX:NewSize and -XX:NewRatio then initial young generation size will be defined using -XX:NewSize, is it correct?
NewRatio
is ignored if it is used together with NewSize
and MaxNewSize
What happens when Heap size increase to it's MAX in this case 20000M, then how it define max young generation size, will it use -MaxNewSize or -XX:NewRatio or none of them will be used as I have -XX:NewSize?
When both NewSize
and MaxNewSize
are used, young generation will be between those 2 sizes. But when heap size change, the young generation size will not change accordingly.
Upvotes: 2
Reputation: 1108
Here I am pointing out the problem so that similar thing can be noticed before going further which was causing this behaviors :
Ideally this should be behaviors as mention by @Oleksandr:
Both -XX:NewSize and -XX:MaxNewSize are used, young gen will be between those 2 sizes. But when heap size change, the young gen size will not change accordingly.
but because I have <jdkarg value="-XX:MaxNewSize=5000"/>
that means 5000 Bytes that means it is never going to increase Young Space up to MaxNewSize as NewSize is already greater then, correct way of setting it's max value <jdkarg value="-XX:MaxNewSize=5000M"/>
.
When I made this changes i.e. added defined size as MB then it is giving memory distribution as expected.
Upvotes: 1