Abnormality processing method and device, computer readable storage medium and electronic equipment

By obtaining and analyzing the target method execution time information of distributed applications, judging and generating early warning information, it solves the problem of low timeliness of abnormal perception of distributed applications and improves the system's response capability and user experience.

CN118540199APending Publication Date: 2024-08-23INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410611633.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-16
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

When distributed applications face high traffic, the timeliness of abnormality detection in the existing technology is low, resulting in excessive CPU load and affecting customer experience.

Method used

By obtaining the execution time information of the target method of the distributed application, it is judged whether there is an abnormality in the method, and early warning information is generated to characterize the abnormality, thereby improving the timeliness and accuracy of abnormality perception.

Benefits of technology

It achieves timely and accurate perception of distributed application anomalies, improves the system's responsiveness, and avoids performance degradation and user experience problems caused by anomalies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540199A
    Figure CN118540199A
Patent Text Reader

Abstract

The invention discloses an exception handling method and device, a computer readable storage medium and electronic equipment. Relates to the financial science and technology field or other fields, and the method comprises the following steps: obtaining execution time information of a target method of a distributed application, the execution time information being obtained by monitoring the target method in a target virtual machine running the distributed application; judging whether the target method is abnormal or not according to the execution time information; when it is judged that the target method is abnormal, early warning information is generated according to the execution time information, and the early warning information represents that the target method in the distributed application is abnormal. According to the method and the device, the technical problem of low timeliness of abnormity perception when the distributed application is abnormal in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of financial technology or other fields, and in particular, to an exception handling method, device, computer-readable storage medium and electronic device. Background Art

[0002] Distributed services are widely used in financial institutions, whether for internal applications of financial institutions or for external third-party applications. In the case of large data access volume, if the previous monolithic architecture and single application architecture are used, it will be difficult to carry the huge access volume, resulting in the application being blocked due to the large amount of data, and ultimately leading to tight availability of the CPU (Central Processing Unit), which makes it impossible to provide healthy and friendly services to customers, resulting in a poor customer experience. Distributed applications will distribute different network requests to different servers through personalized diversion algorithms to alleviate machine overload caused by excessive traffic.

[0003] However, for a distributed architecture, the same application will be deployed on multiple machines or different applications will be deployed on multiple machines, so that an error in a single service interface may cause an error in the entire call link. At present, the related technology usually perceives the anomaly of a distributed application based on the error information fed back by the client, which leads to the problem of low timeliness in the perception of anomalies.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present invention provide an exception handling method, an apparatus, a computer-readable storage medium, and an electronic device to at least solve the technical problem in the related art that when an exception exists in a distributed application, the timeliness of the exception perception is low.

[0006] According to one aspect of an embodiment of the present invention, there is provided an exception handling method, comprising: obtaining execution time information of a target method of a distributed application, wherein the execution time information is obtained by monitoring the target method in a target virtual machine running the distributed application; judging whether the target method has an exception based on the execution time information; and in the case where it is judged that the target method has an exception, generating warning information based on the execution time information, wherein the warning information indicates that the target method in the distributed application has an exception.

[0007] Furthermore, the exception handling method also includes: before obtaining the execution time information of the target method of the distributed application, obtaining at least one class file required for the operation of the distributed application, and loading at least one class file in the memory of the target virtual machine; obtaining method information of the target method to be monitored, wherein the method information includes: the class name and method name to which the target method belongs; determining a first-class file from at least one class file according to the method information, wherein the first-class file includes the target bytecode corresponding to the target method; importing monitoring instructions into the first-class file to obtain an updated first-class file, and running the updated first-class file in the memory to monitor the target method.

[0008] Furthermore, the exception handling method also includes: determining the target bytecode corresponding to the target method from the first category file according to the method information; determining the import position of the monitoring instruction according to the position of the target bytecode in the first category file; importing the monitoring instruction into the first category file according to the import position to obtain an updated first category file.

[0009] Furthermore, the exception handling method also includes: obtaining a first configuration file and a second configuration file, wherein the first configuration file is used to record the correspondence between multiple methods and multiple method types, and the second configuration file is used to record the correspondence between multiple method types and multiple execution time conditions, and the multiple methods include a target method; determining the execution time condition corresponding to the target method according to the first configuration file and the second configuration file; judging whether the target method has an exception according to the execution time condition and execution time information corresponding to the target method, and obtaining a judgment result.

