Exception handling method and device based on garbage collection log

文档序号:1952374 发布日期:2021-12-10 浏览:29次 中文

阅读说明:本技术 一种基于垃圾回收日志的异常处理方法及装置 (Exception handling method and device based on garbage collection log ) 是由 熊晓斌 张照猛 于 2021-11-10 设计创作,主要内容包括:本发明公开了一种基于垃圾回收日志的异常处理方法及装置,其中所述方法包括:根据预设的GC日志的生成参数,生成GC日志并存储至预设路径;在预设路径中读取所述GC日志,并从GC日志中提取待分析数据;其中,待分析数据用于进行异常分析;将待分析数据输入预设的识别模型进行识别,获得异常分析结果;根据异常分析结果,对JVM参数进行调优。本发明方法及装置可能综合利用所有待分析数据,避免人工识别时仅仅考虑内存使用情况,而无法识别出JVM高负载的异常。因此,本实施例的方法提高了异常识别的准确性和效率。(The invention discloses an exception handling method and device based on a garbage collection log, wherein the method comprises the following steps: generating a GC log according to a preset GC log generation parameter and storing the GC log to a preset path; reading the GC log in a preset path, and extracting data to be analyzed from the GC log; wherein, the data to be analyzed is used for carrying out anomaly analysis; inputting data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result; and adjusting and optimizing the JVM parameters according to the abnormal analysis result. The method and the device can comprehensively utilize all the data to be analyzed, and avoid the problem that the JVM high-load abnormity cannot be identified only by considering the use condition of the memory during manual identification. Therefore, the method of the embodiment improves the accuracy and efficiency of the abnormality identification.)

1. An exception handling method based on a garbage collection log is characterized by comprising the following steps:

generating a GC log according to a preset GC log generation parameter and storing the GC log to a preset path;

reading the GC log in the preset path, and extracting data to be analyzed from the GC log; wherein, the data to be analyzed is used for carrying out anomaly analysis;

inputting the data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result;

and adjusting and optimizing JVM parameters according to the abnormal analysis result.

2. The method according to claim 1, wherein before inputting the data to be analyzed into a preset recognition model for recognition and obtaining an abnormal analysis result, the method further comprises:

acquiring historical data to be analyzed; the historical data to be analyzed is data extracted from a historical GC log;

calibrating an abnormal result for the historical data to be analyzed;

and inputting the historical data to be analyzed and the abnormal result into a preset initial model for training to obtain a recognition model.

3. The method according to claim 1, wherein the abnormal analysis result is that the pause time caused by the too fast new generation lifting is too long; the adjusting and optimizing the JVM parameters according to the abnormal analysis result comprises the following steps:

acquiring recovery frequency corresponding to the abnormal analysis result;

according to the recovery frequency, increasing the space of the new generations and increasing the promotion threshold of the new generations.

4. The method of claim 3, wherein the tuning JVM parameters according to the anomaly analysis result further comprises:

if the new generation space reaches the maximum, judging whether the old generation occupation ratio reaches a preset ratio threshold value; the proportion threshold is determined by the computing throughput of the system and the problem occurrence frequency, wherein the problem occurrence frequency is the frequency of overlong pause time caused by too fast new generation lifting;

if so, the CMS garbage collector is started.

5. The method according to claim 1, wherein the abnormal analysis result is that the pause time caused by fragmentation of the aged generation is overlong; the adjusting and optimizing the JVM parameters according to the abnormal analysis result comprises the following steps:

acquiring recovery frequency corresponding to the abnormal analysis result;

and increasing the space of the elderly generations according to the recovery frequency and the space release size after Full GC recovery.

6. The method of claim 1, wherein the anomaly analysis result is a memory leak; the adjusting and optimizing the JVM parameters according to the abnormal analysis result comprises the following steps:

releasing references to garbage objects; where the referenced variable is reset to null upon exiting the active domain.

7. An exception handling apparatus based on a garbage collection log, comprising:

the log acquisition module is used for generating a GC log according to a preset GC log generation parameter and storing the GC log to a preset path;

the data extraction module is used for reading the GC log in the preset path and extracting data to be analyzed from the GC log; wherein, the data to be analyzed is used for carrying out anomaly analysis;

the identification module is used for inputting the data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result;

and the optimization module is used for adjusting and optimizing the JVM parameters according to the abnormal analysis result.

