In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the method and common configuration summary of setting garbage collector in java. In daily operation, I believe many people have doubts about the method of setting garbage collector in java and common configuration summary problems. Xiaobian consulted all kinds of information and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "java setting garbage collector method and common configuration summary". Next, please follow the editor to study!
-Xms the minimum heap size, that is, when your virtual machine is started, such a large amount of heap memory will be allocated to you.
-Xmx is the largest heap size
-XX:NewRatio=4: sets the ratio of the younger generation (including Eden and two Survivor zones) to the older generation (excluding the persistent generation).
-XX:SurvivorRatio=4: sets the ratio of the size of the Eden region to the Survivor region in the younger generation.
-XX:MaxPermSize=16m: set the persistent generation size to 16m.
-XX:MaxTenuringThreshold=0: set the maximum age of garbage.
Set up the garbage collector
-XX:+UseParallelGC
-XX:ParallelGCThreads=20
-XX:+UseParallelGC
-XX:MaxGCPauseMillis=100
Set the maximum time for each young generation garbage collection
If this time cannot be met, JVM automatically resizes the younger generation to meet this value.
-XX:+UseAdaptiveSizePolicy
Automatically select the size of the younger generation and the corresponding proportion of the Survivor area
In order to reach the minimum corresponding time or collection frequency specified by the target system.
This value is recommended to be turned on when using a parallel collector.
-XX:+PrintGC
Print GC information
Summary of common configuration
Heap settings
-Xms: initial heap size
-Xmx: maximum heap size
-XX:NewSize=n: sets the size of the younger generation
-XX:NewRatio=n: sets the ratio of the younger generation to the older generation. For example, 3 means that the ratio of the young generation to the old generation is 1:3, and the young generation accounts for 1% of the sum of the young generation and the old generation.
-XX:SurvivorRatio=n: the ratio of Eden region to two Survivor regions in the young generation. Notice that there are two in the Survivor area. For example: 3, which means Eden:Survivor=3:2, and one Survivor area accounts for 1x5 of the whole younger generation.
-XX:MaxPermSize=n: sets the persistent generation size
Collector Settings
-XX:+UseSerialGC: set the serial collector
-XX:+UseParallelGC: sets the parallel collector
-XX:+UseParalledlOldGC: set parallel older generation collectors
-XX:+UseConcMarkSweepGC: sets the concurrent collector
Garbage collection statistics
-XX:+PrintGC
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-Xloggc:filename
Parallel Collector Settings
-XX:ParallelGCThreads=n: sets the number of CPU to use when collecting by the parallel collector. Number of threads collected in parallel.
-XX:MaxGCPauseMillis=n: sets the maximum pause time for parallel collection
-XX:GCTimeRatio=n: sets the percentage of garbage collection time to program running time. The formula is 1 / (1cm n)
Concurrent Collector Settings
-XX:+CMSIncrementalMode: set to incremental mode. It is suitable for single CPU situation.
-XX:ParallelGCThreads=n: the number of CPU used when the young generation of the concurrent collector is collected in parallel. Number of threads collected in parallel.
At this point, on the "java set garbage collector methods and common configuration summary" study is over, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.