[0010] Furthermore, the execution time information includes the execution start time point and the execution end time point of the most recent execution of the target method, and the exception handling method also includes: determining the most recent execution duration of the target method based on the execution start time point and the execution end time point; when the most recent execution duration of the target method meets the execution time condition, determining that the judgment result indicates that there is no abnormality in the target method; when the most recent execution duration of the target method does not meet the execution time condition, determining that the judgment result indicates that there is an abnormality in the target method.

[0011] Furthermore, the exception handling method also includes: after generating warning information according to the execution time information, obtaining a second type of file, wherein the second type of file is obtained by repairing the target method in the first type of file, and the first type of file is a class file that runs in the target virtual machine and includes the target bytecode corresponding to the target method; loading the second type of file in the memory of the target virtual machine to replace the first type of file; importing monitoring instructions in the second type of file to obtain an updated second type of file, and running the updated second type of file in the memory to monitor the repaired target method.

[0012] Furthermore, the exception handling method also includes: determining index information based on the generation time point of the execution time information, wherein the index information includes information of a data table for storing warning information; generating warning information based on the execution time information and the index information; after generating the warning information based on the execution time information, sending the warning information to the target server, wherein the target server stores the warning information based on the index information in the warning information, and displays the stored warning information through a human-computer interaction interface.

[0013] According to another aspect of an embodiment of the present invention, there is also provided an exception handling device, including: a first acquisition module, used to obtain execution time information of a target method of a distributed application, wherein the execution time information is obtained by monitoring the target method in a target virtual machine running the distributed application; a judgment module, used to judge whether there is an exception in the target method based on the execution time information; and a generation module, used to generate warning information based on the execution time information when it is judged that there is an exception in the target method, wherein the warning information indicates that there is an exception in the target method in the distributed application.

[0014] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the above exception handling method when running.

[0015] According to another aspect of an embodiment of the present invention, an electronic device is also provided, the electronic device comprising one or more processors; a memory for storing one or more programs, so that when the one or more programs are executed by the one or more processors, the one or more processors are implemented to run the programs, wherein the programs are configured to execute the above-mentioned exception handling method during operation.

[0016] In an embodiment of the present invention, a method of judging whether a distributed application has an abnormality based on the execution time information of a method in the distributed application is adopted. The execution time information of a target method of the distributed application is obtained, and then judging whether the target method has an abnormality based on the execution time information. When it is judged that the target method has an abnormality, warning information is generated based on the execution time information. The execution time information is obtained by monitoring the target method in a target virtual machine running the distributed application, and the warning information indicates that an abnormality exists in the target method in the distributed application.

[0017] In the above process, by monitoring the target method in the target virtual machine running the distributed application, the execution time information of the target method is accurately obtained. Since the execution time of the target method can reflect the execution status of the target method in real time and accurately, by judging whether the target method has an abnormality based on the execution time information of the target method in the distributed application, it is possible to judge whether the target method has an abnormality based on the real-time execution status of the target method, thereby improving the timeliness of the perception of distributed application anomalies on the one hand, and improving the accuracy of the perception of distributed application anomalies on the other hand.

[0018] It can be seen that the solution provided in the present application achieves the purpose of judging whether there is an anomaly in a distributed application based on the execution time information of the method in the distributed application, thereby achieving the technical effect of improving the timeliness of anomaly perception, and further solving the technical problem of low timeliness of anomaly perception when anomalies exist in distributed applications in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0020] Figure 1 This is a flow chart of an optional exception handling method according to an embodiment of the present invention. Figure 1 ;

[0021] Figure 2 is a schematic diagram of an optional distributed application hot repair according to an embodiment of the present invention;

[0022] Figure 3 This is a flow chart of an optional exception handling method according to an embodiment of the present invention. Figure 2 ;

[0023] Figure 4 is a schematic diagram of an optional exception handling device according to an embodiment of the present invention;

[0024] Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0027] It should be noted that the exception handling method, device, computer-readable storage medium and electronic device disclosed in the present invention can be used in the field of financial technology, and can also be used in any field other than the field of financial technology. The application field of the exception handling method, device, computer-readable storage medium and electronic device disclosed in the present invention is not limited.

[0028] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards in the relevant regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0029] Example 1

[0030] According to an embodiment of the present invention, an embodiment of an exception handling method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0031] Figure 1 This is a flow chart of an optional exception handling method according to an embodiment of the present invention. Figure 1 ,like Figure 1 As shown, the method comprises the following steps:

