In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what the java diagnostic tools are, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Command line tool
Jstat command for the JDK tool
-class: displays information about ClassLoad
-compiler: displays information about JIT compilation
-gc: displays heap information related to gc
-gccapacity: displays the capacity and usage of each generation
-gcmetacapacity: displays the size of the Metaspace
-gcnew: displays the new generation information
-gcnewcapacity: displays the size and usage of the new generation
-gcold: displays information about the old age and the permanent generation
-gcoldcapacity: shows the size of the old age
-gcutil: displays garbage collection information
-gccause: displays information about garbage collection (through-gcutil), as well as the incentives for the last or current garbage collection
-printcompilation: outputs the method information compiled by JIT.
It has a lot of functions, and here I'll give an example of how to use jstat to view the usage of heap memory. We can use jstat-gc pid to see:
S0C: the capacity of To Survivor in the younger generation (in KB)
S1C: the capacity of From Survivor in the younger generation (in KB)
S0U: To Survivor of the younger generation currently uses space (in KB)
S1U: From Survivor in the younger generation currently uses space (in KB)
EC: the capacity of Eden in the younger generation (in KB)
EU: Eden of the younger generation currently uses space (in KB)
Capacity of the OC:Old generation (in KB)
Space currently used by the OU:Old generation (in KB)
Capacity of MC:Metaspace (in KB)
MU:Metaspace currently uses space (in KB)
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: the total time (s) that the gc took from application startup to sampling.
Jstack command for the JDK tool
Jps command or top command to check which pid occupies a high cpu, and then check the thread Id through top-Hp pid
The jstack pid command looks at the stack status of the current java process.
Convert the pid to a hexadecimal value. Each thread in the thread dump has a nid, and you can find the corresponding nid. Execute the stack command to get the thread dump again at intervals to distinguish whether there is any difference between the two dump.
Jmap of the JDK tool:
Command: jmap-heap pid description: display Java heap details
Command: jmap-histo:live pid description: displays statistics for objects in the heap
Command: jmap-clstats pid description: print classloader information
Command: jmap-dump:format=b,file=heapdump.phrof pid description: generate a heap dump snapshot dump file. You can use the MemoryAnalyzer tool to analyze dump files.
Graphical tool
Jvisualvm,JConsole
1. Enable jms on server tomcat, and modify the configuration file catalina.sh as follows:
Export JAVA_OPTS= "- Xms256m-Xmx512m-Xss256m-XX:PermSize=512m-XX:MaxPermSize=1024m-Djava.rmi.server.hostname=136.64.45.24-Dcom.sun.management.jmxremote.port=9315-Dcom.sun.management.jmxremote.ssl=false-Dcom.sun.management.jmxremote.authenticate=false"
Basically includes the following basic functions: Overview, memory, threading, classes, VM profile, MBean
GCViewer tool
Use the jps command to see which java processes are currently running and find the process pid of the java program we want to view
Using the command jinfo pid to view the java information for this process, you can see that there is probably a parameter at the bottom-Xloggc:, which corresponds to the location of the gc log.
Open gc log with gcviewer to view gc log intuitively
MemoryAnalyzer tool
Used to analyze dump files, mainly used to analyze memory leaks and other problems.
What are the java diagnostic tools to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.