Jvm-related parameters, tuning, and jvm parameter tuning
Common jvm parameters are as follows:
-Xmx1024m: Set the JVM maximum available memory to 1024 MB.
-Xms1024m: Set JVM to enable the memory to be 1024 MB. This value can be set to the same as-Xmx to avoid JVM re-allocating memory after each garbage collection.
-Xmn512m: Set the young generation size to 512 m. Memory size of the entire JVM = size of the young generation + size of the old generation + size of the persistent generation. The permanent generation usually has a fixed size of 64 m. Therefore, increasing the size of the young generation will reduce the size of the old generation. This value has a great impact on the system performance. Sun officially recommends 3/8 of the total heap configuration.
-Xss128k: Set the stack size of each thread. After JDK 256, the size of each thread stack is 1 MB, and the size of each previous thread stack is K. The memory size required for more application threads is adjusted. Reduce this value to generate more threads in the same physical memory. However, the operating system still has a limit on the number of threads in a process. It cannot be generated infinitely. The experience is between 3000 and ~ About 5000.
-XX: NewRatio = 4: Set the ratio of the young generation (including Eden and two region vor regions) to the old generation (excluding the permanent generation ). If this parameter is set 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: 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 VOR area. For applications with many older generations, the efficiency can be improved. If this value is set to a greater value, the young generation object will be copied multiple times in the same vor area, which can increase the survival time of the young generation object, added an overview of being recycled in the young generation.
JVM garbage collection printing log.
-XX: + PrintGC
Output Format: [GC 118250 K-> 113543 K (130112 K), 0.0094143 secs]
[Full GC 121376 K-> 10414 K (130112 K), 0.0650971 secs]
-XX: + PrintGCDetails
Output Format: [GC [DefNew: 8614 K-> 781 K (9088 K), 0.0123035 secs] 118250 K-> 113543 K (130112 K), 0.0124633 secs]
[GC [DefNew: 8614 K-> 8614 K (9088 K), 0.0000665 secs] [Tenured: 112761 K-> 10414 K (121024 K ), 0.0433488 secs] 121376 K-> 10414 K (130112 K), 0.0436268 secs]
Ps: "[GC 1" and "[Full GC" indicate the type of garbage collection pause. "Full" indicates "stop-the-world"
"DefNew" "Tenured" "Perm" indicates the GC Occurrence Region, which is related to the GC collector used
"8614 K-> 781 K (9088 K)" means "before GC, capacity is used in this region-> after GC, capacity is used (total capacity in this region )"
"0.0094143 secs" indicates the GC time in the region, in seconds.
-Dsun. awt. keepWorkingSetOnMinimize = true when the GUI program is minimized to the taskbar, the occupied memory is still maintained. When you return to the program again, it can be quickly displayed, accelerating the speed of returning to the original interface.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.