[0032] Step S101 : acquiring execution time information of a target method of a distributed application, wherein the execution time information is obtained by monitoring the target method in a target virtual machine running the distributed application.

[0033] Optionally, electronic devices, application systems, servers and other devices can be used as the execution subject of the present application. In this embodiment, the target virtual machine is used as the execution subject to obtain the execution time information of the target method of the distributed application. In this embodiment, the distributed virtual machine runs in multiple virtual machines, that is, there are multiple target virtual machines.

[0034] Optionally, the distributed application may vary according to different actual application scenarios. For example, in a financial scenario, the distributed application may be an application provided by a financial institution to a user, and the user may handle related business of the financial institution based on the application. In this embodiment, the distributed application is not specifically limited.

[0035] In some embodiments, the target method may be triggered to execute when a user initiates a target request to a distributed application, and the target method is used to process the target request. For example, in a financial scenario, the target method may be a method for querying a loan information table. In this embodiment, the execution content of the target method is not specifically limited.

[0036] In some embodiments, the distributed application runs in the target virtual machine, and the target virtual machine loads and runs at least one class file corresponding to the distributed application to realize the operation of the distributed application. The target virtual machine can use an open source framework for processing bytecodes to enhance the class file (class file) of the distributed application. For example, the target method in the class file is obtained by using the open source framework for processing bytecodes, and the location of the target method before and after the execution is buried to realize the enhancement of the class file. After that, the target virtual machine can monitor the target method through the buried point, so as to realize the acquisition of the execution time information of the target method.

[0037] In some embodiments, the execution time information includes an execution start time point and an execution end time point of the most recent execution of the target method.

[0038] Step S102, judging whether there is an exception in the target method according to the execution time information.

[0039] Optionally, a unique execution time condition may be preset in the target virtual machine. The target virtual machine may determine that there is no abnormality in the target method when it is determined that the execution time information satisfies the execution time condition. Conversely, when it is determined that the execution time information does not satisfy the execution time condition, it may determine that there is an abnormality in the target method.

[0040] Optionally, the target virtual machine may also be preset with multiple execution time conditions, and preset with corresponding relationships between the multiple execution time conditions and multiple methods, the multiple methods including the target method. The target virtual machine may determine the execution time condition that matches the target method from the multiple execution time conditions, so that when it is determined that the execution time information satisfies the execution time condition that matches the target method, it is determined that there is no abnormality in the target method; conversely, when it is determined that the execution time information does not satisfy the execution time condition that matches the target method, it is determined that there is an abnormality in the target method.

[0041] Since in a distributed architecture, the external service interfaces on different virtual machines will call each other, a service interface method that takes a long time and consumes a lot of resources will cause the overall performance of the distributed application to degrade. If the distributed application does not perform system protection such as timeout in time, it will cause the problem of dragging down the downstream system. Therefore, in this embodiment, by judging whether the target method is abnormal based on the execution time information, the timeliness and accuracy of perceiving the abnormality of the target method can be improved.

[0042] Step S103 , when it is determined that the target method has an abnormality, generating warning information according to the execution time information, wherein the warning information indicates that the target method in the distributed application has an abnormality.

[0043] Optionally, the warning information includes at least execution time information, and may also include a warning identifier, index information, virtual machine information of the target virtual machine, and other information.

[0044] After generating the warning information, the target virtual machine can put the warning information into the message queue in the form of a message, so as to asynchronously send the warning information to the target server for processing. Optionally, the target server can insert the warning information into a database, and finally display the warning information through a graphical plug-in.

[0045] Based on the scheme defined by the above steps S101 to S103, it can be known that in an embodiment of the present invention, a method of judging whether a distributed application has an abnormality based on the execution time information of the method in the distributed application is adopted, by obtaining the execution time information of the target method of the distributed application, and then judging whether the target method has an abnormality based on the execution time information, so that when it is judged that the target method has an abnormality, warning information is generated based on the execution time information, wherein the execution time information is obtained by monitoring the target method in the target virtual machine running the distributed application, and the warning information indicates that the target method in the distributed application has an abnormality.

[0046] It is easy to notice that in the above process, by monitoring the target method in the target virtual machine running the distributed application, the execution time information of the target method is accurately obtained. Since the execution time of the target method can reflect the execution status of the target method in real time and accurately, by judging whether the target method has an abnormality based on the execution time information of the target method in the distributed application, it is possible to judge whether the target method has an abnormality based on the real-time execution status of the target method, thereby improving the timeliness of the perception of distributed application anomalies on the one hand, and improving the accuracy of the perception of distributed application anomalies on the other hand.