8. The device of claim 7, further comprising a model training module, configured to, before the data to be analyzed is input into a preset recognition model for recognition and an abnormal analysis result is obtained:

acquiring historical data to be analyzed; the historical data to be analyzed is data extracted from a historical GC log;

calibrating an abnormal result for the historical data to be analyzed;

and inputting the historical data to be analyzed and the abnormal result into a preset initial model for training to obtain a recognition model.

9. An electronic device comprising a processor and a memory coupled to the processor, the memory storing instructions that, when executed by the processor, cause the electronic device to perform the steps of the method of any of claims 1-6.

10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.

Technical Field

The invention relates to the technical field of computer software, in particular to an exception handling method and device based on a garbage collection log.

Background

In the daily software development process, the exception is inevitably handled. In enterprise-level Java development, we sometimes encounter the following problems: memory overflow, memory starvation, memory leak, thread deadlock, lock contention, Java process consumption CPU too high, and the like. The memory managed by the JVM (Java Virtual Machine) roughly includes three different types of memory regions: permanent Generation space, Heap space, Java Stacks. The permanent storage area mainly stores information of Class and Meta, the Class is placed in a PermGen space area when being loaded for the first time, and contents needing to be stored by the Class mainly comprise methods and static attributes. The heap area is used for storing an instance of a Class, namely an object; the content that the object needs to store is mainly a non-static attribute. After each time an object instance is created in new, the object instance is stored in the heap area, and this space is also managed by the garbage collection mechanism of the JVM. The Java stack is similar to the stack function of most programming languages, including assembly languages, and has main basic type variables and input/output parameters of methods. Each thread of the Java program has a separate stack. Memory space in which memory overflow problems are likely to occur includes: permanent Generation space and Heap space.

The JVM automatically triggers garbage collection due to the action of a GC (garbage collection) mechanism, that is, when the memory of the JVM is quickly full, the system clears some useless java objects to collect the memory space. The JVM real load condition cannot be reflected well by the mode that the JVM load is characterized by the memory utilization rate. When the memory usage rate is high, it is likely that java objects in the JVM can be effectively recycled by the GC, in this case, the actual condition of the JVM load is not high, and if the memory usage rate is directly used for representing, the JVM load is wrongly judged as a high load, and then a series of unnecessary response measures are made, so that the use experience of a user is affected, for example, risk early warning is frequently sent, the user request is frequently limited, and the like. When the memory usage rate is not very high, it is possible that an active thread in the JVM is creating a java object quickly, and according to the life cycle rule of the java object, the object is generally difficult to be effectively recovered by the GC in a short time, which may cause the JVM to rapidly enter an overload state, in which case the actual condition of the JVM load is very high, and if the memory usage rate is directly used for representation, the JVM load is misjudged as a medium-low load, so that a good machine for taking effective operation and maintenance measures is missed, and further, the stable operation of the system is affected.

Therefore, in the prior art, the memory usage rate is adopted to analyze the JVM load, so that the problem of error early warning is easily caused.

Disclosure of Invention

In view of the above problems, the invention provides an exception handling method and device based on a garbage collection log, which improve the accuracy and efficiency of exception identification.

In a first aspect, the present application provides the following technical solutions through an embodiment:

an exception handling method based on a garbage collection log comprises the following steps:

generating a GC log according to a preset GC log generation parameter and storing the GC log to a preset path; reading the GC log in the preset path, and extracting data to be analyzed from the GC log; wherein, the data to be analyzed is used for carrying out anomaly analysis; inputting the data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result; and adjusting and optimizing JVM parameters according to the abnormal analysis result.

Optionally, before the data to be analyzed is input into a preset recognition model for recognition and an abnormal analysis result is obtained, the method further includes:

acquiring historical data to be analyzed; the historical data to be analyzed is data extracted from a historical GC log; calibrating an abnormal result for the historical data to be analyzed; and inputting the historical data to be analyzed and the abnormal result into a preset initial model for training to obtain a recognition model.

Optionally, the abnormal analysis result is that the stopping time caused by too fast new generation lifting is too long; the adjusting and optimizing the JVM parameters according to the abnormal analysis result comprises the following steps:

acquiring recovery frequency corresponding to the abnormal analysis result; according to the recovery frequency, increasing the space of the new generations and increasing the promotion threshold of the new generations.

Optionally, the tuning the JVM parameter according to the abnormal analysis result further includes:

