“This is my second day of the Gwen Challenge.More article challenges”

JVM performance monitoring and tuning (JVM performance monitoring and tuning) is an overview of JVM performance monitoring and tuning.

An overview,

  1. Performance diagnosis is a problem that software engineers often face and solve in their daily work. In today’s user-experience oriented world, solving performance problems of applications can bring great benefits.
  2. As one of the most popular programming languages, Java application performance diagnosis has been widely concerned in the industry. There are many factors that can cause performance problems in Java applications, such as thread control, disk reads and writes, database access, network I/O, garbage collection, and so on. To locate these problems, a good performance diagnostic tool is essential.
  3. We slowly understand, is not such a truth: ① use data to explain the problem, use knowledge to analyze the problem, use tools to deal with the problem. ② No monitoring, no tuning! Ha ha ha, don’t always raise tuning, no monitoring how tuning!!
  4. When we first touch Java learning, we must first understand the two commands are javac, Java, so in addition, there are other commands for us to use? We went to the bin directory where we installed the JDK and found a series of helper tools. These accessibility tools are used to capture different aspects and levels of information about the target JVM to help developers troubleshoot Java applications. Refer to the link for details.

JPS (View running Java processes)

JPS can be used with some options. The most common ones are as follows:

-q: Only LVMID (Local Virtual Machine ID) is displayed. -l: displays the full class name of the application's main class or the full jar path if the process executes a JAR package. -m: displays the parameters passed to the main() class when the vm process startsCopy the code

Jstat (view JVM statistics)

1. View the parameters of the command

Jstat -h or jstat -help

2. The option can be composed of the following values

2.1 Class loading related

-class: displays ClassLoader information, such as the loading and unloading quantity of classes, total space, and time consumed by class loading

2.2 Garbage collection related

-gc: displays heap information related to GC. Including Eden area, two Survivor areas, old age, permanent generation capacity, used space, GC time total and other information.

-gcCapacity: displays the same content as -gc, but the output focuses on the maximum and minimum space used by each area of the Java heap.

-gcutil: Displays basically the same content as -gc, but the output focuses on the percentage of the total space used.

-gCCause: Has the same function as -gcutil, but outputs an additional cause of the last or currently occurring GC.

– gcNew: displays the GC status of the new generation

-gcnewCapacity: displays the same content as -gcnew. The output focuses on the maximum and minimum space used

-geold: displays the GC status of the old age

-gcoldCapacity: displays the same content as -gcold. The output focuses on the maximum and minimum space used

– gcpermCapacity: displays the maximum and minimum capacity used by the permanent generation.

2.3 JIT related

– Compiler: Displays the compiled methods and time used by the JIT compiler

-printcompilation: Outputs methods that have been JIT compiled

3. Focus on the -GC option

3.1 Cenozoic Correlation

  • S0C is the size of the first survivor area (in bytes)
  • S1C is the size of the second survivor area (in bytes)
  • S0U is the size used by the first survivor area (in bytes)
  • S1U is the size used by the second survivor area (in bytes)
  • EC is the size of Eden space (in bytes)
  • EU is the used size of Eden space (bytes)

3.2 Old age correlation

  • OC is the size of the old age (bytes)
  • OU is the size (bytes) that was used in the old age

3.3 Method area (meta-space) correlation, for JDK8 and later

  • MC is the size of the method area
  • MU is the used size of the method area
  • CCSC is the size of the compressed class space
  • CCSU is the size used to compress the class space

3.4 other

  • YGC is the number of young GC counts from the start of the application to the time of sampling
  • YGCT is the time (in seconds) consumed by young GC from application startup to sampling time
  • FGC is the number of full GC counts from the start of the application to the time of sampling
  • FGCT is the time (in seconds) consumed by full GC from application startup to sampling time
  • GCT is the total time from application startup to GC at sampling time

Jinfo (Real-time viewing and modifying JVM configuration parameters)

1. Basic introduction

Configuration Info (jinfo for Java) Displays vm Configuration parameters and can be used to adjust vm Configuration parameters.

In many cases, Java applications do not specify all Java virtual machine parameters. At this point, the developer may not know the default value of a specific Java virtual machine parameter. In this case, you might need to look up the document to get a default value for a parameter. This search process can be very difficult. But with the JInfo tool, developers can easily find the current values of Java virtual machine parameters.

2. Check the

2.1 jinfo – sysprops PID

You can view the parameters obtained by System.getProperties()

2.2 jinfo – flags PID

Look at some parameters that have been assigned, more used.

2.3 jinfo-flag Indicates the PID parameter

View the values of specific parameters for a Java process

3. Modify

3.1 For Boolean types

Jinfo – flag [+ | -] specific parameters of the PID

3.2 For non-Boolean types

Jinfo-flag Parameter = parameter value PID

4. The extension

4.1 Java – XX: + PrintFlagsInitial

View the initial startup values for all JVM parameters

4.2 Java – XX: + PrintFlagsFinal

View the final values of all JVM parameters

4.3 Java – XX: + PrintCommandLineFlags

View the names and values of the detailed XX parameters that have been set by the user or JVM

5. To summarize

Jmap, jhat, jstack, JCMD, jMAP, jhat, JCMD, jMAP, jHAT, jSTACK, JCMD, jMAP, jMAP, jHAT, JCMD, jMAP, jMAP, jHAT, JCMD, jMAP, jMAP, JCMD, jMAP, jMAP, jHAT, jSTACK, JCMD

Welcome everyone to pay attention to the public account (MarkZoe) to learn from each other and communicate with each other.