[0047] It can be seen that the solution provided in the present application achieves the purpose of judging whether there is an anomaly in a distributed application based on the execution time information of the method in the distributed application, thereby achieving the technical effect of improving the timeliness of anomaly perception, and further solving the technical problem of low timeliness of anomaly perception when anomalies exist in distributed applications in related technologies.

[0048] In an optional embodiment, before obtaining the execution time information of the target method of the distributed application, the target virtual machine can obtain at least one class file required for the operation of the distributed application, and load at least one class file in the memory of the target virtual machine, and then obtain the method information of the target method to be monitored, and then determine the first class file from the at least one class file according to the method information, so as to import the monitoring instruction into the first class file, obtain the updated first class file, and run the updated first class file in the memory to monitor the target method. The method information includes: the class name and method name to which the target method belongs, and the first class file includes the target bytecode corresponding to the target method.

[0049] Before monitoring the target method of the distributed application, the distributed application needs to be run in the target virtual machine. Optionally, the target virtual machine can obtain at least one class file required for running the distributed application and load at least one class file in the memory of the target virtual machine to run the distributed application.

[0050] Before monitoring the target method of the distributed application, a class in an open source framework for processing bytecodes may also be run in the target virtual machine. Optionally, the open source framework for processing bytecodes may be determined as the target open source framework, and the target virtual machine may obtain at least one class file corresponding to the target open source framework, and load at least one class file corresponding to the target open source framework into the memory of the target virtual machine to implement the running of the class in the target open source framework.

[0051] Afterwards, the target virtual machine can determine the method information of the target method to be monitored according to at least one class file corresponding to the target open source framework, and determine the first category file from the at least one class file according to the method information. For example, the class file corresponding to the target open source framework includes a ClassReader class file, and the ClassReader class file is used to read bytecodes. The method information of the target method to be monitored is defined in the ClassReader class file, and the first category file can be determined from the at least one class file according to the method information by executing the ClassReader class file.

[0052] Optionally, the method information includes at least the class name and method name to which the target method belongs, and may also include method parameter description information of the target method.

[0053] After determining the first type of file, the target virtual machine can import the monitoring instruction in the first type of file according to at least one class file corresponding to the target open source framework to obtain an updated first type of file. For example, the class file corresponding to the target open source framework includes a MethodVisitor class file, which is used to operate and modify when accessing the bytecode method of the class. The MethodVisitor class file can define monitoring instructions, and the monitoring instructions can be imported into the first type of file by executing the MethodVisitor class file.

[0054] It should be noted that by loading the class files of the distributed application into the memory of the target virtual machine and importing the monitoring instructions for the first type of file containing the target bytecode corresponding to the target method in the memory, effective monitoring of the target method is achieved, thereby improving the accuracy of the execution time information obtained, and further improving the accuracy of exception perception.

[0055] In an optional embodiment, in the process of importing monitoring instructions into the first category file to obtain an updated first category file, the target virtual machine can determine the target bytecode corresponding to the target method from the first category file based on the method information, and then determine the import position of the monitoring instruction according to the position of the target bytecode in the first category file, thereby importing the monitoring instruction into the first category file according to the import position to obtain an updated first category file.

[0056] Optionally, the target virtual machine can determine the target bytecode corresponding to the target method from the first class file through the ClassReader class file according to the method name in the method information. Optionally, the target virtual machine can also determine the target bytecode corresponding to the target method from the first class file through the ClassReader class file according to the method name and method parameter description information in the method information.

[0057] Optionally, a visit() method is provided in MethodVisitor. The visit() method in MethodVisitor is used to access and modify the bytecode. The target virtual machine can call the parent implementation of the visit method (i.e. super.visit()) to retain the original bytecode (i.e. the bytecode of the target method) and add monitoring instructions to the previous line (i.e. an import position) and the next line (i.e. another import position) of the bytecode content of the target method to achieve the effect of enhancing the original target method.

[0058] For example, the monitoring instruction includes a first monitoring instruction and a second monitoring instruction, the first monitoring instruction is used to monitor the execution start time point of the most recent execution of the target method, and the second monitoring instruction is used to monitor the execution end time point of the most recent execution of the target method. Part of the content of an optional updated first-class file is as follows:

[0059] / / startMonitor(), start monitoring