if the new generation space reaches the maximum, judging whether the old generation occupation ratio reaches a preset ratio threshold value; the proportion threshold is determined by the computing throughput of the system and the problem occurrence frequency, wherein the problem occurrence frequency is the frequency of overlong pause time caused by too fast new generation lifting; if so, the CMS garbage collector is started.

Optionally, the abnormal analysis result is that the pause time caused by fragmentation of the aged generation is too long; the adjusting and optimizing the JVM parameters according to the abnormal analysis result comprises the following steps:

acquiring recovery frequency corresponding to the abnormal analysis result; and increasing the space of the elderly generations according to the recovery frequency and the space release size after Full GC recovery.

Optionally, the abnormal analysis result is a memory leak; the adjusting and optimizing the JVM parameters according to the abnormal analysis result comprises the following steps:

releasing references to garbage objects; where the referenced variable is reset to null upon exiting the active domain.

In a second aspect, based on the same inventive concept, the present application provides the following technical solutions through an embodiment:

an exception handling apparatus based on a garbage collection log, comprising:

the log acquisition module is used for generating a GC log according to a preset GC log generation parameter and storing the GC log to a preset path; the data extraction module is used for reading the GC log in the preset path and extracting data to be analyzed from the GC log; wherein, the data to be analyzed is used for carrying out anomaly analysis; the identification module is used for inputting the data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result; and the optimization module is used for adjusting and optimizing the JVM parameters according to the abnormal analysis result.

Optionally, the method further includes a model training module, configured to, before the data to be analyzed is input into a preset recognition model for recognition and an abnormal analysis result is obtained:

acquiring historical data to be analyzed; the historical data to be analyzed is data extracted from a historical GC log; calibrating an abnormal result for the historical data to be analyzed; and inputting the historical data to be analyzed and the abnormal result into a preset initial model for training to obtain a recognition model.

In a third aspect, based on the same inventive concept, the present application provides the following technical solutions through an embodiment:

an electronic device comprising a processor and a memory coupled to the processor, the memory storing instructions that, when executed by the processor, cause the electronic device to perform the steps of the method of any of the first aspects above.

In a fourth aspect, based on the same inventive concept, the present application provides the following technical solutions through an embodiment:

a computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of any of the first aspects.

According to the exception handling method and device based on the garbage collection log, firstly, according to a preset generation parameter of the GC log, the GC log is generated and stored to a preset path; then, reading a GC log in a preset path, and extracting data to be analyzed from the GC log; the data to be analyzed is used for carrying out anomaly analysis; then, inputting the data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result; and finally, adjusting and optimizing JVM parameters according to the abnormal analysis result. Because the identification model is adopted for identification and processing in the process of anomaly analysis, the whole identification process can be ensured to be automatically carried out and executed in real time; in addition, the anomaly identification is carried out based on all extracted data to be analyzed, all the data to be analyzed can be comprehensively utilized, and the problem that the high-load anomaly of the JVM cannot be identified due to the fact that only the use condition of a memory is considered during manual identification is avoided. Therefore, the method of the embodiment improves the accuracy and efficiency of the abnormality identification.

The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts. In the drawings:

fig. 1 is a flowchart illustrating an exception handling method based on a garbage collection log according to a first embodiment of the present invention;

fig. 2 is a schematic structural diagram illustrating functional modules of an exception handling apparatus based on a garbage collection log according to a second embodiment of the present invention.

Detailed Description

Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

First embodiment

Referring to fig. 1, a flowchart of an exception handling method based on a garbage collection log according to a first embodiment of the present invention is shown. The method comprises the following steps:

step S10: generating a GC log according to a preset GC log generation parameter and storing the GC log to a preset path;

step S20: reading the GC log in the preset path, and extracting data to be analyzed from the GC log; wherein, the data to be analyzed is used for carrying out anomaly analysis;

step S30: inputting the data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result;

step S40: and adjusting and optimizing JVM parameters according to the abnormal analysis result.

In the embodiment, through the steps S10-S40, corresponding data to be analyzed are extracted after the GC logs are output; then inputting the data to be analyzed into a preset identification model for identification, and obtaining a corresponding abnormal analysis result; finally, the JVM parameters can be optimized and adjusted based on the abnormal analysis result. Because the identification model is adopted for identification and processing in the process of anomaly analysis, the whole identification process can be ensured to be automatically carried out and executed in real time; in addition, the anomaly identification is carried out based on all extracted data to be analyzed, all the data to be analyzed can be comprehensively utilized, and the problem that the high-load anomaly of the JVM cannot be identified due to the fact that only the use condition of a memory is considered during manual identification is avoided. Therefore, the method of the embodiment improves the accuracy and efficiency of the abnormality identification. Specific implementations of the respective steps are specifically described below.

