My server info:
- CPU:Intel Xeon E5-2630
- Memory:65970676K
- OS:Centos 6.4
- kernel:3.8.0
- jdk: HotSpot JDK 1.6.0.27
I use jmap -heap pid to print heap info:
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 21474836480 (20480.0MB)
NewSize = 21757952 (20.75MB)
MaxNewSize = 174456832
OldSize = 65404928 (62.375MB)
NewRatio = 7
SurvivorRatio = 8
PermSize = 268435456 (256.0MB)
MaxPermSize = 268435456 (256.0MB)
And following are the JVM args I defined to run my application:
-verbose:gc -XX:+UseMembar -XX:+PrintGCDetails -
XX:+PrintGCTimeStamps -XX:+DisableExplicitGC -
XX:+CMSClassUnloadingEnabled
-XX:-OmitStackTraceInFastThrow -Xloggc:/export/logs/gc.log
-XX:PermSize=256m -XX:MaxPermSize=256m -Xms6G -Xmx12G
I don't set MaxNewSize, I tried to use java -XX:+PrintFlagsFinal to print all of the JVM args and found MaxNewSize is a very very big number: 18446744073709486080. I think Ergonomics may have set MaxNewSize to 174456832 for me. However, I have another server, which has the same hardware and software, where MaxNewSize is 392560640 while other heap parameters are the same.
What's the basis for Ergonomics setting the value of MaxNewSize? Can I see this in the source code of Ergonomics?
I think I found where the value of MaxNewSize is set:Arguments.cpp (hotspot\src\share\vm\runtime)
if (CMSUseOldDefaults) { // old defaults: "old" as of 6.0
if FLAG_IS_DEFAULT(CMSYoungGenPerWorker) {
FLAG_SET_ERGO(intx, CMSYoungGenPerWorker, 4*M);
}
young_gen_per_worker = 4*M;
new_ratio = (intx)15;
min_new_default = 4*M;
tenuring_default = (intx)0;
} else {
// new defaults: "new" as of 6.0
young_gen_per_worker = CMSYoungGenPerWorker;
new_ratio = (intx)7;
min_new_default = 16*M;
tenuring_default = (intx)4;
}
// Preferred young gen size for "short" pauses
const uintx parallel_gc_threads =
(ParallelGCThreads == 0 ? 1 : ParallelGCThreads);
const size_t preferred_max_new_size_unaligned =
ScaleForWordSize(young_gen_per_worker * parallel_gc_threads);
const size_t preferred_max_new_size =
align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());