[0060] Super.visit();

[0061] / / endMonitor(), end monitoring

[0062] Among them, " / / startMonitor(), start monitoring" is the first monitoring instruction, " / / endMonitor()" is the second monitoring instruction, and "Super.visit()" is used to retain the bytecode content of the target method.

[0063] It should be noted that by determining the import position of the monitoring instruction according to the position of the target bytecode in the first category file, and importing the monitoring instruction according to the import position, effective monitoring of the target method is achieved, thereby improving the accuracy of the execution time information obtained, and further improving the accuracy of exception perception.

[0064] In an optional embodiment, in the process of judging whether the target method has an exception based on the execution time information, the target virtual machine can obtain the first configuration file and the second configuration file, and then determine the execution time condition corresponding to the target method based on the first configuration file and the second configuration file, thereby judging whether the target method has an exception based on the execution time condition and the execution time information corresponding to the target method, and obtaining a judgment result. The first configuration file is used to record the correspondence between multiple methods and multiple method types, and the second configuration file is used to record the correspondence between multiple method types and multiple execution time conditions, and the multiple methods include the target method.

[0065] Optionally, the first configuration file and the second configuration file may be preset in the target virtual machine, and the target virtual machine may first determine the method type corresponding to the target method based on the first configuration file. The method type may be preset by the staff, for example, the method type may be distinguished according to the importance of the method, or for another example, the method type may be distinguished according to the method calling strategy (such as synchronous calling strategy, asynchronous calling strategy). Afterwards, the target virtual machine may determine the execution time condition corresponding to the method type corresponding to the target method from the second configuration file based on the method type corresponding to the target method, thereby determining the execution time condition as the execution time condition corresponding to the target method. One method corresponds to one method type, and one method type corresponds to one execution time condition.

[0066] In some embodiments, the target method may be triggered to execute when the user initiates a target request to the distributed application, and the target method is used to process the target request. Optionally, the execution time condition may be a condition for limiting the last execution duration of the target method, for example, the execution time condition may be "the execution duration is less than 3s", and optionally, the execution time condition may also be a condition for limiting the last execution start time point and / or execution end time point of the target method, for example, the execution time condition may be "the time interval between the last execution start time point and the last execution start time point is less than 10s, etc.", and for another example, the execution time condition may be "the time interval between the last execution end time point and the last execution end time point is less than 40s, etc.".

[0067] After determining the execution time condition corresponding to the target method, the target virtual machine can determine whether the target method has an exception according to the execution time condition and execution time information corresponding to the target method, and obtain a determination result.

[0068] It should be noted that by presetting the correspondence between multiple methods and multiple execution time conditions, it is possible to more specifically judge whether there is an abnormality in the target method, thereby improving the accuracy of abnormality perception in this application.

[0069] In an optional embodiment, the execution time information includes the execution start time point and the execution end time point of the target method's most recent execution, wherein, in the process of determining whether the target method has an exception based on the execution time condition and the execution time information corresponding to the target method and obtaining the judgment result, the target virtual machine can determine the most recent execution duration of the target method based on the execution start time point and the execution end time point, and then, when the most recent execution duration of the target method meets the execution time condition, determine that the judgment result indicates that there is no exception in the target method, and thus, when the most recent execution duration of the target method does not meet the execution time condition, determine that the judgment result indicates that there is an exception in the target method.

[0070] Optionally, the target virtual machine may determine the difference between the execution start time point and the execution end time point as the execution duration. The execution time condition may be a condition for limiting the latest execution duration of the target method.

[0071] For example, assuming that the execution time condition can be "execution time does not exceed 5s", then when the target method's most recent execution time is 4s, it is determined that the target method's most recent execution time meets the execution time condition; when the target method's most recent execution time is 8s, it is determined that the target method's most recent execution time does not meet the execution time condition.

[0072] It should be noted that since the execution time can effectively reflect the processing of the target request by the target method, when the target method takes too long to process the target request, it will affect the overall processing time of the target request, thereby affecting the user experience and downstream business. Therefore, by judging whether there is an abnormality in the target method based on the execution time, the accuracy of abnormality perception is further improved.

[0073] In an optional embodiment, in the process of generating the warning information according to the execution time information, the target virtual machine can determine the index information according to the generation time point of the execution time information, wherein the index information includes information of a data table for storing the warning information; and the warning information is generated according to the execution time information and the index information. After the warning information is generated according to the execution time information, the target virtual machine can send the warning information to the target server, wherein the target server stores the warning information according to the index information in the warning information, and displays the stored warning information through the human-computer interaction interface.

