Detailed description of flag settings in JVM and detailed description of JVMflag settings
This article focuses on the detailed description of the flag settings in JVM. The details are as follows.
1. Heap size settings
-Xmx3550m: sets the maximum available JVM memory to 3550 MB.
-Xms3550m: Set the JVM initial available memory to 3550 MB.
-Xmn2g: Set the young generation to 2 GB.
-Xss128k: Set the stack size of each thread to 128 kb.
-XX: NewSize = 4: Set the young generation size to 4
-XX: NewRatio = 4: Set the ratio of the young generation (including Eden and two primary vor zones) to the old generation (excluding the permanent generation) to 4, the ratio of the young generation to the old generation is, and the young generation accounts for 1/5 of the entire stack.
-XX: Region vorratio = 4: Set the ratio of Eden to region vor in the young generation. if this parameter is set to 4, the ratio of two vor zones to One Eden zone is, and one vor zone accounts for 1/6 of the young generation.
-XX: MaxPermSize = 16 m: sets the persistent generation size to 16 m.
-XX: PretenureSizeThreshold = n. objects greater than n are directly stored in the old age.
-XX: MaxTenuringThreshold = 0: sets the maximum age of spam. If it is set to 0, the young generation object directly enters the old generation without going through the same vor area.
-XX: + UseParallelOldGC: configure the garbage collection mode for the old generation to parallel collection.
Total heap size = size of the young generation + size of the old generation + size of the persistent generation.
Ii. Collector settings
-XX: + UseSerialGC: sets the serial collector.
-XX: + UseParallelGC: set parallel collectors
-XX: + UseParalledlOldGC: sets the parallel elder generation collector.
-XX: + UseConcMarkSweepGC: sets the concurrent collector.
Iii. Garbage collection statistics
-XX: + PrintGC
-XX: + PrintGCDetails
-XX: + PrintGCTimeStamps
-Xloggc: filename
Iv. Parallel collector settings
-XX: ParallelGCThreads = n: Number of CPUs used for parallel collector collection. Number of parallel collection threads.
-XX: MaxGCPauseMillis = n: sets the maximum pause time for parallel collection.
-XX: GCTimeRatio = n: Set the percentage of the garbage collection time to the running time. The formula is 1/(1 + n)
V. Concurrent collector settings
-XX: + CMSIncrementalMode: Set to incremental mode. applicable to single CPU.
-XX: ParallelGCThreads = n: set the number of CPUs used by the concurrent collector when the young generation collects data in parallel mode. The number of parallel collection threads.
The following is an example:
Suppose there is a file named TestMem. java.
javac TestMem.java java -verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8 TestMem
-Xms20M: the initial size of the Java heap in JVM is 20 mb. (Including new generation and old generation)
-Xmx20M: The maximum Java heap size in JVM is 20 mb, that is, it cannot be expanded. (Including new generation and old generation)
-Xmn10M: the size of the new generation is 10 M.
-XX: + PrintGCDetails: prints detailed GC Information
-XX: Region vorratio = 8: In the new generation, the space ratio of an Enden to a region VOR is, then the ratio of the two regions vor to an Eden is, one vor region accounts for 1/10 of the young generation.
After knowing the flag information above, we can get the following information:
The total java heap size is 20 M = 20*1024 K = 20480 K
Size of the New Generation: 10 M = 10*1024 K = 10240 K
Eden space: 10240 K * 8/10 = 8192 K
From space: 10240 K * 1/10 = 1024 K
To space: 10240 K * 1/10 = 1024 K
Size of the old generation: 20 M-10 M = 10 M = 10240 K
Summary
The above is all the details about the flag settings in JVM. I hope it will be helpful to you. If you are interested, you can continue to refer to other related topics on this site. If you have any shortcomings, please leave a message. Thank you for your support!