Step S10: and generating the GC log according to the generation parameters of the preset GC log and storing the GC log to a preset path.

In step S10, the GC log needs to be output first, and therefore, the generation parameters of the GC log need to be set; such as collector type, maximum expected eviction stall time, maximum memory of heap, etc. One specific example is as follows:

-XX: + UseG1GC, set collector type, use G1 garbage collector;

MaxGCPauseMILLIS =100, sets the maximum GC dwell time index expected to be reached (JVM best effort, not guaranteed to be reached), and defaults to 200 milliseconds;

xmx256m, set the maximum memory of the heap;

-XX: + printGCDetails, print GC log;

-XX: + PrintGCTimestamps, the reference timestamp of the GC is entered;

+ PrintGCDateStamps, entering the time stamp (in the form of the date) of the GC;

-XX: + PrintHeapatGC, which prints out the information of the stack before and after GC is performed;

xlogc:/root/opt/gc.log, preset path of GC log file.

By setting the generation parameters, the real-time automatic triggering and output of the GC log can be realized; when the log is printed.

Step S20: reading the GC log in the preset path, and extracting data to be analyzed from the GC log; wherein, the data to be analyzed is used for carrying out abnormity analysis.

In step S20, the data to be analyzed may include: heap memory information, computational throughput, allocation proportions of young and old age, age size, upgrade age, reasons for GC occurrences, number of GC occurrences, time-out for GC occurrences, and the like. After the GC log is acquired, the data to be analyzed can be extracted by identifying the key fields. Each key field is provided with corresponding target data to be analyzed, and after the key field is detected, the data described by the key field can be extracted to be used as the target data to be analyzed. Further, a table template of the data to be analyzed can be constructed, and the table template comprises the name of the data to be analyzed and the value of the data to be analyzed; the name of each type of data to be analyzed corresponds to one or more key fields. Then, when the key field of the GC log is identified, mapping the value corresponding to the identified key field to the table template, so as to extract all the data to be analyzed in the GC log.

Step S30: inputting the data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result;

in step S30, the data to be analyzed is input into a preset recognition model; in this embodiment, a common machine learning algorithm may be adopted to construct the model; and supervised learning training is adopted, so that the reliability of the obtained recognition model is improved. Specifically, in the model training process, reference may be made to the following: firstly, acquiring historical data to be analyzed, wherein the historical data to be analyzed is data extracted from a historical GC log; then, calibrating an abnormal result for the historical data to be analyzed, and calibrating the abnormal result in a manual identification mode; since the abnormal result may be affected by different parameters, when calibrating each set of historical data to be analyzed, the relationship between multiple data may be included, and a set of historical data to be analyzed is data in the GC log at a certain time. A set of historical data to be analyzed may be calibrated for multiple anomalous results, without limitation. And finally, inputting the historical data to be analyzed and the abnormal result into a preset initial model for training to obtain a recognition model. Therefore, the trained recognition model can be used for recognizing the abnormality based on a plurality of parameters, and not only can fault judgment be carried out according to the memory tolerant occupancy rate, so that the recognition reliability is improved.

For example, when the garbage collection frequency is high, but the memory occupancy rate is low, and the memory usage rate after the garbage collection does not change much, it may be a high load state of the processor. The specific cause cannot be identified by the conventional analysis method. In the embodiment, a mode of identifying a model is adopted, and at least a plurality of data such as garbage collection frequency, memory occupancy rate, memory usage rate change after garbage collection and the like are comprehensively identified, so that the abnormality of the current JVM can be effectively identified, and an accurate abnormality analysis result is obtained.

Further, the anomaly analysis result obtained in this embodiment may also be output in the form of a visual chart. For example, the visualization chart may include a specific type of the abnormal analysis result and an analysis index (corresponding to a parameter in the data to be analyzed) corresponding to the abnormal analysis result.

Step S40: and adjusting and optimizing JVM parameters according to the abnormal analysis result.

When the abnormal analysis result is that the pause time is too long, the server error problem of the page response code 500 and the like may occur on the software Web page corresponding to the long pause of the garbage collector. Specifically, the method comprises the following steps:

when the abnormal analysis result is that the pause time caused by the over-fast new generation is overlong; step S40 includes:

