Java garbage collection monitoring method and terminal

A technology for monitoring terminals and garbage, applied in the field of Java programming, can solve problems such as unavailability, insufficient system resources, impact on system availability, etc., and achieve the effect of intelligent monitoring

Active Publication Date: 2021-05-07
FUJIAN TIANQUAN EDUCATION TECH LTD
View PDF8 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] In actual usage scenarios, under most normal circumstances, the software can run stably, but when certain conditions are met or triggered, such as frequently creating and discarding objects within a period of time, the virtual machine will cause a large number of GCs; At this time, because the JVM is busy with garbage collection (GC), it will cause insufficient system resources, which will have a great impact on the availability of the system; when the problem persists, due to insufficient system resources, the JVM will perform more GC operations and enter The vicious cycle leads to instability or unavailability of the system as a whole; after this problem occurs, the JVM spends most of its time and resources in GC and cannot process business. However, the actual JVM still survives in this scenario, which is different from downtime or The death of an instance is similar to a scenario where a software program is dead. Because the instance is not dead or down, the business can be processed intermittently at this time, but a large number of businesses cannot be processed normally. There is no intelligent way to deal with it, and it can only rely on business or operation and maintenance personnel to find problems, and manual repairs are required to solve them

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Java garbage collection monitoring method and terminal
  • Java garbage collection monitoring method and terminal

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0067] Please refer to figure 1 , Embodiment 1 of the present invention is:

[0068] A method for monitoring Java garbage collection, comprising steps:

[0069] S1. Obtain the business execution time and GC execution time within a GC cycle in the JVM;

[0070] Set a business execution and a GC execution that are adjacent to each other as a GC cycle; under normal circumstances, the GC execution time in each GC cycle will be within a certain range. If there is an exception, the GC execution time will be longer big increase;

[0071] In an optional implementation manner, the IP address of an application in the JVM and the service execution time and GC execution time within a GC cycle are obtained;

[0072] S2. Judging whether the GC cycle is normal according to the business execution time and the GC execution time, if not, recording the GC execution time into the GC cumulative time, specifically:

[0073] S21. Determine the business execution time weighting parameter accordin...

Embodiment 2

[0087] Apply the above-mentioned Java garbage collection monitoring method to actual scenarios:

[0088] S1. Obtain the business execution time of 9.8s and the GC execution time of 0.2s within a GC cycle of an application in the JVM; the initial cumulative GC time is 0;

[0089] S2. Calculate 0.2 / 9.8=1 / 49, obtain the preset multiple of 5, then 1 / 49×5 obtains the business execution time weighted parameter 5 / 49;

[0090] In an optional implementation manner, the int type is used to store the weighted parameters of the service execution time;

[0091] 9.8×5 / 49 get the weighted business execution time 1s;

[0092] 1s>0.2s, the GC cycle is normal, and the GC cumulative time remains 0;

[0093] S3. The preset judgment period is 24 hours. During the judgment period, the business execution time of the GC cycle and the GC execution time are continuously obtained, and it is judged whether the accumulated GC time exceeds the threshold of 30s within 24 hours. If so, it is judged that th...

Embodiment 3

[0097] Please refer to figure 2 , Embodiment three of the present invention is:

[0098] A Java garbage collection monitoring terminal 1, comprising a processor 2, a memory 3 and a computer program stored on the memory 3 and operable on the processor 2, the processor 2 implements the embodiment when executing the computer program Each step in one or embodiment two.

[0099]To sum up, the present invention provides a Java garbage collection monitoring method and terminal, which can monitor the business execution time and GC execution time in a GC cycle of different applications respectively, and use an adjacent business execution and a GC execution as the A GC cycle can subdivide the overall monitoring of the system into monitoring whether abnormalities occur in each time period, that is, to judge whether the weighted business execution time is greater than the GC execution time, if so, it means that the GC cycle is abnormal, and the GC execution time is reduced The de-weigh...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a Java garbage collection monitoring method and a terminal. The method comprises the following steps: acquiring service execution time and GC execution time in a GC period in a JVM (Java Virtual Machine); judging whether the GC period is normal or not according to the service execution time and the GC execution time, and if not, recording the GC execution time into GC accumulated time; judging whether the GC accumulated time exceeds a threshold value or not is judged, and if so, judging that the JVM state is abnormal, and intervening the JVM; The invention has the advantages that the comparison of the service execution time and the GC execution time in the GC period is taken as a judgment standard for judging whether the abnormality occurs in the GC period, the GC accumulation time is set, and the JVM is judged to be abnormal when the GC accumulation time also exceeds the threshold value, so that the automatic detection and processing of excessive GC resource occupation but no downtime of the JVM can be realized,. And intelligent monitoring of the GC is realized.

Description

technical field [0001] The invention relates to the field of Java programming, in particular to a Java garbage collection monitoring method and a terminal. Background technique [0002] There are many kinds of server-side applications today, and there are also many languages ​​for writing these applications. The more common languages ​​are Java, c, c++, etc.; because of Java’s cross-platform and openness, in order to achieve compatibility on multiple platforms, all projects using Java need to install its virtual machine (JVM). There is Java's GC (garbage collection mechanism) function, that is, when the heap memory used by the program is insufficient, the virtual machine will start GC to reclaim useless memory, which can restore the occupied memory to an idle state for subsequent applications. [0003] In actual usage scenarios, under most normal circumstances, the software can run stably, but when certain conditions are met or triggered, such as frequently creating and dis...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & AuthorityApplications(China)
IPC IPC(8): G06F9/455G06F11/30
CPCG06F9/45558G06F11/301G06F2009/45583G06F2009/45591Y02D10/00
Inventor刘德建林伟郭玉湖陈宏
OwnerFUJIAN TIANQUAN EDUCATION TECH LTD