Help Center> > User Guide >JVM Monitoring

JVM Monitoring

JVM monitoring displays the memory and thread of the JVM running environment based on Java applications. You can monitor metric trends in real time for performance analysis.

On the Memory and Thread tab pages, you can view the memory and thread graphs to quickly locate problems such as memory leakage and thread exceptions.

Description of the JVM Monitoring Page

Figure 1 JVM monitoring page

Memory Graphs

As shown in Figure 2, in a selected time range, the trends of the maximum, committed, and used memory in different JVM memory spaces (such as the total memory, heap memory, and non-heap memory spaces) of an instance are displayed. In addition, the Garbage Collection (GC) duration and times are also displayed.

Figure 2 Memory graphs

JVM memory

JVM memory consists of heap and non-heap memory.

  • Heap memory: A heap is the data area where the JVM is running. It allocates memory for all instances and arrays. Heap memory of objects is reclaimed by the automatic memory management system called garbage collector. Heap space consists of eden space, survivor space, and tenured space.
  • Non-heap memory: Memory (excluding heap memory) managed by JVM. Non-heap space consists of code cache, and permanent space (or meta space).

Java heap is the main area managed by the garbage collector. It is also called garbage collection heap. GC mode includes full GC and minor GC.

Table 1 Memory space

Name

Description

Eden space

Initially allocates memory from the thread pool to most objects.

Survivor space

Stores the eden space's objects that are not reclaimed during GC.

Tenured space

Maintains the objects which have been stored in the survivor space for a period of time.

Code cache

Compiles and stores local codes.

Permanent space

Stores static data of VMs, for example, class and method objects.

Meta space

Stores local class metadata. In versions later than Java 8, permanent space is replaced by meta space.

Full GC

GC performed in the entire heap space (covering young, old, and permanent generations) when the memory space does not meet allocation requirements after memory reclamation.

Minor GC

GC performed in the young-generation space (including eden space and survivor space) when the allocated memory is insufficient.

JVM collects garbage based on generations. JVM heap space is divided into old- and young-generation space. 90% or more objects that exist only for a short period of time are stored in the young-generation space, while objects that have long life cycles are stored in the old-generation space. Young-generation space is further divided into eden space and two survivor spaces. New objects are initially allocated to the eden space, and survivor space is used as the buffer between eden space and tenured space. Objects that are survived after several rounds of GC in the survivor space are then transferred to the old-generation space, as shown in Figure 3.

Figure 3 Memory spaces
NOTE:

There are two survivor spaces, which are represented by from and to pointers. The to pointer points to the empty survivor space.

Thread Graphs

As shown in Figure 4, in a selected time range, the trends of total threads, sticky threads, dedicated threads, and other trends are displayed.

Figure 4 Thread graphs
Table 2 Threads

Name

Description

Total threads

Total number of threads, including active threads and standby threads. Sticky threads and dedicated threads become standby threads after being executed.

Deadlock thread

When two or more threads encounter resource conflicts or abnormal communication, the system enters the deadlock state.

Sticky thread

If the time taken to process a request by a thread exceeds the preset maximum time, the thread is called a sticky thread.

Dedicated thread

If the time taken to process a request by a thread exceeds the normal execution time but does not exceed the maximum time of a sticky thread, the thread is called a dedicated thread.

Total executed threads

Number of threads that are being executed, including sticky threads, dedicated threads, and normal threads.

Active thread

Number of active threads, including idle threads and threads that are being executed.

Idle thread

Number of idle threads. When there is no task, a thread is in the idle state. When receiving a request, the thread pool assigns an idle thread to the request. After the task is completed, the thread returns to the thread pool and waits for another task.

Adding a Threshold Rule

You can add threshold rules for all JVM memory and thread metrics. When the rules are met, alarms are reported, altering you to risks.

  1. On the JVM Monitoring page, select an application in the upper left corner, and then select an instance.
  2. In the trend graph of a memory or thread metric on the right, set a threshold rule. Specifically, click Add Threshold Rule in the upper right corner.

  3. Set rule parameters and click Submit, as shown in the following figure. If you want to receive alarm notifications, select Yes when setting Send Notification and then select a topic.