Java program tuning analysis

1. JAVA program operation logic analysis

sample graph:

 Class Loader (Class Loader) : Responsible for loading the compiled .class bytecode file into memory so that the JVM can instantiate or otherwise use the loaded class. The class loader supports dynamic loading at runtime, which can save memory space and load classes flexibly from local or network

Method area/metadata area:

  • The method area is what we often call the permanent generation area, which stores data such as Java class information, constant pools, and static variables. The memory area occupied by the method area is shared by threads in the JVM.
  • In JDK1.8 and later versions, the method area has been removed and replaced by the metadata area and local memory, and the metadata information of the class is directly stored in the local memory managed by the JVM. It should be noted that the local memory is not part of the virtual machine runtime data area, nor is it a memory area defined in the Java Virtual Machine Specification. Data such as constant pools and static variables are stored in the Java heap (Heap).

Java virtual machine stack/local method stack/program counter: thread-private, directly related to thread running code

Heap area:

  • Java is an object-oriented programming language, and the JVM heap area is the memory area that actually stores Java object instances.
  • The size of the heap is not equal to the JVM can store so much data at the same time, because garbage collection is required

2. JVM resource monitoring tool

1. jps & jcmd command

jps, jcmd tools in JDK

おすすめ

転載: blog.csdn.net/qq_38571773/article/details/128273203