A microservice fault analysis method, system, device and storage medium
By collecting and analyzing the running status data of microservices in real time, new microservices are created to reproduce the fault process, which solves the problem of difficulty in fault reproduction in large microservice systems, achieves fast and accurate fault location and reduces operation and maintenance costs. effect.
Patent Information
- Application Number
- CN202210725381.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-06-24
AI Technical Summary
In large-scale enterprise-level microservice systems, the recurrence and troubleshooting of microservice faults take a long time, and the existing fault location strategy based on log analysis is difficult to quickly and accurately identify the cause of the fault, especially in large and complex call links.
By collecting different levels of running status data of microservices in real time, create new microservices to reproduce the fault process, compare the running status data to determine the fault point, analyze the calling link and API service calling process, predict the abnormality probability, monitor and restart Route requests to ensure system stability.
It significantly reduces fault recurrence and troubleshooting time, improves the accuracy and efficiency of fault location, reduces the workload of operation and maintenance and R&D personnel, and reduces operation and maintenance costs.
Smart Images

Figure CN115114064B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computers, and in particular relates to a microservice fault analysis method, system, device and storage medium. Background Art
[0002] Microservice architecture is widely adopted in the industry. A large enterprise-level microservice is managed by a container orchestration system with hundreds of microservices, which respond to API requests by calling microservices. The large number of microservices and the complex calling links, including synchronous and asynchronous calls, mean that when a microservice fails, it takes a lot of time to reproduce and troubleshoot, in order to determine the scope of the troubleshooting.
[0003] In the existing implementation, fault diagnosis is performed based on the microservice system fault location strategy based on log analysis and visualization. BLA (Basic Log Analysis) and VLA (Visual Log Analysis) are structured and visualized, and fault location is performed using statistical charts. There are a variety of microservice system fault location strategies based on log analysis and visualization. Corresponding analysis tools have been built, and practical comparison and analysis have been carried out based on the reproduced fault cases. The time span from the start of the fault to the abnormal performance is large, and the number of call links is large and complex. When zero code is intruded, fault reproduction and retesting are difficult and time-consuming.
[0004] Therefore, an effective solution is urgently needed to solve the above problems. Summary of the invention
[0005] To solve the above problems, the present invention proposes a microservice fault analysis method, comprising:
[0006] Collect the running status data of different levels in microservices in real time, and use the running status data as the log data of microservices;
[0007] In response to a microservice failure, create a new microservice and reproduce the microservice operation process in the new microservice based on the log data;
[0008] The running status data generated by the running process of the new microservice is compared based on the log data, and the corresponding fault point is determined according to the comparison result.
[0009] In some embodiments of the invention, the method further comprises:
[0010] The log data is classified, the running status data of the same operation is compared, and the fault point is determined according to the comparison result.
[0011] In some embodiments of the present invention, real-time collection of operating status data at different levels of microservices and using the operating status data as log data of the microservices include:
[0012] Based on the operation process of the microservice, multiple key points are determined, and the state data corresponding to the microservice at the key points is recorded, and the state data is used as the log data of the microservice.
[0013] In some embodiments of the invention, the method further comprises:
[0014] Determine the call link of the microservice according to the log data, and determine whether the call link is an incomplete call link and / or an abnormal call link according to preset rules.
[0015] In some embodiments of the invention, the method further comprises:
[0016] The context information of the API service call process inside the microservice is analyzed according to the key points to determine the suspected location where the fault occurred.
[0017] In some embodiments of the present invention, the method further comprises
[0018] According to the version of the microservice, based on the call link return value of the corresponding microservice, the internal functions of the microservice under the version are analyzed and the corresponding unstable functions are determined.
[0019] In some embodiments of the invention, the method further comprises:
[0020] Analyze the corresponding link call relationship based on the log data and calculate the probability that the link call relationship causes the microservice to be abnormal based on the log data;
[0021] Based on the probability of the microservice being abnormal, the possibility of an abnormality in the call link of the running microservice is predicted and the predicted probability is given;
[0022] In response to the predicted probability reaching a predetermined value, saving the corresponding link call request and monitoring the feedback status of the microservice of the call request to the request;
[0023] In response to the feedback status failure, the saved link request is sent to a microservice that provides the same service.
[0024] Another aspect of the present invention further provides a microservice fault analysis system, comprising:
[0025] A log collection module, wherein the log collection module is configured to collect operation status data of different levels in the microservice in real time, and use the operation status data as log data of the microservice;
[0026] A fault reproduction module, wherein the fault reproduction module is configured to create a new microservice in response to a microservice failure and reproduce the microservice operation process in the new microservice based on the log data;
[0027] A fault analysis module is configured to compare the running status data generated by the new microservice running process based on the log data, and determine the corresponding fault point according to the comparison result.
[0028] Another aspect of the present invention further provides a computer device, comprising:
[0029] at least one processor; and
[0030] A memory, wherein the memory stores computer instructions that can be executed on the processor, and when the instructions are executed by the processor, the steps of the method described in any one of the above-mentioned embodiments are implemented.
[0031] Another aspect of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any one of the methods described in the above-mentioned embodiments are implemented.
[0032] A microservice fault analysis method proposed in the present invention collects operation data or operation status data of key positions in the operation process of a microservice. When a microservice fails, a new microservice is created using the collected operation data or operation status data, and the operation process of the corresponding microservice is reproduced using the collected operation data. At the same time, the operation status data of the reproduced microservice is collected to analyze the cause of the failure. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 A method flow chart of a microservice fault analysis method provided by an embodiment of the present invention;
[0035] Figure 2 A schematic diagram of the system structure of a microservice fault analysis system provided by an embodiment of the present invention.
[0036] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention.
[0037] Figure 4 A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0039] The present invention is applied to the field of fault analysis, specifically refers to the analysis after the failure occurs after the microservice project is put into operation. Different from the debug process in the project development stage, in the traditional implementation mode, the cause of the failure of the microservice can only be analyzed by collecting the operation log of the microservice and based on the collected log. However, for large-scale enterprise-level microservices, there may be hundreds or thousands of microservices in a system. According to the traditional analysis method, the microservice log of the failure is analyzed and the cause of the problem can only be inferred according to the content recorded in the log. For example, in the existing implementation scheme, by collecting the data transfer process between each function in the operation of the microservice, that is, the input parameter and return value of each function, when the microservice has a problem, the collected data is verified in the form of function call to determine which function nodes have problems in the operation of the corresponding microservice, so as to realize the fault analysis of the microservice. This implementation mode requires the operation and maintenance personnel to extract the corresponding function code of the function code of the corresponding microservice according to the call link formed by the collected data, and then form a new test project (forming multiple functions into an execution program), different call links form different test projects, and finally pass the collected data to the formed test project in the form of debug to simulate the "call link" of the corresponding function. Although this method can effectively identify which function nodes in the collected data have errors (assuming that there are errors in the collected data, but the code logic is normal, this method can be used to find out which functions collected during the microservice runtime have error return values), it cannot reflect why the code running in the microservice is wrong (assuming that the code logic is normal, the code logic of the project that is generally online rarely has abnormalities). Therefore, it is difficult to confirm the cause of the problem in a timely and effective manner (that is, the code logic is normal, but the microservice fails frequently), and when using traditional log analysis, the requirements for analysts are also very high. In some cases, R&D personnel may be required to analyze the logs of the faulty microservice. It takes up the development time of R&D personnel. As mentioned above, different test items for the code call process are formed for different function call links. The permutations and combinations of functions and the large number of microservices will increase the operation and maintenance costs.
[0040] like Figure 1 As shown, in order to solve the above problems, the present invention proposes a microservice fault analysis method, including:
[0041] Step S1: collect the running status data of different levels in the microservice in real time, and use the running status data as the log data of the microservice;
[0042] Step S2: in response to a failure of a microservice, create a new microservice and reproduce the microservice operation process in the new microservice based on the log data;
[0043] Step S3: comparing the running status data generated by the new microservice running process based on the log data, and determining the corresponding fault point according to the comparison result.
[0044] In an embodiment of the present invention, in step S1, collecting the running status data of different levels in the microservice in real time means collecting the running data of the microservice in different dimensions, including the request received by the microservice and the result given according to the request, and some internal data generated by the microservice during the whole process of processing the request after the request reaches the microservice. The so-called internal data includes the input parameters and return values of each function when calling between internal functions of the microservice, and also includes the intermediate data of the key nodes of the internal execution process of the function. For example, taking the user authentication microservice as an example, after the authentication request is sent from the front end, the request contains data content such as account and password, and the transmitted account and password will be recorded as log data, and the user authentication microservice will query the database according to the account and password, and the query instruction sent to the database will also be recorded in the log data, and the data content returned by the database will also be recorded in the log data. After receiving the data returned by the corresponding database and the account and password sent by the front section, the user authentication microservice will be verified after calculation, and the verification result will also be used as the micro-running status data of different levels of the microservice as log data. Furthermore, the running status data of different levels in the embodiment of the present invention can be set differently according to the different businesses of the microservices. In the above example, the following data contents are used as the running status data of the user authentication microservice during the user authentication process: the account password sent by the front end, the query instruction sent to the database after the user authentication microservice receives the account password, the query data returned from the database, and the verification result calculated by the user authentication microservice based on the query data returned by the database and the account password. The running status data of different levels of microservices with different business types can be flexibly selected according to different microservices.
[0045] In some embodiments of the present invention, the log data in the present invention does not simply refer to the log data in a microservice or a container. When multiple microservices cooperate to complete the corresponding business, the log data will involve multiple microservices, that is, the log data appears in the form of a microservice call link.
[0046] In step S2, when a microservice fails, a blank microservice with exactly the same functions as the microservice is created, and the operation data of different levels collected on the failed microservice is run on the newly created microservice in the order of log records to simulate the microservice call to reproduce the operating environment and operating status of the microservice before the failure.
[0047] It should be noted that in the embodiments of the present invention, microservices are deployed in the form of containers, which is convenient for creating and porting corresponding microservices. Therefore, a new container can be created and the log data of the faulty microservice can be loaded in a reproducible manner to simulate the operation process of the microservice before the failure.
[0048] In step S3, the running status of the newly created microservice is monitored, and the running status data of the newly created microservice is also collected, and then compared with the running status data in the log data of the failed microservice to find out the abnormal points.
[0049] In some embodiments of the present invention, the number of created microservices may be more than one, that is, according to the call chains of microservices with different faults, other microservices involved are also created together.
[0050] In some embodiments of the invention, the method further comprises:
[0051] The log data is classified, the running status data of the same operation is compared, and the fault point is determined according to the comparison result.
[0052] In this embodiment, as mentioned above, the call link refers to the request link or access link between microservices. In some cases, some businesses require multiple microservices to cooperate to complete, and the access process of multiple microservices under the business is fixed or the data transmitted is the same, for example, they are all instruction-type requests. Therefore, the call chain of the log data can be classified, and the same call link (a link that satisfies a business, for example, microservice 1 calls microservice 2, and microservice 2 then accesses microservice 3, that is, the part of the link from microservice 1→microservice 2→microservice 3) or the same business in terms of business can be compared with each other, that is, the running status data on the call links of multiple "microservice 1→microservice 2→microservice 3" are compared. If the data recorded in the above link at microservice 3 of a certain call link after classification is different from the data recorded in microservice 3 of other call links after classification, it means that the output data of microservice 3 when processing the classified call link is abnormal, which may be a trigger factor that directly causes the microservice failure, or it may be that the output data in the subsequent link of the microservice causes other microservices to report errors after receiving the output data, thereby triggering the microservice failure. Therefore, the fault point can be found through the above process based on the comparison of the call links in the log data.
[0053] In some embodiments of the present invention, real-time collection of operating status data at different levels of microservices and using the operating status data as log data of the microservices include:
[0054] Based on the operation process of the microservice, multiple key points are determined, and the state data corresponding to the microservice at the key points is recorded, and the state data is used as the log data of the microservice.
[0055] In this embodiment, the collection of running status data in the microservice can be further refined. In order to realize the internal running data of the microservice, the present invention sets multiple key points inside the microservice, including: the entrance of the microservice, that is, the request received by the microservice and the request content; the key points that affect the normal operation of the microservice during the internal operation of the microservice, such as the authentication service for the request; the data transmitted to the microservice from the request content received by the microservice; the data corresponding to multiple key operations in the core function module of the microservice, and the return value or output value of the core function module; the return value fed back by the microservice to other callers (microservices).
[0056] In some embodiments of the present invention, the above-mentioned key points are just 5 types of key points set according to the operation process of the microservice, not just 5 data. Each key point may contain different data depending on the microservice. For example, the key points corresponding to the core functions, in some embodiments, are to collect the entry parameters and return values of the functions involved in all core functions at the code level.
[0057] In some embodiments of the present invention, a plurality of important operation data or operation results in the internal process of the core function are collected and recorded, so as to facilitate the subsequent analysis of whether the operation of the core function is normal through the recorded plurality of important operation data.
[0058] In some embodiments of the invention, the method further comprises:
[0059] Determine the call link of the microservice according to the log data, and determine whether the call link is an incomplete call link and / or an abnormal call link according to preset rules.
[0060] In this embodiment, the call link of the corresponding microservice is determined from the access records of the microservice accessing other microservices in multiple microservice log data, and the return value or feedback information of the accessed microservice is used as the basis for judging the integrity or abnormality of the call link.
[0061] In particular, the return value or feedback information of the accessed microservice is not necessarily fed back to the calling microservice. It is possible that the accessed microservice accesses another microservice, which then feeds back to the caller (the microservice that initiated the access). That is, microservice 1 calls microservice 2, and microservice 2 does not feed back to microservice 1, but calls microservice 3, which then feeds back the corresponding data to microservice 1. The preset rules include the calling relationship of microservices, and even for the same microservices, the calling links are different under different business requests. Therefore, it is necessary to sort out the calling link relationship according to the preset rules. This is to accurately determine incomplete calling links or abnormal calling links. This is to prevent the situation where the feedback values of different requests are mistakenly sent to other microservices due to complex calling links.
[0062] In some embodiments of the invention, the method further comprises:
[0063] The context information of the API service call process inside the microservice is analyzed according to the key points to determine the suspected location where the fault occurred.
[0064] In this embodiment, the internal API of a microservice refers to the structural interface or the program or function interface of the internal module of the microservice. Context information refers to information such as the input data and output data of the API. The minimum granularity of the multiple key points corresponding to the above-mentioned multiple classifications is the API interface data of each module inside the microservice. In some cases, the data of the input parameters or key parameters in one or more functions inside the API of each module can also be collected. Therefore, in the lowest case, it can be determined whether the corresponding module in the microservice has an error based on the above-mentioned key point data. For example, a microservice can be divided into three modules, and the three modules provide three calling interfaces (APIs), which can be provided to the outside of the microservice and used internally by the microservice. When a microservice fails, the input data or output data of the three interfaces, that is, the context, can be used to confirm which module has a problem, that is, the suspicious location.
[0065] In some embodiments of the invention, if the collected operating data includes key data in the internal logical flow of a key function, then when the microservice is reproduced, the key data corresponding to the reproduced microservice runtime is also compared with the collected key data. For example, the characteristic values of the output of each layer of the neural network during the operation of certain inference microservices are collected as key data.
[0066] In some embodiments of the present invention, the method further comprises
[0067] According to the version of the microservice, based on the call link return value of the corresponding microservice, the internal functions of the microservice under the version are analyzed and the corresponding unstable functions are determined.
[0068] In this embodiment, when the collected running status data of the microservice is sufficiently detailed, that is, it can include the input and output data of all functions of all programs running in the microservice at the source level (that is, the input parameters and return values of the function) or the values of certain key variables of key nodes inside the function, it is possible to determine in a verified manner during the reproduction process which functions in the current version of the microservice will become unstable as the running time accumulates or the number of running tasks increases, that is, cache data out of bounds, parameter boundary overflow, etc.
[0069] In some embodiments of the present invention, it should be noted that there are two ways to reproduce the collected runtime data. One is to reproduce the call link and corresponding data in the log data in a new microservice according to the call method recorded in the log data according to the time interval in the log data, so as to fully reflect the data access pressure of the microservice, that is, if there are 100 requests within 1 second, 100 requests are simulated and sent to the corresponding microservice.
[0070] In addition, the other method is not to follow the time interval recorded in the log data, but to wait until a call link or a request is completed before proceeding to the next call link or request. This can be used to identify which functions have unstable situations such as function call stack overflow or cache data out of bounds under high concurrency, that is, to find the corresponding unstable functions.
[0071] In some embodiments of the present invention, the above two microservice reproduction methods can be performed simultaneously and compared with each other according to the data generated by the corresponding call link in the log data, so as to analyze the possibility of abnormalities in certain functions between microservices and within microservices under the generation environment such as task operation pressure. That is, it is not a code logic problem but due to insufficient consideration of function processing capabilities during development, including: too much data, insufficient space, function call stack exceptions, variable exceptions during forced conversion, etc., due to the influence of unknown factors caused by the strange data in the task requested by the user during actual operation.
[0072] That is, through the above two reproduction methods, we can find unstable functions under the accumulation of running time, accumulation of running times and high pressure of microservice access requests, and verify the correctness of the results of the corresponding functions.
[0073] In some embodiments of the invention, the method further comprises:
[0074] Analyze the corresponding link call relationship based on the log data and calculate the probability that the link call relationship causes the microservice to be abnormal based on the log data;
[0075] Based on the probability of the microservice being abnormal, the possibility of an abnormality in the call link of the running microservice is predicted and the predicted probability is given;
[0076] In response to the predicted probability reaching a predetermined value, saving the corresponding link call request and monitoring the feedback status of the microservice of the call request to the request;
[0077] In response to the feedback status failure, the saved link request is sent to a microservice that provides the same service.
[0078] In this embodiment, after the cause of the microservice exception is obtained by reproducing the collected running status data with a new microservice, the probability of an exception in accessing the corresponding microservice is determined based on the determined number of microservice failures (based on the time interval pressure, i.e., based on the accumulation of running time or the increase in the number of running times), and the access link of the running microservice is predicted based on the probability of the exception.
[0079] Furthermore, when the operating pressure of a microservice reaches a certain level (accumulated operating time or increased number of operating times), and the predicted probability of failure of the microservice reaches the corresponding warning value, the requests sent by other running microservices to the microservice can be temporarily saved while waiting for the microservice, and the status of the microservice can be monitored. If an abnormality occurs, the temporarily saved request will be sent to other microservices with the same function as the microservice. The functions of the microservice are provided by other microservices to ensure the normal operation of the business system.
[0080] Example:
[0081] Use the operation history records of all microservices in the microservice system recorded by the log management service to quickly and accurately reproduce the fault. The log management service records all historical operations of the microservice system and records the operation information of each microservice in detail, including the microservice API, microservice input parameters, microservice return value, operation user and other information. Based on this information, the fault can be quickly reproduced in the order of the operation arrival time. After the fault occurs, in the reproduction environment, the reproduction service will perform these operations one by one according to the operation log recorded by the log service, according to the operator and time order, and restore the operation content.
[0082] In the microservice system of this solution, business service 1 is the reasoning service, business service 2 is the user management service, and business service 3 is the image distribution service. After user 1 logs in to the system, he uses the image distribution service to upload the business image. The log service saves n records, as shown in Table 1:
[0083]
[0084] Table 1
[0085] The inference service uses the image to create the inference service, and the log service saves n operation records, as shown in Table 2:
[0086]
[0087] Table 2
[0088] When the inference service uses the image to create the n+1th inference service, the inference service exits abnormally. The log service does not record the complete process of this operation. As shown in Table 3, the n+1th inference service operation only records the start call but not the return result. The fault has been reproduced, the inference service is exited, and an incomplete link occurs.
[0089]
[0090] Table 3
[0091] Further real-time trajectory analysis service: According to the records of the log service, find the incomplete call links and abnormal call links of the system microservices, find the suspected location of the fault, determine the microservice and API where the fault occurred, and then analyze the context information of the API service call process inside the service through the key points recorded by the log management service to determine the suspected starting location of the fault. The key points inside the service refer to the important variables that identify the service, function return values, variables that determine the service call branch, and identifiers that affect other microservices. The key points are important stage status information in the process of executing the API service call. The key point information in the normal API call process is compared with the abnormal information. The difference in the key points can determine the specific starting location of the fault inside the service.
[0092] When the fault occurs, the inference service has an incomplete call link. There is only the start of the service call, no result is returned, and the status codes of the previous multiple microservice calls are normal. Therefore, it is suspected that the fault occurred during the n+1 inference service API call process. To determine that the fault occurred during the n+1 service call process, it is also necessary to determine the specific location information of the fault in the service based on the status value of the key points inside the service. There are 5 key points in the service to record logs:
[0093] The first key point: the starting position of the service call entry, recording the service entry, the environment variable value, the incoming parameter value,
[0094] The second key point: whether the return value of calling other services within the service, that is, calling the authentication service, is correct.
[0095] The third key point: Check whether the input parameters are correct, including whether the input parameters and the total amount of business resources are valid.
[0096] The fourth key point: Create an inference service to modify the operation process and return information.
[0097] The fifth key point: Is the service return value correct? The previous nth call is a normal call process, and the log information is the correct call log information. Compare the n+1th partial log information.
[0098] The first key point service call entry starting position record is similar to the nth and n+1th times, and there is no exception. The second key point calls the status code of other service return values normally. The third key point parameter and business resource validity check is normal. The nth function execution service return check is normal, and the n+1th check function does not receive the return value. It is preliminarily judged that the third key point in the n+1th service call is the scope of the fault. The logic of the nth and n+1th incoming parameters and business resource check codes is the same, and the difference is the number of executions. The static analysis service can be used to analyze the cause of the third key point return value failure. .
[0099] Further, according to the service version, static analysis is performed on the code call relationship, the service call link return value, and functions with unstable return values as time and execution times increase, cache data out of bounds, parameter boundary value judgment, etc. Use static analysis services to analyze functions whose return value data expands due to the increase in input parameters of microservice internal functions, because the service needs to judge the arrangement of n+1 data, and select the arrangement method with the smallest total resource usage according to the optimal algorithm. As time and execution times increase, the arranged output data will expand dramatically, causing failures and service exit. Static analysis services can provide a way to find uncertain factors in the code and give possible causes of failures.
[0100] Further analyze the possible link call relationship based on the historical trajectory log. Combine the possible call chain given by the prediction service to expand the call chain analyzed by the real-time trajectory analysis service and expand the possible fault cause.
[0101] The present invention proposes a microservice fault analysis method to collect operation data or operation status data of key positions in the operation process of the microservice. When a microservice fails, a new microservice is created through the collected operation data or operation status data, and the operation process of the corresponding microservice is reproduced through the collected operation data. At the same time, the operation status data of the reproduced microservice is collected to analyze the cause of the failure. The problem of the difficulty of reproducing the failure of complex and large call links is solved, the reproduction time is reduced, and after the failure is reproduced, the method of accurately finding the problematic call link in a large number of complex call links is solved.
[0102] Compared with the prior art, fault analysis is performed in the form of a call chain formed by the call relationship of the function in the microservice. The present invention can be performed by the corresponding operation and maintenance personnel to create one or more containers and create corresponding microservices in the container, and further send the collected operation data to the created microservice through a general test tool and obtain the corresponding return result and compare it with the collected operation data for fault analysis, or compare the operation results of multiple groups of reproducing microservices (simulating normal request pressure and not simulating corresponding request pressure) to obtain the cause of the fault. No need to operate at the code level, a multi-angle fault analysis service can be realized. After the project code is developed (a function interface for collecting data is embedded in the project code), the subsequent fault analysis function can be realized, and the development will benefit for life. Solve the problems of difficult retesting, long time consumption, and high requirements for analysts in the existing microservice fault analysis technology. At the same time, it is easier to show the design defects of the microservice architecture to the operation and maintenance personnel or developers in the case of huge task volume or cumulative running time through the reproduction method.
[0103] like Figure 2 As shown, another aspect of the present invention further provides a microservice fault analysis system, comprising:
[0104] A log collection module 1, wherein the log collection module 1 is configured to collect operation status data of different levels in the microservice in real time, and use the operation status data as log data of the microservice;
[0105] A fault reproduction module 2, wherein the fault reproduction module 2 is configured to create a new microservice in response to a microservice failure and reproduce the microservice operation process in the new microservice based on the log data;
[0106] The fault analysis module 3 is configured to compare the operation status data generated by the new microservice operation process based on the log data, and determine the corresponding fault point according to the comparison result.
[0107] like Figure 3 As shown, another aspect of the present invention further provides a computer device, comprising:
[0108] at least one processor 21; and
[0109] The memory 22 stores computer instructions 23 that can be run on the processor 21 , and when the instructions 23 are executed by the processor 21 , the steps of any one of the methods in the above-mentioned implementation manner are implemented.
[0110] like Figure 4As shown, another aspect of the present invention further provides a computer-readable storage medium 401, wherein the computer-readable storage medium 401 stores a computer program 402, and when the computer program is executed by a processor, the steps of any one of the methods in the above-mentioned implementation manners are implemented.
[0111] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0112] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.
[0113] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0114] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0115] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as described above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A microservice fault analysis method, characterized in that: include: Collect the running status data of different levels in microservices in real time, and use the running status data as the log data of microservices; In response to a microservice failure, create a new microservice and reproduce the microservice operation process in the new microservice based on the log data; Comparing the running status data generated by the running process of the new microservice based on the log data, and determining the corresponding fault point according to the comparison result; The real-time collection of running status data at different levels in the microservices and using the running status data as log data of the microservices includes: Determine multiple key points based on the operation process of the microservice, record the state data of the microservice at the key points, and use the state data as log data of the microservice; Determine a call link of a microservice according to the log data, and judge whether the call link is an incomplete call link and / or an abnormal call link according to a preset rule, wherein the preset rule includes a call relationship of the microservice; Analyze the context information of the microservice internal API service call process according to the key points to determine the suspected location where the fault occurred, wherein the microservice internal API is a structural interface or a program or function interface of a microservice internal module, and the context information is the input data and output data of the API; According to the version of the microservice, based on the call link return value of the corresponding microservice, the internal functions of the microservice under the version are analyzed and the corresponding unstable functions are determined. When the collected running status data of the microservice is sufficiently detailed, that is, it can include the input and output data of all functions of all programs running in the microservice at the source generation level or the values of some key variables of key nodes inside the function, it can be determined in a verified manner during the reproduction process which functions in the current version of the microservice will become unstable with the accumulation of running time or the number of running tasks; The method also includes: Analyze the corresponding link call relationship based on the log data and calculate the probability that the link call relationship causes the microservice to be abnormal based on the log data; Based on the probability of the microservice being abnormal, the possibility of an abnormality in the call link of the running microservice is predicted and the predicted probability is given; In response to the predicted probability reaching a predetermined value, saving the corresponding link call request and monitoring the feedback status of the microservice of the call request to the request; In response to the feedback status failure, the saved link request is sent to a microservice that provides the same service.
2. The method according to claim 1, characterized in that Also includes: The log data is classified, the running status data of the same operation is compared, and the fault point is determined according to the comparison result.
3. A microservice fault analysis system, characterized in that: include: A log collection module, wherein the log collection module is configured to collect operation status data of different levels in the microservice in real time, and use the operation status data as log data of the microservice; A fault reproduction module, wherein the fault reproduction module is configured to create a new microservice in response to a microservice failure and reproduce the microservice operation process in the new microservice based on the log data; A fault analysis module, wherein the fault analysis module is configured to compare the running status data generated by the running process of the new microservice based on the log data, and determine the corresponding fault point according to the comparison result; The log collection module is also configured to: Determine multiple key points based on the operation process of the microservice, record the state data of the microservice at the key points, and use the state data as log data of the microservice; Determine a call link of a microservice according to the log data, and judge whether the call link is an incomplete call link and / or an abnormal call link according to a preset rule, wherein the preset rule includes a call relationship of the microservice; Analyze the context information of the microservice internal API service call process according to the key points to determine the suspected location where the fault occurred, wherein the microservice internal API is a structural interface or a program or function interface of a microservice internal module, and the context information is the input data and output data of the API; According to the version of the microservice, based on the call link return value of the corresponding microservice, the internal functions of the microservice under the version are analyzed and the corresponding unstable functions are determined. When the collected running status data of the microservice is sufficiently detailed, that is, it can include the input and output data of all functions of all programs running in the microservice at the source generation level or the values of some key variables of key nodes inside the function, it can be determined in a verified manner during the reproduction process which functions in the current version of the microservice will become unstable with the accumulation of running time or the number of running tasks; The fault analysis module is also configured to: Analyze the corresponding link call relationship based on the log data and calculate the probability that the link call relationship causes the microservice to be abnormal based on the log data; Based on the probability of the microservice being abnormal, the possibility of an abnormality in the call link of the running microservice is predicted and the predicted probability is given; In response to the predicted probability reaching a predetermined value, saving the corresponding link call request and monitoring the feedback status of the microservice of the call request to the request; In response to the feedback status failure, the saved link request is sent to a microservice that provides the same service.
4. A computer device, characterized in that: include: at least one processor; as well as A memory, wherein the memory stores computer instructions executable on the processor, wherein the instructions, when executed by the processor, implement the steps of the method according to any one of claims 1 to 2.
5. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.
