Click to enter _ more _java thousand ask
1. What are the common configuration of the JVM?
Understanding the JVM memory model look here: What is the Java memory model
Understanding JVM Memory Management Look here: How the JVM manages memory
Understanding the JVM garbage collection mechanism look here: What is the Java garbage collection mechanism
There are many JVM configurations, grouped by type, that are often used to optimize JVM memory (see here: How Java memory is optimized), common configuration:
Learn about the garbage collector see here: What are the ways Java garbage collection works
Heap Settings
-xms=n
The initial heap size.
-xmx=n
The maximum heap size.
-xmn=n
Cenozoic size, this configuration takes precedence over-xx:newratio, that is, if-xmn,-xx:newratio is configured to fail.
-xx:newratio=n
The ratio of Laosheng generation to Cenozoic, for example, is 3, which means that the ratio of Cenozoic to Laosheng is 1:3.
-xx:survivorratio=n
The ratio of the Eden and survivor regions in the Cenozoic. The survivor is differentiated into equivalent two zone s0,s1. For example,-xx:survivorratio=3 represents Eden:s0:s1=3:1:1.
-xx:maxpermsize=n
Sets the permanent generation (method area) size.
-xx:maxgcpausemillis=n
Sets the maximum garbage collection pause time.
-xx:gctimeratio=n
Set a garbage collection time as a percentage of the program run time, and the percentage of time spent on the GC does not exceed 1/(1 + N).
Garbage collector settings
-xx:+useserialgc
Sets the serial collector.
-xx:+useparallelgc
Sets the parallel collector.
-xx:+useparalleloldgc
Sets the parallel old generation collector.
-xx:+useconcmarksweepgc
Sets the concurrency collector.
-xx:+useg1gc
G1 garbage collector.
Parallel collector settings
-xx:parallelgcthreads=n
Set the concurrency collector the number of threads that the young generation collects in parallel collection.
Concurrent collector Settings
-xx:+cmsincrementalmode
Set to incremental mode. In incremental mode, the concurrency collector does not monopolize the entire cycle during the concurrency phase, but periodically pauses and wakes up the application thread. The collector divides the concurrency phase work into fragments and arranges for secondary (minor) recycling operations. For servers that require low latency and less CPU. The general single CPU turns on incremental mode.
-xx:parallelcmsthreads=n
The number of threads used by the concurrent garbage collector to mark the scan
Garbage collection Statistics
-xx:+printgc
Output GC log, summary log.
-xx:+printgcdetails
Print GC logs detailing the logs for each zone.
-xx:+printgctimestamps
Print GC logs detailing the GC run time logs. The timestamp of the output GC is shown in the form of a base time.
-xx:+printgcdatestamps
Print GC logs detailing the GC run time logs. The timestamp of the output GC is displayed as a date.
-xx:+printheapatgc
Print out the heap information before and after the GC is printed.
-XLOGGC:.. /logs/gc.log
The output path of the log file.
Summarized as follows:
Java FAQ _07JVM Architecture (017) _JVM Common configurations