acquiring recovery frequency corresponding to the abnormal analysis result; according to the recycling frequency, the space of the new generations is increased, and the promotion threshold value of the new generations is increased. When the abnormal analysis result corresponds to the condition that the recovery frequency is too fast, the new generation space is insufficient, and the new generation space can be properly increased, so that more newly-built objects can be accommodated in the new generation; furthermore, the promotion threshold of the new generation is increased, and the phenomenon that the new generation is converted into the old generation too quickly is avoided.

If the memory is limited, the JVM tuning can be performed as follows:

if the new generation space reaches the maximum, judging whether the old generation occupation ratio reaches a preset ratio threshold value; the proportion threshold is determined by the calculation throughput of the system and the problem occurrence frequency, wherein the problem occurrence frequency is the frequency of overlong pause time caused by too fast new generation lifting; and if the occupation ratio of the old generation reaches a preset ratio threshold, starting the CMS garbage collector. It should be noted that the earlier the CMS garbage collector is started, the lower the frequency of occurrence of the anomaly is, but the computation throughput is reduced; when the proportional threshold is adjusted, debugging and determining can be carried out according to the required calculation throughput and the acceptable abnormal occurrence frequency, and a balance point of the proportional threshold is found. Further, after carrying out CMS garbage recovery for n times, carrying out primary compression type Full GC; wherein n can be set according to the occurrence frequency of insufficient memory.

When the abnormal analysis result is that the pause time caused by fragmentation of the old generation is overlong; step S40 may include: acquiring recovery frequency corresponding to the abnormal analysis result; according to the recovery frequency and the space release size after Full GC recovery is performed, the space of the elderly generations is increased. Specifically, when the recovery frequency exceeds a preset recovery threshold, and the size of the space released after Full GC recovery is performed is smaller than the preset space release threshold, for example, the release is smaller than 1%; at this time, the larger the recovery frequency and the less the space release, the larger the old age space can be increased; specifically, the size of the increased space in the elderly generation may be positively correlated to how much the recovery frequency exceeds the recovery threshold within a certain range, and negatively correlated to the size of the space release. In addition, tuning can be realized by adjusting the Survivor area to be large.

When the abnormal analysis result is memory leak; the execution of step S40 may include: releasing references to garbage objects; where the referenced variable is reset to null upon exiting the active domain. In addition, when the program is adjusted to process the character String, a StringBuffer type is adopted, and a String type is avoided; centralized creation of objects, especially large objects, may also be prohibited or avoided, increasing the priority of operations using streams. Forbidding or avoiding the creation of objects in frequently called methods, especially in loops; wherein, whether the method is frequently called can be judged according to the calling frequency of the method.

Through the automatic tuning processing, different types of abnormal types can be accurately optimized, the optimal running state of the JVM is ensured, meanwhile, the reduction of the program execution efficiency is avoided, and the stability is improved.

Further, in this embodiment, fault code location may also be performed for a part of the abnormal analysis results.

When the exception analysis result indicates that the JAVA process consumes too high processor resources, a JVM memory image (dump file) can be popped up through a preset command; then, the dump file is analyzed based on the memory leak tool. For example, the preset commands are jmap-dump: format = b, file = mydump.

When the abnormal analysis result is that the JAVA process consumes too high processor resources, the JAVA process can be analyzed firstly, then the ID (Identity Document) corresponding to the problem thread is found, the code is found according to the stack information of the thread, and finally code analysis and troubleshooting are carried out. Specifically, a preset top command can be executed to locate the process with the highest consumption processor, and the process pid is memorized; then, finding a problem thread through top-Hp pid, and remembering a thread tid; and then, stacking the thread stack information dump into a specified file through jstack-l tid > jstack.log, wherein the thread tid is decimal, the thread id in the stack is 16-system, and the printf is "% x \ n" tid is used for conversion. Finding a corresponding thread stack from stack information through the converted 16-system number, if GC threads exist, inferring frequent GC caused by memory leakage, and checking codes through jstat-gcutil pid 1s so as to realize fault code positioning.