[0074] In some embodiments, the warning information needs to be stored for staff to query. In order to improve the query efficiency of the warning information, multiple data tables can be created in the database for storing the warning information, and the data table for storing the warning information is determined according to the generation time point of the execution time information in the warning information, so as to determine the index information according to the information of the data table, and generate the warning information according to the index information and the execution time information, so as to realize the partition storage of the warning information.

[0075] For example, the warning information corresponding to the execution time information generated within the same month can be stored in the same data table. For another example, the warning information corresponding to the execution time information generated within the same week can be stored in the same data table. For another example, the generation time point of the execution time information can be hashed, and the data table used to store the warning information can be determined based on the hash value.

[0076] Optionally, the index information may be an identifier of a data table, or may be information associated with the identifier of the data table.

[0077] In some embodiments, the warning information may also include a unique warning identifier, the IP address of the target virtual machine, the port number of the target virtual machine, the request content of the target request that triggered the most recent execution of the target method, the request time point of the target request that triggered the most recent execution of the target method, the request round-trip delay of the target request that triggered the most recent execution of the target method, and other information.

[0078] In some embodiments, after generating the warning information, the target virtual machine may put the warning information into a message queue, and then the target server consumes the warning information in the message queue. After obtaining the warning information, the target server may store the warning information in a data table indicated by the index information according to the index information in the warning information. The target server may be a server other than the server where the target virtual machine is located.

[0079] In some embodiments, the target server may also query the database for early warning information of a recent period of time (eg, within a week, within a month), and display the early warning information through a human-computer interaction interface for staff to view.

[0080] In some embodiments, in order to prevent slow data query due to excessive growth of data in the database, a timer can be used to clear expired warning information.

[0081] It should be noted that, through the above process, partitioned storage of different warning information is achieved, thereby facilitating the improvement of query efficiency for warning information and facilitating the display of different warning information according to time intervals.

[0082] In an optional embodiment, after generating the warning information according to the execution time information, the target virtual machine can obtain the second type of file, and then load the second type of file in the memory of the target virtual machine to replace the first type of file, thereby importing the monitoring instruction in the second type of file, obtaining the updated second type of file, and running the updated second type of file in the memory to monitor the repaired target method. The second type of file is obtained by repairing the target method in the first type of file, and the first type of file is a class file that runs in the target virtual machine and includes the target bytecode corresponding to the target method.

[0083] Optionally, after the user views the warning information through the human-computer interaction interface, the user can determine whether the target method needs to be repaired based on the warning information. If the user determines that the target method does not need to be repaired (for example, due to temporary network fluctuations and other factors), the user can delete the warning information. If the user determines that the target method needs to be repaired, the user can repair the target method in the first category of files. Optionally, the user can manually modify the first category of files to obtain the second category of files, or the user can repair the first category of files through a preset repair program to obtain the second category of files.

[0084] Afterwards, the target virtual machine can obtain the second type of file, delete the stored first type of file, and then load the second type of file in the memory of the target virtual machine to replace the first type of file. Then, the target virtual machine can import the monitoring instruction in the second type of file, obtain the updated second type of file, and run the updated second type of file in the memory to monitor the repaired target method. Among them, the method of importing the monitoring instruction in the second type of file is the same as the aforementioned method of importing the monitoring instruction in the first type of file, so it will not be repeated here.

[0085] For example, Figure 2 is a schematic diagram of an optional distributed application hot repair according to an embodiment of the present invention, according to Figure 2 This section describes an optional hot-fix process for distributed applications. Figure 2 As shown, the target virtual machine obtains the second type of file and loads the second type of file in the memory, and then uses the target open source framework to perform bytecode enhancement on the second type of file to obtain an updated second type of file. When a new network request is sent to the target virtual machine, the updated second type of file is called and executed to process the network request.

[0086] It should be noted that, through the above process, it is possible to solve the problems of some online applications in a non-downtime manner and hot-replace the program, thereby achieving non-stop upgrade of the application.

