In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "how to troubleshoot too high old in Jvm", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to troubleshoot excessive old in Jvm".
Preface
Recently, we encountered a case in which the Jvm old is too high. The phenomenon is that the jvm old area of a site is too high. The reason is that there is something wrong with the original design. The data returned to the front end contains a lot of html code. The process of getting data from storage and stitching data is too long, resulting in a large number of objects' life cycle is too long, objects are marked in the old, resulting in the old area is too high. The monitoring system has made an alarm, and the detailed reasons will not be analyzed in detail. We will mainly share the process of troubleshooting.
Received the alarm from the monitoring system and queried the jvm memory on the server.
Jstat-gcutil pid interval, you can print the memory of jvm by interval, for example:
Jstat-gcutil 30922 1000
Memory condition of jvm process 30922
In a nutshell, what is the meaning of these things:
S0: percentage of current capacity that has been used by the first survivor (survival area) in the younger generation
S1: percentage of current capacity used by the second survivor (survival area) in the younger generation
E: percentage of current capacity used by Eden (Garden of Eden) among younger generations
O: percentage of current capacity used by old generation
P: percentage of current capacity used by perm generation
YGC: the number of gc in the younger generation from application startup to sampling
YGCT: the time taken by gc in the younger generation from application startup to sampling (s)
FGC: the number of old generation (full gc) gc from application startup to sampling
FGCT: time taken by old to replace (full gc) gc from application startup to sampling (s)
GCT: total time taken by gc from application startup to sampling (s)
From the perspective of memory, S0 and Eden have been filled up, and old has been filled up. Excluding the situation that too many large object instances directly fill up the old, continue to analyze.
View the jvm parameters launched by the application
-Xms2g-Xmx2g-Xmn1g-Xss1024K-XX:PermSize=256m-XX:MaxPermSize=512m-XX:ParallelGCThreads=8-XX:+UseConcMarkSweepGC-XX:+UseParNewGC-XX:+UseConcMarkSweepGC-XX:+UseCMSCompactAtFullCollection-XX:SurvivorRatio=4-XX:MaxTenuringThreshold=10-XX:CMSInitiatingOccupancyFraction=80
Tell me the meaning of the two parameters.
XX:SurvivorRatio=4, this parameter means the ratio of the two zones of Survivor to the new generation. Set to 4 means that the ratio of the two zones to the new generation is 2. 4. MaxtenuringThreshold10. This parameter means how many times the object is marked as an old object. In the old age, setting it to 10 means that the new generation object has not been marked for 10 times before it is released. From the point of view of the parameters, The reason for the excessive alarm in the old area is that some objects have been marked 10 times but not released in the new generation, and have been put into the old age, resulting in the old age is too old and the FGC frequency is too high.
After the advice of a friend, there is a problem with the analysis of this area, and keep the analysis of the problem, and then post the friend's analysis and compare it.
Dynamic object age determination: in order to better adapt to different degrees of memory conditions, the virtual machine does not always require that the age of the object must reach the MaxTenuringThreshold in order to be promoted to the old age. If the total size of all objects of the same age in the Survivor space is more than half of the Survivor space, the objects whose age is greater than or equal to the age can directly enter the old age without waiting for the required age in the MaxTenuringThreshold.
The guidance of a friend
Export dump files and view them using jvisualvm.exe
The process of exporting dump files will not be detailed, but simply paste the command.
Jmap-dump:format=b,file=serviceDump.dat pid
Jvisualvm is a memory analysis tool that comes with jdk, which is generally located in the jdk installation directory:
C:\ Program Files\ Java\ jdk1.8.0_141\ bin\ jvisualvm.exe
Jvisualvm tool interface
Select the exported dump file here to view the number and size of instances of classes in memory
View the number of instances of a class
It is found that the three instances of Char [] and String,HashMap are the most in jvm, accounting for 31%, 30.9% and 30.2% respectively, accounting for a total of 92.1%. The size of instances accounts for 35.8%, 14.6% and 22.4% respectively, accounting for a total of 72.8%. The main reason is that the instances of these three categories take up too much memory.
View instance information of Char []
Click go to view the instance information of Char [], in order from large to small
Some examples are much larger than others.
Look at the largest of these instances and find that the contents of these instances are
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.