In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the example analysis of JVM tuning method, which has a certain reference value, and interested friends can refer to it. I hope you will gain a lot after reading this article.
Summary of JVM tuning
Young (younger generation)
The younger generation is divided into three districts. One Eden zone and two Survivor zones. Most objects are generated in the Eden zone. When the Eden area is full, the surviving objects will be copied to the Survivor area (one of the two). When the Survivor area is full, the surviving objects in this area will be copied to another Survivor area. When the Survivor is full, the objects copied from * * Survivor areas and still alive at this time will be copied "Tenured". It should be noted that the two regions of Survivor are symmetrical, so there may be objects copied from Eden and objects copied from the previous Survivor in the same zone, while objects copied to the old zone only come from * Survivor. Also, one of the Survivor zones is always empty.
Tenured (older generation)
The older generation stores objects that survive from the younger generation. Generally speaking, the older generation stores objects with a longer life span.
Perm (persistent generation)
Used to store static files, now Java classes, methods, and so on. Persistent generation has no significant impact on garbage collection, but some applications may dynamically generate or call some class, such as Hibernate, at this time, you need to set a large persistent generation space to store these new classes. The persistent generation size is set through-XX:MaxPermSize=.
Selection of younger Generation size optimized by JVM
◆ response time priority applications: set it as large as possible until it is close to the system's response time limit (selected according to the actual situation). In this case, the frequency of collection of the younger generation is also the lowest. At the same time, reduce the number of people who reach the older generation.
◆ throughput priority applications: set as large as possible, possibly to the extent of Gbit. Because there is no requirement for response time, garbage collection can be carried out in parallel, which is generally suitable for applications above 8CPU.
Selection of older generation size in the year of JVM tuning
◆ response time priority applications: the older generation uses concurrent collectors, so its size needs to be set carefully, generally considering some parameters such as concurrent session rate and session duration. If the heap setting is small, it can cause memory fragmentation, high recycling frequency, and application pauses and use the traditional flag cleanup method; if the heap is large, it takes a long time to collect. For the * solution, you generally need to refer to the following data:
1. Concurrent garbage collection information
two。 Number of concurrent collections of persistent generations
3. Traditional GC information
4. The proportion of time spent on recycling between the younger generation and the older generation
Reducing the time spent by the younger and older generations will generally improve the efficiency of the application.
◆ throughput priority applications: generally speaking, throughput priority applications have a large younger generation and a younger older generation. The reason is that most of the short-term objects can be recycled as much as possible, reducing the number of medium-term objects, while the older generation can store long-term living objects.
Fragmentation problem caused by smaller heap of JVM tuning
Because the older generation of concurrent collectors use marking and clearing algorithms, the heap is not compressed. When the collector collects, it merges adjacent spaces so that they can be allocated to larger objects. However, when the heap space is small, after running for a period of time, there will be "fragments". If the concurrent collector cannot find enough space, then the concurrent collector will stop and then recycle it using the traditional marking and clearing methods. If "fragmentation" occurs, you may need to configure as follows:
◆-XX:+UseCMSCompactAtFullCollection: enables compression of the older generation when using a concurrent collector.
◆-XX:CMSFullGCsBeforeCompaction=0: when the above configuration is enabled, how many times the FullGC is set here to compress the older generation
Thank you for reading this article carefully. I hope the article "sample Analysis of JVM tuning methods" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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: 235
*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.