Heap-related configuration parameters
-Xmx
The maximum heap space
-Xms
The initial heap size, if the initial heap space is exhausted, JVM will heap space expansion, which expands the upper limit is the maximum heap space. -Xms generally set to the same size -Xmx, causing expansion to avoid performance losses.
-Xmn
Set the size of the new generation, a large set of new generation will reduce the size of old age, the size of the new generation is generally set to 1/3 or 1/4 of the entire heap space.
-XX:SurvivorRatio
Setting the new generation of eden space and from / proportional relationship to space.
-XX:SurvivorRatio=eden/from=eden/to
JVM parameters is a more important parameter SurvivorRatio, it defines the new generation area and Survivor Eden region (From To survive surviving region or area) ratio, the default is 8, that account for the new generation of 8/10 Eden, From To survive and survive district area each accounted for one tenth of the new generation. 2 two survivor proportion always default 8, eden: survivor = 8: 2, to 2, eden: survivor = 2: 2.
For example: -Xmx20m -Xms20m -Xmn1m -XX: SurvivorRatio = 2
The size of the new generation 512KB (eden) + 256KB (from) + 256KB (to) 1MB = (Survivor),
Eden 512KB total available area for the new generation of 512KB (eden) + 256KB (from or to) = 768KB. (Newly generated objects allocated in eden district, if district eden fills triggers YoungGC, the non-recyclable objects placed from or to, and ages +1)
-XX:NewRatio
Setting the new generation and the old age ratio
-XX: NewRatio = years old / new generation
The proportion of the new generation is always 1, as a value of 4, the new generation: Old decade = 1: 4.
For example: -Xmx20m -Xms20M -XX: NewRatio = 2 CENOZOIC size of 20MB * 1/3 = 6MB, senile took about 13MB.
Should be set aside as an object in the new generation, GC's old number (FullGC) reduction
-XX:MaxTenuringThreshold
To set the junk maximum age. If set to 0, then the younger generation of the object without Survivor areas, directly into the old generation. For more of the old generation of applications that can improve efficiency. If this value is set to a large value, then the young generation objects will be copied many times in Survivor areas, which can increase the object and then the young generation of survival time, an increase in the introduction to the young generation namely recycling.
-XX:PretenureSizeThreshold
So this setting is greater than the value of the object directly in old's assignments to avoid a lot of memory replication occurs in the area between Eden and two Survivor areas. PretenureSizeThreshold parameters only for Serial and ParNew two collector effective, Parallel Scavenge collector does not know this parameter, Parallel Scavenge collector generally does not need to set. If you encounter a situation you must use this parameter, consider a collector combination ParNew plus CMS.
-XX:+HeapDumpOnOutOfMemoryError
Export heap memory overflow occurs when information
-XX:+HeapDumpPath
-XX:+HeapDumpPath=/opt/OOM.dump
Deriving information specified storage path stack when the output memory overflow occurs.
-XX:OnOutOfMemoryError
When the memory overflows can execute the specified script
Such as:
-XX:OnOutOfMemoryError=$JAVA_HOME/bin/Printstack
Printstack $JAVA_HOME/bin/jstack –F %1 > /opt/stack
You can print the information for the current thread