In summary, in the exception handling method and apparatus based on the garbage collection log provided in this embodiment, first, according to a preset generation parameter of the GC log, the GC log is generated and stored to a preset path; then, reading a GC log in a preset path, and extracting data to be analyzed from the GC log; the data to be analyzed is used for carrying out anomaly analysis; then, inputting the data to be analyzed into a preset identification model for identification to obtain an abnormal analysis result; and finally, adjusting and optimizing JVM parameters according to the abnormal analysis result. Because the identification model is adopted for identification and processing in the process of anomaly analysis, the whole identification process can be ensured to be automatically carried out and executed in real time; in addition, the anomaly identification is carried out based on all extracted data to be analyzed, all the data to be analyzed can be comprehensively utilized, and the problem that the high-load anomaly of the JVM cannot be identified due to the fact that only the use condition of a memory is considered during manual identification is avoided. Therefore, the method of the embodiment improves the accuracy and efficiency of the abnormality identification.

Second embodiment

Referring to fig. 2, a second embodiment of the present invention provides an exception handling apparatus 300 based on garbage collection log based on the same inventive concept. The garbage collection log-based exception handling apparatus 300 includes:

the log obtaining module 301 is configured to generate a GC log according to a preset GC log generation parameter and store the GC log to a preset path; a data extraction module 302, configured to read the GC log in the preset path, and extract data to be analyzed from the GC log; wherein, the data to be analyzed is used for carrying out anomaly analysis; the identification module 303 is configured to input the data to be analyzed into a preset identification model for identification, so as to obtain an abnormal analysis result; and the optimization module 304 is configured to adjust and optimize the JVM parameters according to the anomaly analysis result.

As an optional implementation manner, the system further includes a model training module, configured to, before the data to be analyzed is input into a preset recognition model for recognition and an abnormal analysis result is obtained:

acquiring historical data to be analyzed; the historical data to be analyzed is data extracted from a historical GC log; calibrating an abnormal result for the historical data to be analyzed; and inputting the historical data to be analyzed and the abnormal result into a preset initial model for training to obtain a recognition model.

As an optional embodiment, the abnormal analysis result is that the pause time caused by the too fast new generation lifting is too long; the optimization module 304 is specifically configured to:

acquiring recovery frequency corresponding to the abnormal analysis result; according to the recovery frequency, increasing the space of the new generations and increasing the promotion threshold of the new generations.

As an optional implementation manner, the optimization module 304 is further specifically configured to:

if the new generation space reaches the maximum, judging whether the old generation occupation ratio reaches a preset ratio threshold value; the proportion threshold is determined by the computing throughput of the system and the problem occurrence frequency, wherein the problem occurrence frequency is the frequency of overlong pause time caused by too fast new generation lifting; if so, the CMS garbage collector is started.

As an alternative embodiment, the abnormal analysis result is that the pause time caused by fragmentation of the aged generation is overlong; the optimization module 304 is further specifically configured to:

acquiring recovery frequency corresponding to the abnormal analysis result; and increasing the space of the elderly generations according to the recovery frequency and the space release size after Full GC recovery.

As an optional implementation manner, the exception analysis result is a memory leak; the optimization module 304 is further specifically configured to:

releasing references to garbage objects; where the referenced variable is reset to null upon exiting the active domain.

It should be noted that, the implementation and technical effects of the exception handling apparatus 300 based on garbage collection log according to the embodiment of the present invention are the same as those of the foregoing method embodiment, and for the sake of brief description, reference may be made to corresponding contents in the foregoing method embodiment where no part of the embodiment of the apparatus is mentioned.

Third embodiment

Based on the same inventive concept, there is also provided in this embodiment an electronic device comprising a processor and a memory coupled to the processor, the memory storing instructions that, when executed by the processor, cause the electronic device to perform the steps of the method of any of the preceding method embodiments. It should be noted that, in the electronic device provided in the embodiment of the present invention, when the instructions are executed by the processor, the specific implementation of each step and the generated technical effect are the same as those of the foregoing method embodiment, and for the sake of brief description, for the sake of brevity, reference may be made to the corresponding content in the foregoing method embodiment for the non-mentioned point of the present embodiment.

Fourth embodiment

Based on the same inventive concept, there is also provided in the present embodiment a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method of any of the above-described method embodiments. It should be noted that, in the computer-readable storage medium provided by the embodiment of the present invention, when the program is executed by the processor, the specific implementation of each step and the technical effect produced by the step are the same as those of the foregoing method embodiment, and for the sake of brief description, for the sake of brevity, no mention in this embodiment may be made to the corresponding contents in the foregoing method embodiment.

The term "and/or" appearing herein is merely one type of associative relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship; the word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.

It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:用于执行纠错操作和错误校验操作的电子器件

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!