JVM review notes and jvm Review
-- Take it easy
Garbage collection:
Young generation ------- serial, parnew, parallel scavenge
Tenured gencration --------- CMS, Serial old (MSC), parallel old.
The parallel scavenge collector is a new generation collector that uses apparel algorithms and parallel multi-thread collectors.
It looks like parnew. What's special?
-- The characteristics of parallel scavenge collectors are that they are different from those of other collectors. The focus of collectors such as CMS is
Minimize the pause time of the user thread during garbage collection, while the objective standard of the parallel scavenge collector is
Achieve a controllable throughput.
The adaptive adjustment policy is an important difference between the parallel scavenge collector and the parnew collector.
Parameter ---XX: + UseAdaptiveSizePolicy MaxGCPauseMillis GCTimeTatio
The CMS (Concurrent Mark Sweep) collector is a collector designed to obtain the minimum recovery pause time.
These applications place special emphasis on the response speed of services and hope that the system will be paused for the shortest time to bring a better user experience.
The cms collector cannot handle Floating Garbage (Floating Garbage) and may see "Concurrent mode failure"
Failure causes another Full GC.
By default, the CMS collector is activated when 68% of the space is occupied in the old age.
G1 (Garbage-First)
It is a garbage collector for server applications. In the future, you can replace the CMS collector released in jdk1.5.
JVM garbage collectionCommonParameters
Parameter |
Description |
UseSerialGC |
Default Value of the virtual machine running in Client mode. After this switch is enabled, use Serial + Memory recycle using a combination of Serial Old collectors |
UseParNewGC |
Turn on this switch and use the collector combination of ParNew + Serial Old for memory recovery |
UseConcMarkSweepGC |
Turn on this switch and use the collector combination of ParNew + CMS + Serial Old for memory Recycle. The Serial Old collector will be used as the backup collector after a Concurrent Mode Failure occurs in the CMS collector. |
UseParallelGC |
The default value of the virtual machine running in Server mode. After enabling this switch, use Parallel Scavenge + Serial Old (PS MarkSweep) Collector combination for memory recovery |
UseParallelOldGC |
Turn on this switch and use the collector combination of Parallel Scavenge + Parallel Old to recycle memory |
SurvivorRatio |
The Capacity Ratio of the Eden region to the VOR region in the new generation. The default value is 8, which indicates Eden: required vor = |
PretenureSizeThreshold |
The object size that is directly promoted to the old age. After this parameter is set, the object larger than this parameter Will be allocated directly in the old age |
MaxTenuringThreshold |
The age of the person who was promoted to the old age. After a Minor GC operation is performed on each object 1 is added when the age is reached. When the value exceeds this parameter, it enters the old age. |
UseAdaptiveSizePolicy |
Dynamically adjust the size of each region in the Java heap and the age of the old age |
HandlePromotionFailure |
Whether to allow the allocation of guarantee failure, that is, the remaining space in the old age is not enough to cope with the entire New Generation Extreme conditions in which all objects in the Eden and zoovor regions survive |
ParallelGCThreads |
Set the number of threads for memory collection during parallel GC. |
GCTimeRatio |
The percentage of GC time to the total time. The default value is 99, that is, 1% of GC time is allowed. Only in Take effect when using the Parallel Scavenge collector |
MaxGCPauseMillis |
Set the maximum pause time for GC. Takes effect only when the Parallel Scavenge collector is used |
CMSInitiatingOccupancyFraction |
Set the usage of the CMS collector in the old age to trigger garbage collection. The default value is 68%, effective only when the CMS collector is used |
UseCMSCompactAtFullCollection |
Sets whether the CMS collector performs a memory fragment after completing the garbage collection. Only Effective when using the CMS collector |
CMSFullGCsBeforeCompaction |
Set the CMS collector to enable memory fragmentation after several garbage collections. Effective only when the CMS collector is used |