In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to monitor the performance of an application in Java, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Parameter types of JVM
Standard parameter (Eg.)
-help
-server/-client
-version/-showversion
-cp/-classpath
X parameter (non-standardized parameter)
-Xint: interpreting and executing
-Xcomp: compile to native code the first time you use it
-Xmixed: mixed mode, where jvm decides whether or not to compile to native code
XX parameters (non-standard conversion parameters, relatively unstable, mainly used for JVM tuning and Debug)
Classification of XX parameters:
-Xmx/-Xms (actually the XX parameter) sets the maximum and minimum memory of JVM.-Xms is equivalent to-XX:InitialHeapSize,-Xmx is equivalent to-XX:MaxHeapSize.
-XX:+PrintFlagsInitial to view the initial values of JVM running parameters
-XX:+PrintFlagsFinal to view the final value of JVM running parameters (= for default value,: = for value modified by user or JVM)
-XX:+UnlockExperimentalVMOptions unlocking experimental parameters
-XX:+UnlockDiagnosticVMOptions unlock diagnostic parameters
-XX:+PrintCommandLineFlags print command line arguments
-XX:+HeapDumpOnOutOfMemoryError automatically Dump Heap Error when memory overflow occurs
-XX:HeapDumpPath=./ memory overflow HeapDump log,. / refers to the current running directory
Boolean type:-XX: [+ | -], for example:-XX:+UseConcMarkSweepGC
Non-Boolean type:-XX:= indicates that the value of the name attribute is value, for example:-XX:MaxGCPauseMillies=500
Jps
Jps can see all java processes by default
The-l parameter indicates that a specific Class is seen.
!!! All parameters need to be completed.
Jinfo
Jinfo-flag MaxHeapSize [pid] sees the value of the MaxHeapSize of the selected pid
Jinfo-flags [pid] sees all parameter values for the selected pid, both modified and unmodified
!!! All parameters need to be completed.
Jstat
Number of Loaded classes loaded
How many kBs are loaded by the Bytes class
Number of unloaded Unloaded classes
How many kBs has been uninstalled by the Bytes class
Total time spent loading and unloading Time classes
How many compilation tasks has Compiled completed (compiling a method to a local method)
Number of Failed compilation task failures
The number of times the Invalid compilation task is invalid
Total compilation time of Time
The compilation type of the last compilation failure of FailedType
The name of the class or method that failed in the last compilation of FailedMethod
Total amount and usage of S0C\ S1C\ S0U\ S1U S0 and S1
Total amount and usage of EC\ EU Eden area
Total amount and usage of OC\ OU Old area
Total amount and usage of MC\ MU Metaspace zones
CCSC\ CCSU compress the total amount and usage of class space
The number and time of YGC\ YGCT YoungGC
The number and time of FGC\ FGCT FullGC
Total GC time of GCT
You can view the following information:
All options:
-class to view class loading information. The usage jstat-class [pid] [interval millseconds] [count] represents the class loading information of pid that prints count times at intervals of interval milliseconds:
-compiler views JIT compilation information. Jstat-compiler [pid] [interval millseconds] [count] represents the JIT compilation information of pid that prints count times at intervals of interval milliseconds:
-gc to view garbage collection information. The usage jstat-gc [pid] [interval millseconds] [count] represents the gc information of pid that prints count times at intervals of interval milliseconds:
-gcutil
-gccause
-gcnew
-gcold
-printcompilation
!!! All parameters need to be completed.
Class loading information
Garbage collection information
JIT compilation information
Memory structure of JVM
Stack area: Young area (Servival area [S0+S1] + Eden area) + Old area. S0 and S1 are the same size. At the same time, S0 and S1 will only enable one.
Non-heap area (Metaspace): the local memory of the operating system, CCS area (exists after short pointers are enabled) + CodeCache area (where JIT code information is stored, and JNI code information is also here)
How to locate the memory overflow problem
Construct a memory overflow, for example, set-Xmx32M-Xms32M, construct a heap memory overflow, which only needs a constant new object; set-XX:MetaspaceSize=32M-XX:MaxMetaspaceSize=32M to construct a non-heap memory overflow, such as using less ASM to construct a Class file.
The difference between memory overflows
C++ memory overflow mainly refers to the loss of memory pointers, while Java memory overflow mainly refers to the non-release of objects that have been occupied.
Jmap
-dump: options have: live- only exports surviving objects, format=b- exports binary format, and file= represents the exported file.
You can export Heap logs manually
After reading the above, have you mastered how to monitor the performance of an application in Java? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.