[0087] In an optional embodiment, Figure 3This is a flow chart of an optional exception handling method according to an embodiment of the present invention. Figure 2 ,according to Figure 3 An optional application process of the exception handling method is described. Figure 3 In the example, multiple target virtual machines are included, each of which is used to run a distributed application, such as Figure 3 As shown in the figure, when the distributed application in the target virtual machine processes a network request, the target method will be called and executed. The target virtual machine can monitor the target method to obtain the execution time information of the target method. Afterwards, the target virtual machine can determine whether the target method has an exception based on the execution time information. If the target method does not have an exception, no processing will be performed. If the target method has an exception, an early warning message will be generated and sent to the message queue. Afterwards, the target server can obtain the early warning information from the message queue, and then store and display the early warning information for staff to view.

[0088] It can be seen that the solution provided in the present application achieves the purpose of judging whether there is an anomaly in a distributed application based on the execution time information of the method in the distributed application, thereby achieving the technical effect of improving the timeliness of anomaly perception, and further solving the technical problem of low timeliness of anomaly perception when anomalies exist in distributed applications in related technologies.

[0089] Example 2

[0090] According to an embodiment of the present invention, an embodiment of an exception handling device is provided, wherein: Figure 4 is a schematic diagram of an optional exception handling device according to an embodiment of the present invention, such as Figure 4 As shown, the device comprises:

[0091] A first acquisition module 401 is used to acquire execution time information of a target method of a distributed application, wherein the execution time information is obtained by monitoring the target method in a target virtual machine running the distributed application;

[0092] A judgment module 402 is used to judge whether the target method has an exception according to the execution time information;

[0093] The generating module 403 is used to generate warning information according to the execution time information when it is determined that the target method has an abnormality, wherein the warning information indicates that the target method in the distributed application has an abnormality.

[0094] It should be noted that the above-mentioned first acquisition module 401, judgment module 402 and generation module 403 correspond to steps S101 to S103 in the above-mentioned embodiment. The examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned embodiment 1.

[0095] Optionally, the exception handling device also includes: a second acquisition module, used to acquire at least one class file required for the operation of the distributed application, and load at least one class file in the memory of the target virtual machine; a third acquisition module, used to acquire method information of the target method to be monitored, wherein the method information includes: the class name and method name to which the target method belongs; a first determination module, used to determine a first-class file from at least one class file according to the method information, wherein the first-class file includes the target bytecode corresponding to the target method; a first processing module, used to import monitoring instructions into the first-class file, obtain an updated first-class file, and run the updated first-class file in the memory to monitor the target method.

[0096] Optionally, the first processing module also includes: a first determination submodule, used to determine the target bytecode corresponding to the target method from the first category file according to the method information; a second determination submodule, used to determine the import position of the monitoring instruction according to the position of the target bytecode in the first category file; and a processing submodule, used to import the monitoring instruction into the first category file according to the import position to obtain an updated first category file.

[0097] Optionally, the judgment module 402 also includes: an acquisition submodule, used to acquire a first configuration file and a second configuration file, wherein the first configuration file is used to record the correspondence between multiple methods and multiple method types, and the second configuration file is used to record the correspondence between multiple method types and multiple execution time conditions, and the multiple methods include a target method; a third determination submodule, used to determine the execution time condition corresponding to the target method based on the first configuration file and the second configuration file; and a judgment submodule, used to determine whether there is an abnormality in the target method based on the execution time condition and execution time information corresponding to the target method, and obtain a judgment result.

[0098] Optionally, the judgment submodule includes: a first determination unit, used to determine the most recent execution duration of the target method based on the execution start time point and the execution end time point; a second determination unit, used to determine that the judgment result indicates that there is no abnormality in the target method when the most recent execution duration of the target method meets the execution time condition; and a third determination unit, used to determine that the judgment result indicates that there is an abnormality in the target method when the most recent execution duration of the target method does not meet the execution time condition.

[0099] Optionally, the exception handling device also includes: a fourth acquisition module, used to acquire a second-category file, wherein the second-category file is obtained by repairing a target method in a first-category file, and the first-category file is a class file that runs in a target virtual machine and includes a target bytecode corresponding to the target method; a loading module, used to load the second-category file in the memory of the target virtual machine to replace the first-category file; a second processing module, used to import a monitoring instruction in the second-category file to obtain an updated second-category file, and run the updated second-category file in the memory to monitor the repaired target method.

[0100] Optionally, the generation module 403 also includes: a generation sub-module, used to determine the index information according to the generation time point of the execution time information, wherein the index information includes information of a data table for storing the warning information; generating the warning information according to the execution time information and the index information; the exception handling device also includes: a third processing module, used to generate the warning information according to the execution time information, and the method also includes: sending the warning information to the target server, wherein the target server stores the warning information according to the index information in the warning information, and displays the stored warning information through the human-computer interaction interface.

