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)05/31 Report--
The knowledge points of this article "what are the tools for virtual machine performance monitoring and fault handling" are not quite understood by most people, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article, let's take a look at this "virtual machine performance monitoring and fault handling tools" article.
Commercial authorization tools: mainly JMC (Java Mission Control) and JFR (Java FlightRecorder) to be used. JMC, an operation and maintenance monitoring suite originally from JRockit, has been integrated into OracleJDK since JDK 7 Update 40. JDK 11 does not need to be downloaded independently before, but it is paid to use it in a commercial environment [1].
Jps: virtual machine process status tool
Jstat: virtual machine statistics monitoring tool
Jstat (JVM Statistics Monitoring Tool) is a command-line tool for monitoring various running status information of virtual machines. It can display class loading, memory, garbage collection, instant compilation and other runtime data in local or remote [1] virtual machine processes. It will be a common tool for locating virtual machine performance problems at run time on servers that have no GUI graphical interface and only provide a plain text console environment.
Jstat [option vmid [intervals | ms] [count]]
The parameters interval and count represent the query interval and number of times. If you omit these two parameters, you can only query once. Assuming that you need to query the process 2764 garbage collection status every 250ms for a total of 20 queries, the command should be:
Jstat-gc 2764 25020 is very useful
The option option represents the virtual machine information that the user wants to query, and is mainly divided into three categories: class loading, garbage collection, and runtime compilation status. Please refer to the description in Table 4-2 for details.
Jstat-gcutil 2764
S0 S1 E O P YGC YGCT FGC FGCT GCT
0.00 0.00 6.20 41.42 47.20 16 0.105 3 0.472 0.577
Jstat-class 7216 / / View class load time
Loaded Bytes Unloaded Bytes Time
7902 9691.2 3 2.6 4.34
The query results show that the server's new generation Eden area (E, for Eden) uses 6.2% of the space, two Survivor zones (S0, S1, for Survivor0, Survivor1) are empty, and the old age (O, for Old) and permanent generation (P, for Permanent) use 41.42% and 47.20% of the space, respectively. Since the program was run, Minor GC (YGC, for YoungGC) has occurred 16 times, with a total time of 0.105 seconds; Full GC (FGC, for Full GC) has occurred for 3 times, with a total time (FGCT, for Full GCTime) of 0.472 seconds; and all GC has a total time (GCT, for GCTime) of 0.577 seconds.
Jinfo:Java configuration information tools are not commonly used
The role of jinfo (Configuration Info for Java) is to view and adjust the parameters of the virtual machine in real time. Use the-v parameter of the jps command to view the list of parameters explicitly specified when the virtual machine starts, but if you want to know the system default values of parameters that are not explicitly specified, you can only use the-flag option of jinfo to query in addition to looking for information. (if it is limited to JDK 6 or above, using java-XX:+PrintFlagsFinal to view parameter default values is also a good choice). Jinfo can also use the-sysprops option to print out the contents of the virtual machine process's System.getProperties (). This command was issued with the Linux version of JDK in JDK 5. At that time, only the information query function was provided. After JDK 6, jinfo is available on both Windows and Linux platforms, and adds the ability to modify some parameter values at run time (you can use-modify [+ | -] name or-flag name=value to modify some run-time writable virtual machine parameter values at run time). In JDK 6, jinfo still has considerable limitations on the functionality of the Windows platform, providing only the most basic-flag option.
Jinfo [option] pid
Execution example: query CMSInitiatingOccupancyFraction parameter values
Jinfo-flag CMSInitiatingOccupancyFraction 1444
-XX:CMSInitiatingOccupancyFraction=85
Jinfo-flag SurvivorRatio 12844
-XX:SurvivorRatio=8
Jinfo-sysprops 6952
Use the-sysprops option to print the contents of the System.getProperties () of the virtual machine process
Jmap:Java memory Mapping tool
The jmap (Memory Map for Java) command is used to generate heap dump snapshots (commonly referred to as heapdump or dump files). If you do not use the jmap command, there are some more "violent" ways to obtain Java heap dump snapshots: for example, the-XX:+HeapDumpOnOutOfMemoryError parameter used in Chapter 2 allows the virtual machine to generate heap dump snapshot files automatically after the memory overflow exception occurs, and the-XX:+HeapDumpOnCtrlBreak parameter allows the virtual machine to generate heap dump snapshot files using the [Ctrl] + [Break] key. Or in the Linux system through the Kill-3 command to send the process exit signal to "intimidate" the virtual machine, you can also get the heap dump snapshot smoothly.
The role of jmap is not just to take a snapshot of the heap dump, it can also query the details of the finalize execution queue, Java heap, and method zone, such as space usage, which collector is currently being used, and so on.
Jmap [option] vmid
Jmap-dump:format=b,file=eclipse.bin 3500
Dumping heap to C:\ Users\ IcyFenix\ eclipse.bin...
Heap dump file created
Jhat: virtual machine heap dump snapshot analysis tool
JDK provides the jhat (JVM Heap Analysis Tool) command with jmap to analyze the heap dump snapshots generated by jmap. Jhat has a built-in miniature HTTP/Web server that can be viewed in a browser after generating the analysis results of the heap dump snapshot. But to be honest, in practice, most people don't directly use the jhat command to analyze heap dump snapshot files unless there are really no other tools available.
Heap dump snapshots are generally not analyzed directly on the server where the application is deployed.
Another reason is that the analysis function of jhat is relatively simple. VisualVM, as well as professional tools such as Eclipse Memory Analyzer and IBM HeapAnalyzer [2] for analyzing heap dump snapshot files, which will be introduced later, can achieve more powerful and professional analysis functions than jhat.
The analysis results are grouped and displayed in packages by default. Analyzing memory leakage problems mainly uses the functions of "HeapHistogram" (like jmap-histo) and OQL tabs. The former can find the objects with the largest total capacity in memory, while the latter is a standard object query language. It uses a syntax similar to SQL to query and count objects in memory.
Jmap-dump:format=b,file=D:/dump.log 15220
Jhat dump.log is accessed through localhsot:7000
Jstack:Java stack trace tool
The jstack (Stack Trace for Java) command is used to generate a thread snapshot of the current moment of the virtual machine (commonly referred to as the threaddump or javacore file). A thread snapshot is a collection of method stacks that each thread is executing in the current virtual machine. The purpose of generating a thread snapshot is usually to locate the causes of thread pauses for a long time, such as deadlocks between threads, deadloops, long-time suspensions caused by requests for external resources, etc., are all common causes of thread long-term pauses.
Jstack [option] vmid
Jstack-l 15220
Summary of basic tools
Performance monitoring and troubleshooting tools
Visual fault handling tool
VisualVM was first released in JDK 6 Update 7. Until the completion of the integration of JRockit Mission Control and OracleJDK, it was an all-in-one fault handling tool driven by Oracle. Now it has been separated from OracleJDK and become an independent open source project [2]. VisualVM is no longer a full member of JDK, but it can still be downloaded and used for free.
JHSDB: a debugging tool based on Service Agent
In higher versions of JDK, most of these tools have more powerful alternatives, such as the command line mode of JCMD and JHSDB
Jhsdb does not exist in java8.
Enter the graphical mode of JHSDB and attach process 11180 using the following command:
Jhsdb hsdb-pid 11180
Https://rednaxelafx.iteye.com/blog/1847971
The same program generally consumes more memory in 64-bit virtual machines than 32-bit virtual machines, which is due to pointer expansion, data type alignment, whitening and other factors, which can be alleviated by turning on (by default) the compression pointer function.
Applications that use a large number of local caches (such as using HashMap as the KCMG V cache) will cause a large amount of memory waste in the logical cluster because there is a cache on each logical node, so you can consider changing the local cache to a centralized cache.
The execution of this Shell script is called through the Runtime.getRuntime (). Exec () method of Java. This invocation method can achieve the purpose of executing the Shell script, but it is a very resource-consuming operation in the Java virtual machine. Even if the external command itself can be executed quickly, the overhead of creating the process when called frequently will be considerable. The Java virtual machine executes this command by first copying a process that has the same environment variables as the current virtual machine, then using the new process to execute external commands, and finally exiting the process. If this operation is performed frequently, the system is bound to consume a lot, not only the processor consumption, but also a heavy memory burden.
Considering the actual situation, Eclipse has a large number of users, and its compiled code can be considered safe and reliable, and there is no need for bytecode verification when it is loaded, so the bytecode verification process is prohibited through the parameter-Xverify:none as an optimization measure. With the addition of this parameter, the loading speed of both versions of JDK classes has been improved.
Eclipse tuning
-vm
D:/_DevSpace/jdk1.6.0_21/bin/javaw.exe
-startup
Plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-- launcher.library
Plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
Org.eclipse.epp.package.jee.product
-showsplash
Org.eclipse.platform
-vmargs
-Dcom.sun.management.jmxremote
-Dosgi.requiredJavaVersion=1.5
-Xverify:none
-Xmx512m
-Xms512m
-Xmn128m
-XX:PermSize=96m
-XX:MaxPermSize=96m
-XX:+DisableExplicitGC
-Xnoclassgc
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=85
The above is the content of this article on "what are the tools for virtual machine performance monitoring and fault handling". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
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.