[0101] Example 3

[0102] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the above exception handling method when running.

[0103] Example 4

[0104] According to another aspect of an embodiment of the present invention, an electronic device is provided, wherein: Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present invention, such as Figure 5 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the above-mentioned exception handling method when running.

[0105] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0106] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0107] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0108] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0109] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0110] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0111] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. An exception handling method, characterized in that: include: Acquiring execution time information of a target method of a distributed application, wherein the execution time information is obtained by monitoring the target method in a target virtual machine running the distributed application; Determining whether the target method has an exception based on the execution time information; When it is determined that the target method is abnormal, warning information is generated according to the execution time information, wherein the warning information indicates that the target method in the distributed application is abnormal.

2. The method according to claim 1, characterized in that Before obtaining the execution time information of the target method of the distributed application, the method includes: Obtaining at least one class file required for running the distributed application, and loading the at least one class file into the memory of the target virtual machine; Obtain method information of the target method to be monitored, wherein the method information includes: the class name and method name to which the target method belongs; Determine a first class file from the at least one class file according to the method information, wherein the first class file includes a target bytecode corresponding to the target method; Importing monitoring instructions into the first type of file to obtain an updated first type of file, and running the updated first type of file in the memory to monitor the target method.

3. The method according to claim 2, characterized in that Import the monitoring instructions into the first type of files to obtain updated first type of files, including: Determining, from the first type of files, a target bytecode corresponding to the target method according to the method information; Determining an import position of the monitoring instruction according to the position of the target bytecode in the first type of file; The monitoring instruction is imported into the first type of file according to the import position to obtain the updated first type of file.

4. The method according to claim 1, characterized in that Judging whether the target method has an exception according to the execution time information includes: Obtaining a first configuration file and a second configuration file, wherein the first configuration file is used to record the correspondence between a plurality of methods and a plurality of method types, and the second configuration file is used to record the correspondence between a plurality of method types and a plurality of execution time conditions, and the plurality of methods includes the target method; Determining an execution time condition corresponding to the target method according to the first configuration file and the second configuration file; It is determined whether the target method has an abnormality according to the execution time condition corresponding to the target method and the execution time information to obtain a determination result.

5. The method according to claim 4, characterized in that The execution time information includes the execution start time point and the execution end time point of the most recent execution of the target method. Whether the target method is abnormal is determined according to the execution time condition corresponding to the target method and the execution time information, and a determination result is obtained, including: Determining the most recent execution duration of the target method according to the execution start time point and the execution end time point; In the case where the most recent execution duration of the target method satisfies the execution time condition, determining that the judgment result indicates that there is no abnormality in the target method; When the most recent execution duration of the target method does not satisfy the execution time condition, it is determined that the judgment result indicates that an abnormality exists in the target method.

6. The method according to claim 1, characterized in that After generating the warning information according to the execution time information, the method further includes: Obtain a second type of file, wherein the second type of file is obtained by repairing a target method in a first type of file, and the first type of file is a class file that runs in the target virtual machine and includes a target bytecode corresponding to the target method; Loading the second type of files in the memory of the target virtual machine to replace the first type of files; Importing monitoring instructions into the second type of files to obtain updated second type of files, and running the updated second type of files in the memory to monitor the repaired target method.

7. The method according to claim 1, characterized in that Generating warning information according to the execution time information includes: determining index information according to the generation time point of the execution time information, wherein the index information includes information of a data table for storing the warning information; generating the warning information according to the execution time information and the index information; After generating the warning information according to the execution time information, the method further includes: sending the warning information to a target server, wherein the target server stores the warning information according to index information in the warning information, and displays the stored warning information through a human-computer interaction interface.

8. An exception handling device, characterized in that: include: A first acquisition module, configured to acquire execution time information of a target method of a distributed application, wherein the execution time information is obtained by monitoring the target method in a target virtual machine running the distributed application; A judgment module, used for judging whether the target method has an abnormality according to the execution time information; A generation module is used to generate warning information according to the execution time information when it is determined that the target method has an abnormality, wherein the warning information indicates that the target method in the distributed application has an abnormality.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the exception handling method described in any one of claims 1 to 7 when running.

10. An electronic device, characterized in that: The electronic device includes one or more processors; A memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the program is configured to execute the exception handling method described in any one of claims 1 to 7 when running.