Distributed interface defect detection method and system for microservice architecture

By integrating distributed tracking, deep learning and graph analysis technologies in the microservice architecture, we will build a distributed interface defect detection method, which solves the problems of insufficient accuracy of interface defect detection and limited failure propagation prediction capabilities in the microservice architecture, and achieves more efficient fault detection and early warning capabilities.

CN119248632BActive Publication Date: 2025-03-14JIANGSU FANGZHE TESTING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411776455.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-03-14
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

In the microservice architecture, the lack of accuracy in interface defect detection, limited failure propagation prediction capability, and inflexible early warning thresholds lead to difficulties in system fault detection and positioning, affecting the availability and reliability of the system.

Method used

By integrating distributed tracking, deep learning and graph analysis technologies, a distributed interface defect detection method and system for microservice architecture is built. The method includes deploying a distributed tracking probe to collect interface call data, building a service call topology diagram, extracting call link features, using a long and short-term memory neural network and graph attention network to extract timing dependency features and relationship features between nodes, generating a status vector of the service node, and inputting a fault propagation prediction model to output the fault occurrence probability and propagation direction.

Benefits of technology

It improves the accuracy and efficiency of fault detection and early warning, can detect potential faults earlier and accurately locate the source of faults, reduce the impact of faults on the system, and improves the stability and availability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248632B_ABST
    Figure CN119248632B_ABST
Patent Text Reader

Abstract

The present invention provides a distributed interface defect detection method and system for microservice architecture, which relates to the field of microservice technology, including collecting interface call data by deploying distributed tracing probes, building a service call topology map; inputting a feature sequence matrix into a long short-term memory neural network to extract temporal dependency features, combining a graph attention network to calculate the attention weight coefficients between nodes and fuse node features to generate a state vector; calculating the fault situation vector of a service node based on a fault propagation prediction model, building a fault propagation path map, and locating and warning the fault source; and realizing dynamic scheduling of microservice nodes by dynamically calibrating the warning threshold and continuously optimizing the prediction model. The method improves the accuracy of fault prediction, effectively reduces the risk of fault propagation, and enhances system reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to microservice technology, and in particular to a distributed interface defect detection method and system for a microservice architecture. Background Art

[0002] With the widespread deployment of microservice architecture in enterprise application systems, the complex call relationships and dependencies between service components make system fault detection and location increasingly difficult. In a microservice architecture, defects in a single service interface may spread through the system through service call relationships, leading to cascading failures and seriously affecting the availability and reliability of the system. Therefore, it is of great significance to accurately detect and promptly warn interface defects in microservice architecture.

[0003] The existing microservice interface defect detection methods mainly have the following problems: First, traditional fault detection methods often only focus on the status monitoring of a single service node, and fail to fully consider the calling relationship between services and the fault propagation characteristics, resulting in insufficient accuracy of the detection results; second, the existing methods lack dynamic feature analysis of the service call link, and cannot effectively capture the evolution of faults in time and space dimensions, affecting the timeliness of fault warning; third, the existing fault warning mechanisms generally use static thresholds, which fail to dynamically adjust according to the system operation status, and easily cause false alarms or missed alarms.

[0004] This invention aims to solve the technical problems of insufficient interface defect detection accuracy, limited fault propagation prediction capability, and inflexible warning thresholds in microservice architecture. By integrating distributed tracing, deep learning, and graph analysis technologies, a detection method is established that can accurately identify interface defects, effectively predict fault propagation paths, and support dynamic threshold optimization, thereby improving the system's fault detection and warning capabilities. Summary of the invention

[0005] The embodiments of the present invention provide a distributed interface defect detection method and system for a microservice architecture, which can solve the problems in the prior art.

[0006] In a first aspect of the present invention,

[0007] Provides a distributed interface defect detection method for microservice architecture, including:

[0008] Deploy distributed tracing probes to collect microservice interface call data, where the interface call data includes call timestamp, request identifier, source service identifier, target service identifier, call status code, and response time; construct a service call topology graph based on the interface call data, where the nodes of the service call topology graph represent microservice instances, and the edges represent the call relationships between services; extract call link features based on the service call topology graph, where the call link features include link length, call depth, number of concurrent connections, error rate distribution, and average response time; calculate the time series variation features of the call link features through a sliding time window to obtain a feature sequence matrix;

[0009] Input the feature sequence matrix into the long short-term memory neural network to extract the timing dependency features; input the timing dependency features and the service call topology graph into the graph attention network to calculate the attention weight coefficients between nodes; fuse the node features based on the attention weight coefficients to generate the state vector of the service node; input the state vector into the fault propagation prediction model, and the fault propagation prediction model outputs the probability of fault occurrence and the propagation direction; use the cross entropy loss function to train the fault propagation prediction model, and update the model parameters through the back propagation algorithm;

[0010] The fault situation vector of the service node is calculated based on the fault propagation prediction model, and the fault situation vector includes the fault occurrence probability, the propagation risk coefficient, and the node importance; a fault propagation path diagram is constructed according to the fault situation vector, and the high-risk propagation path is marked; when a fault is detected, the fault source node is located based on the high-risk propagation path, and the fault impact range is predicted; the output probability of the fault propagation prediction model is used to calibrate the fault warning threshold; the fault propagation prediction model is continuously optimized according to the actual fault propagation situation to improve the prediction accuracy; and the microservice nodes are dynamically scheduled based on the fault situation vector to reduce the risk of fault propagation.

[0011] A service call topology graph is constructed based on the interface call data, wherein the nodes of the service call topology graph represent microservice instances, and the edges represent the call relationships between services; call link features are extracted based on the service call topology graph, wherein the call link features include link length, call depth, number of concurrent connections, error rate distribution, and average response time; and the time series variation features of the call link features are calculated through a sliding time window, and a feature sequence matrix is ​​obtained, including:

[0012] Collect microservice interface call data through a distributed tracing system, wherein the microservice interface call data includes a call timestamp, a target service identifier, a call status code, and a response time; construct a service call topology graph based on the microservice interface call data, wherein the nodes of the service call topology graph represent microservice instances, and the edges of the service call topology graph represent call relationships between services, and the weight information of the edges includes call frequency information and response time information; use an adjacency matrix to store direct call relationships between services in the service call topology graph, and calculate a k-step reachability matrix between services based on the adjacency matrix, wherein the k-step reachability matrix is ​​used to characterize indirect call relationships between services;

[0013] Based on the k-step reachability matrix, the Floyd-Warshall algorithm is used to calculate the shortest call path length between any service pairs, and the depth-first search algorithm is used to traverse the service nodes of the service call topology graph to obtain the maximum call level. The sum of the in-degree and out-degree of the service nodes is counted to obtain the number of concurrent connections. Based on the weight information of the edge, the call failure ratio per unit time is calculated to obtain the error rate distribution. Based on the timestamp information in the weight information of the edge, the average response time of the service call is calculated; the shortest call path length, the maximum call level, the number of concurrent connections, the error rate distribution, and the average response time constitute topological features;

[0014] A sliding time window is set, and a time series analysis is performed on the topological features based on the sliding time window. The feature changes between adjacent time windows are calculated to obtain differential features. The mean, variance, skewness, and kurtosis of the features in the sliding time window are calculated to obtain statistical features. The frequency components of the feature sequence are extracted by fast Fourier transform to obtain periodic features. The Pearson correlation coefficient and mutual information between different features are calculated to obtain correlated features. A feature sequence matrix is ​​constructed by combining the differential features, the statistical features, the periodic features, and the correlated features. The feature mean and variance are calculated using exponentially weighted moving average, and the feature sequence matrix is ​​online standardized to obtain a standardized feature sequence matrix.

[0015] Inputting the feature sequence matrix into a long short-term memory neural network to extract time-dependent features; inputting the time-dependent features and the service call topology graph into a graph attention network to calculate the attention weight coefficients between nodes; fusing node features based on the attention weight coefficients to generate a state vector of a service node includes:

[0016] Input a feature sequence matrix into a bidirectional long short-term memory neural network, wherein the feature sequence matrix includes multi-dimensional historical time series features, and the bidirectional long short-term memory neural network includes a forward long short-term memory layer and a backward long short-term memory layer, each layer includes three gating structures: an input gate, a forget gate, and an output gate, wherein the input gate controls the input ratio of new information at the current moment, the forget gate controls the retention ratio of historical information, and the output gate controls the output ratio of information at the current moment, and dynamically adjusts feature weights based on the three gating structures to generate time series dependent features;

[0017] Input the timing dependency features and the service call topology graph into a graph attention network, wherein the graph attention network comprises a plurality of attention layers, each of the attention layers comprises a plurality of attention heads, each of the attention heads calculates an attention correlation coefficient between a pair of nodes based on a shared attention vector and a linear transformation matrix, and inputs the attention correlation coefficient into a softmax function to obtain a normalized attention weight coefficient;

[0018] Based on the normalized attention weight coefficient, the node features are weighted and summed to obtain a fused feature, and the fused features of multiple attention heads are spliced ​​to obtain a new feature representation of the node, and the new feature representation contains topological association information between nodes; the new feature representation is input into a multilayer perceptron, the middle layer of the multilayer perceptron uses a ReLU activation function, and the output layer uses a tanh activation function to generate a state vector of the service node, and the value range of the state vector of the service node is between [-1,1].

[0019] Inputting the state vector into a fault propagation prediction model, the fault propagation prediction model outputs a fault occurrence probability and a propagation direction; training the fault propagation prediction model using a cross entropy loss function, and updating the model parameters using a back propagation algorithm include:

[0020] Input the state vector of the service node into the fault propagation prediction model, wherein the fault propagation prediction model comprises three fully connected layers, wherein the number of neurons in the three fully connected layers is 512, 256, and 128 respectively, and a LeakyReLU activation function is connected after the first two fully connected layers, wherein the negative semi-axis slope of the LeakyReLU activation function is 0.1;

[0021] The output of the fully connected layer is divided into a fault occurrence probability prediction branch and a fault propagation direction prediction branch, wherein the fault occurrence probability prediction branch outputs a fault occurrence probability value through a sigmoid activation function, and the fault propagation direction prediction branch outputs a fault propagation direction probability distribution through a softmax function;

[0022] The binary cross entropy loss is calculated by combining the fault occurrence probability value with the true fault label, and the multi-class cross entropy loss is calculated by combining the fault propagation direction probability distribution with the true propagation direction probability distribution. The total loss function is obtained by combining the binary cross entropy loss and the multi-class cross entropy loss based on a weight factor, and the value of the weight factor is 0.6;

[0023] The model parameters are updated through the back propagation algorithm, including: calculating the partial derivative of the total loss function with respect to the weight parameters of the fully connected layer to obtain the weight gradient; calculating the partial derivative of the total loss function with respect to the bias parameters of the fully connected layer to obtain the bias gradient; performing norm clipping on the weight gradient and the bias gradient to limit the gradient norm to the interval [-5,5]; accumulating the weight gradient and the bias gradient in 4 batches; and using an Adam optimizer to update the weight parameters and the bias parameters based on the accumulated weight gradient and the bias gradient, wherein the initial learning rate of the Adam optimizer is 0.001, and the learning rate is reduced to 0.1 times of the original value every 50 rounds of training.

[0024] The fault situation vector of the service node is calculated based on the fault propagation prediction model, and the fault situation vector includes the fault occurrence probability, the propagation risk coefficient, and the node importance; a fault propagation path diagram is constructed according to the fault situation vector, and a high-risk propagation path is marked; when a fault is detected, the fault source node is located based on the high-risk propagation path, and the fault impact range is predicted, including:

[0025] Calculate the fault situation vector of the service node based on the fault propagation prediction model, obtain the fault occurrence probability through the fault prediction branch of the fault propagation prediction model, calculate the information entropy of the fault propagation probability distribution between the node and the neighboring nodes to obtain the propagation risk coefficient, and the propagation risk coefficient is normalized by dividing the information entropy by the maximum entropy value; calculate the node importance based on the degree centrality, betweenness centrality and eigenvector centrality of the node, normalize the degree centrality, the betweenness centrality and the eigenvector centrality to the minimum-maximum value, and determine the weight coefficient through the hierarchical analysis method;

[0026] The fault occurrence probability is mapped to the node size, the node importance is mapped to the node color depth, and the propagation risk coefficient is mapped to the thickness of the edge to construct a fault propagation path diagram; a risk threshold is set, and the edge with a propagation risk coefficient greater than the risk threshold is marked as a high-risk propagation path;

[0027] When a fault is detected, a system status snapshot is obtained to determine a set of faulty nodes, each faulty node in the set of faulty nodes is traced back on the high-risk propagation path to construct a set of reversely reachable nodes, and the intersection of all the reversely reachable node sets is calculated to obtain a set of candidate fault source nodes; nodes in the set of candidate fault source nodes are screened based on the fault occurrence time series and propagation delay estimation;

[0028] The confidence score of each node in the candidate fault source node set as a fault source is calculated in combination with the fault situation vector, and the node with the highest confidence score is selected as the final fault source node; a breadth-first search is performed on the high-risk propagation path with the final fault source node as the starting point, and the time for the fault to propagate to each node is calculated. The severity of the node affected by the fault is evaluated based on the fault situation vector, and a time-layered fault impact range prediction diagram is generated for the affected nodes according to the time and the severity.

[0029] The output probability of the fault propagation prediction model is used to calibrate the fault warning threshold; the fault propagation prediction model is continuously optimized according to the actual fault propagation situation to improve the prediction accuracy; the microservice nodes are dynamically scheduled based on the fault situation vector to reduce the fault propagation risk, including:

[0030] Obtain the original predicted probability output by the fault propagation prediction model, map the original predicted probability to the actual fault distribution interval, and obtain the true distribution of the fault occurrence through probability density estimation; construct a calibration mapping function based on the true distribution, convert the original predicted probability into a calibrated predicted probability through the calibration mapping function, and use the calibrated predicted probability as a calibration benchmark for the fault warning threshold;

[0031] Collect actual fault propagation data during system operation, classify the actual fault propagation data according to fault type and propagation path, and extract feature vectors and propagation modes of each type of fault; update the fault propagation prediction model online based on the feature vectors and the propagation modes, and integrate new fault modes into the prediction model through incremental learning;

[0032] Calculate the fault situation vector of the microservice node, the fault situation vector includes the node failure probability, service dependency strength and load status; construct a node risk assessment matrix based on the fault situation vector, the node risk assessment matrix reflects the fault propagation risk between nodes;

[0033] The microservice nodes are grouped and isolated according to the node risk assessment matrix, and service instances with redundant backups are deployed in different fault domains; the dynamic health of the nodes is calculated based on the fault situation vector, and service requests are load-balanced among the nodes according to the dynamic health;

[0034] Continuously monitor the changes in the fault situation of the node, and when the fault situation vector indicator of the node exceeds the fault warning threshold, trigger the migration operation of the service instance; select the optimal migration target node based on the node risk assessment matrix, and reduce the overall fault propagation risk of the system by adjusting the service deployment structure.

[0035] The second aspect of the present invention,

[0036] Provides a distributed interface defect detection system for microservice architecture, including:

[0037] The first unit is used to deploy distributed tracing probes to collect microservice interface call data, wherein the interface call data includes a call timestamp, a request identifier, a source service identifier, a target service identifier, a call status code, and a response time; a service call topology graph is constructed based on the interface call data, wherein the nodes of the service call topology graph represent microservice instances, and the edges represent the call relationships between services; call link features are extracted based on the service call topology graph, wherein the call link features include link length, call depth, number of concurrent connections, error rate distribution, and average response time; and the time series variation features of the call link features are calculated through a sliding time window to obtain a feature sequence matrix;

[0038] The second unit is used to input the feature sequence matrix into the long short-term memory neural network to extract the timing dependency features; input the timing dependency features and the service call topology graph into the graph attention network to calculate the attention weight coefficients between nodes; fuse the node features based on the attention weight coefficients to generate the state vector of the service node; input the state vector into the fault propagation prediction model, and the fault propagation prediction model outputs the probability of fault occurrence and the propagation direction; use the cross entropy loss function to train the fault propagation prediction model, and update the model parameters through the back propagation algorithm;

[0039] The third unit is used to calculate the fault situation vector of the service node based on the fault propagation prediction model, wherein the fault situation vector includes the fault occurrence probability, the propagation risk coefficient, and the node importance; construct a fault propagation path diagram according to the fault situation vector, and mark the high-risk propagation path; when a fault is detected, locate the fault source node based on the high-risk propagation path, and predict the scope of the fault; calibrate the fault warning threshold using the output probability of the fault propagation prediction model; continuously optimize the fault propagation prediction model according to the actual fault propagation situation to improve the prediction accuracy; dynamically schedule the microservice nodes based on the fault situation vector to reduce the risk of fault propagation.

[0040] The third aspect of the present invention is:

[0041] An electronic device is provided, comprising:

[0042] processor;

[0043] a memory for storing processor-executable instructions;

[0044] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0045] In a fourth aspect of the present invention,

[0046] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.

[0047] The beneficial effects of this application are as follows:

[0048] Improve the accuracy and efficiency of fault detection and location: This invention uses distributed tracking data to build a service call topology map, and combines long short-term memory neural network and graph attention network to extract time-dependent features and node-to-node relationship features, which can more accurately predict the probability of fault occurrence and propagation direction. Compared with traditional threshold-based or rule-based fault detection methods, this invention can detect potential faults earlier and accurately locate the source of the fault, thereby reducing troubleshooting time and improving operation and maintenance efficiency.

[0049] Reduce the negative impact of failures: By constructing a fault propagation path map and marking high-risk propagation paths, the present invention can predict the scope of the fault, so as to take measures in advance, such as dynamically scheduling microservice nodes, isolating faulty nodes, etc., effectively reducing the impact of the fault on the entire system and improving the stability and availability of the system.

[0050] Continuous optimization and adaptive capabilities: The present invention uses the cross-entropy loss function to train the fault propagation prediction model, and continuously optimizes the model parameters and fault warning thresholds according to the actual fault propagation situation, so that it can adaptively respond to the ever-changing microservice environment, maintain a high prediction accuracy, and achieve long-term and effective fault management. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 It is a flow chart of a distributed interface defect detection method for microservice architecture according to an embodiment of the present invention;

[0052] Figure 2 It is a schematic diagram of the structure of a distributed interface defect detection system for a microservice architecture according to an embodiment of the present invention. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 are within the scope of protection of the present invention.

[0054] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0055] According to a first aspect of the embodiments of the present invention,

[0056] Figure 1 FIG. 1 is a flow chart of a distributed interface defect detection method for a microservice architecture according to an embodiment of the present invention. Figure 1 As shown, the method includes:

[0057] S11. Deploy distributed tracing probes to collect microservice interface call data, wherein the interface call data includes a call timestamp, a request identifier, a source service identifier, a target service identifier, a call status code, and a response time; construct a service call topology graph based on the interface call data, wherein the nodes of the service call topology graph represent microservice instances, and the edges represent the call relationships between services; extract call link features based on the service call topology graph, wherein the call link features include link length, call depth, number of concurrent connections, error rate distribution, and average response time; calculate the time series variation features of the call link features through a sliding time window to obtain a feature sequence matrix;

[0058] S12. Input the feature sequence matrix into the long short-term memory neural network to extract the timing dependency features; input the timing dependency features and the service call topology graph into the graph attention network to calculate the attention weight coefficients between nodes; fuse the node features based on the attention weight coefficients to generate the state vector of the service node; input the state vector into the fault propagation prediction model, and the fault propagation prediction model outputs the probability of fault occurrence and the propagation direction; use the cross entropy loss function to train the fault propagation prediction model, and update the model parameters through the back propagation algorithm;

[0059] S13. Calculate the fault situation vector of the service node based on the fault propagation prediction model, where the fault situation vector includes the probability of fault occurrence, the propagation risk coefficient, and the node importance; construct a fault propagation path diagram based on the fault situation vector, and mark the high-risk propagation path; when a fault is detected, locate the fault source node based on the high-risk propagation path, and predict the scope of the fault; calibrate the fault warning threshold using the output probability of the fault propagation prediction model; continuously optimize the fault propagation prediction model according to the actual fault propagation situation to improve the prediction accuracy; dynamically schedule microservice nodes based on the fault situation vector to reduce the risk of fault propagation.

[0060] In an optional implementation, a service call topology graph is constructed based on the interface call data, wherein the nodes of the service call topology graph represent microservice instances, and the edges represent the call relationships between services; call link features are extracted based on the service call topology graph, wherein the call link features include link length, call depth, number of concurrent connections, error rate distribution, and average response time; and the time series variation features of the call link features are calculated through a sliding time window to obtain a feature sequence matrix including:

[0061] Collect microservice interface call data through a distributed tracing system, wherein the microservice interface call data includes a call timestamp, a target service identifier, a call status code, and a response time; construct a service call topology graph based on the microservice interface call data, wherein the nodes of the service call topology graph represent microservice instances, and the edges of the service call topology graph represent call relationships between services, and the weight information of the edges includes call frequency information and response time information; use an adjacency matrix to store direct call relationships between services in the service call topology graph, and calculate a k-step reachability matrix between services based on the adjacency matrix, wherein the k-step reachability matrix is ​​used to characterize indirect call relationships between services;

[0062] Based on the k-step reachability matrix, the Floyd-Warshall algorithm is used to calculate the shortest call path length between any service pairs, and the depth-first search algorithm is used to traverse the service nodes of the service call topology graph to obtain the maximum call level. The sum of the in-degree and out-degree of the service nodes is counted to obtain the number of concurrent connections. Based on the weight information of the edge, the call failure ratio per unit time is calculated to obtain the error rate distribution. Based on the timestamp information in the weight information of the edge, the average response time of the service call is calculated; the shortest call path length, the maximum call level, the number of concurrent connections, the error rate distribution, and the average response time constitute topological features;

[0063] A sliding time window is set, and a time series analysis is performed on the topological features based on the sliding time window. The feature changes between adjacent time windows are calculated to obtain differential features. The mean, variance, skewness, and kurtosis of the features in the sliding time window are calculated to obtain statistical features. The frequency components of the feature sequence are extracted by fast Fourier transform to obtain periodic features. The Pearson correlation coefficient and mutual information between different features are calculated to obtain correlated features. A feature sequence matrix is ​​constructed by combining the differential features, the statistical features, the periodic features, and the correlated features. The feature mean and variance are calculated using exponentially weighted moving average, and the feature sequence matrix is ​​online standardized to obtain a standardized feature sequence matrix.

[0064] Distributed tracing systems, such as Jaeger or Zipkin, collect microservice interface call data. These data include the timestamp of each call, the target service identifier (such as the service name), the call status code (such as 200 for success and 500 for error), and the response time.

[0065] Use the collected call data to build a service call topology graph. The nodes of the graph represent microservice instances (service A, service B, service C), and the edges represent the call relationships between services. The weight of the edge includes the call frequency and the average response time. For example, if service A calls service B 10 times and the average response time is 20ms, the edge weight from service A to service B is {call frequency: 10, average response time: 20ms}. Based on the above sample data, a topology graph containing services A, B, and C can be constructed. Service A calls service B, and service B calls service C.

[0066] The adjacency matrix is ​​used to store the direct call relationship between services. The rows and columns of the matrix represent the services, and the values ​​of the matrix elements represent the call frequency and the average response time. For example, if the frequency of service A calling service B is 2 and the average response time is 15ms, the element value of row A and column B in the matrix is ​​{2,15ms}. If there is no direct call relationship between services, the corresponding element value is 0. According to the sample data, service A does not directly call service C, so the value of row A and column C of the adjacency matrix is ​​0.

[0067] In order to represent the indirect call relationship between services, a k-step reachability matrix is ​​calculated. The k-step reachability matrix indicates whether services can be reached through at most k-step calls. For example, if k=2, the element value in row A and column C in the matrix indicates whether service A can reach service C through at most two calls. If yes, the element value is 1, otherwise it is 0. According to the sample data, service A can call service C through service B, so the value of row A and column C in the reachability matrix with k=2 is 1.

[0068] Based on the k-step reachability matrix, the Floyd-Warshall algorithm is used to calculate the shortest call path length between any service pair. The shortest path length is defined as the path with the least number of calls between services. For example, the shortest path length from service A to service C is 2 (A->B->C).

[0069] Use the depth-first search algorithm to traverse the service call topology graph and obtain the maximum call level. The maximum call level indicates the maximum depth of the call link. For example, if service A calls service B, and service B calls service C, the maximum call level is 3.

[0070] The number of concurrent connections is obtained by counting the sum of the in-degree (the number of times the service is called) and out-degree (the number of times the service calls other services) of the service node. For example, if service A is called 3 times and calls other services 2 times, the number of concurrent connections of service A is 5.

[0071] Based on the edge weight information, the call failure ratio per unit time is calculated to obtain the error rate distribution. For example, if service A calls service B 10 times and 2 of them fail, the error rate is 0.2.

[0072] The average response time of the service call is calculated based on the timestamp information in the edge weight information. For example, if the response times of service A calling service B are 10ms, 20ms, and 30ms respectively, the average response time is 20ms.

[0073] The shortest call path length, maximum call level, number of concurrent connections, error rate distribution and average response time constitute the topological features.

[0074] Set a sliding time window, such as 5 minutes, to perform time series analysis on topological features.

[0075] Calculate the feature changes between adjacent time windows to obtain differential features. For example, if the average response time of the first time window is 20ms and the average response time of the second time window is 25ms, the differential feature is 5ms.

[0076] Calculate the mean, variance, skewness, and kurtosis of the features in the sliding time window to obtain statistical features. For example, calculate the mean, variance, skewness, and kurtosis of the average response time in a 5-minute window.

[0077] The frequency components of the feature sequence are extracted by fast Fourier transform to obtain the periodic features. For example, the average response time series of the past hour is fast Fourier transformed to extract the main frequency components.

[0078] Calculate the Pearson correlation coefficient and mutual information between different features to obtain relevant features. For example, calculate the correlation coefficient between average response time and error rate.

[0079] The differential features, statistical features, periodic features and correlation features are used to construct a feature sequence matrix.

[0080] The feature mean and variance are calculated using exponentially weighted moving average, and the feature sequence matrix is ​​standardized online to obtain a standardized feature sequence matrix. For example, the mean and variance of the average response time are calculated using exponentially weighted moving average, and then the average response time series is standardized.

[0081] The solution of this application can:

[0082] Improve fault diagnosis efficiency: Through comprehensive topological analysis of microservice call links, the root cause of the fault can be quickly located and the troubleshooting time can be reduced. For example, by analyzing the shortest call path length and error rate distribution, the bottlenecks and abnormal points in the call link can be quickly identified.

[0083] Optimize system performance: By analyzing the timing changes of call link characteristics, system performance bottlenecks can be identified and targeted optimization can be performed. For example, by analyzing the changing trends of the number of concurrent connections and average response time, it can be determined whether the system is overloaded and corresponding resource adjustments can be made.

[0084] Enhance system stability: By real-time monitoring and early warning of call link characteristics, potential system risks can be discovered in advance and corresponding measures can be taken to avoid failures. For example, by analyzing the changes in error rate distribution and periodic characteristics, possible system failures can be predicted and early warnings can be issued.

[0085] In an optional implementation, the feature sequence matrix is ​​input into a long short-term memory neural network to extract the timing dependency feature; the timing dependency feature and the service call topology graph are input into a graph attention network to calculate the attention weight coefficient between nodes; the node features are fused based on the attention weight coefficient to generate the state vector of the service node, including:

[0086] Input a feature sequence matrix into a bidirectional long short-term memory neural network, wherein the feature sequence matrix includes multi-dimensional historical time series features, and the bidirectional long short-term memory neural network includes a forward long short-term memory layer and a backward long short-term memory layer, each layer includes three gating structures: an input gate, a forget gate, and an output gate, wherein the input gate controls the input ratio of new information at the current moment, the forget gate controls the retention ratio of historical information, and the output gate controls the output ratio of information at the current moment, and dynamically adjusts feature weights based on the three gating structures to generate time series dependent features;

[0087] Input the timing dependency features and the service call topology graph into a graph attention network, wherein the graph attention network comprises a plurality of attention layers, each of the attention layers comprises a plurality of attention heads, each of the attention heads calculates an attention correlation coefficient between a pair of nodes based on a shared attention vector and a linear transformation matrix, and inputs the attention correlation coefficient into a softmax function to obtain a normalized attention weight coefficient;

[0088] Based on the normalized attention weight coefficient, the node features are weighted and summed to obtain a fused feature, and the fused features of multiple attention heads are spliced ​​to obtain a new feature representation of the node, and the new feature representation contains topological association information between nodes; the new feature representation is input into a multilayer perceptron, the middle layer of the multilayer perceptron uses a ReLU activation function, and the output layer uses a tanh activation function to generate a state vector of the service node, and the value range of the state vector of the service node is between [-1,1].

[0089] In order to accurately predict the status of service nodes, a graph neural network model based on time series features and topological information is proposed. The model uses a bidirectional long short-term memory network to extract the time series dependency features of service indicators, and combines the service call topology graph to capture the correlation information between nodes through the graph attention network, and finally generates the state vector of the service node.

[0090] First, collect the multi-dimensional historical time series features of the service, such as CPU usage, memory usage, request latency, error rate, etc., to form a feature sequence matrix. Assuming that 10 time steps of data are collected and each time step contains 4 feature dimensions, the dimension of the feature sequence matrix is ​​10x4.

[0091] Then, the feature sequence matrix is ​​input into the bidirectional long short-term memory network. The network consists of two long short-term memory layers, the forward and backward ones. Each long short-term memory layer contains three gating structures: input gate, forget gate, and output gate. The input gate controls the input ratio of new information at the current moment, the forget gate controls the retention ratio of historical information, and the output gate controls the output ratio of information at the current moment. Through these three gating structures, the network can dynamically adjust the feature weights and extract time-dependent features. For example, if the CPU usage rate is very high at the current moment, the input gate will give it a larger weight; if the CPU usage rate is relatively low in the past few time steps, the forget gate will reduce the weight of these historical information. Finally, the bidirectional long short-term memory network will output a vector containing time-dependent features, for example, with a dimension of 1x64.

[0092] Next, the extracted temporal dependency features and the service call topology graph are input into the graph attention network. The service call topology graph describes the call relationship between services and can be represented by an adjacency matrix. For example, a topology graph containing 5 services has an adjacency matrix of dimension 5x5. The graph attention network contains multiple attention layers, and each attention layer contains multiple attention heads. Each attention head calculates the attention correlation coefficient between node pairs based on the shared attention vector and the linear transformation matrix, and inputs the correlation coefficient into the softmax function to obtain the normalized attention weight coefficient. For example, if service A often calls service B, the attention weight coefficient between them will be relatively high.

[0093] Then, the node features are weighted and summed based on the normalized attention weight coefficient to obtain the fused features. The fused features of multiple attention heads are spliced ​​to obtain a new feature representation of the node, which contains the topological association information between nodes. For example, after splicing the fused features of 4 attention heads, the dimension of the new feature representation is 1x256.

[0094] Finally, the new feature representation of the node is input into the multilayer perceptron. The middle layer of the multilayer perceptron uses the ReLU activation function, and the output layer uses the tanh activation function to generate the state vector of the service node. The value range of the state vector is between [-1,1], which can represent the health status of the service. For example, a state vector close to 1 indicates a healthy service, and close to -1 indicates an abnormal service.

[0095] The solution of this application can:

[0096] Improved accuracy: By combining time-dependent features and topological association information, the status of service nodes can be more accurately characterized, improving prediction accuracy. Enhanced interpretability: The attention mechanism can capture the key dependencies between nodes, provide interpretable prediction results, and help understand the operating status of the service system. Improved generalization ability: The model can adapt to different service call topologies and has strong generalization ability.

[0097] In an optional implementation, the state vector is input into a fault propagation prediction model, the fault propagation prediction model outputs a fault occurrence probability and a propagation direction; the fault propagation prediction model is trained using a cross entropy loss function, and the model parameters are updated using a back propagation algorithm, including:

[0098] Input the state vector of the service node into the fault propagation prediction model, wherein the fault propagation prediction model comprises three fully connected layers, wherein the number of neurons in the three fully connected layers is 512, 256, and 128 respectively, and a LeakyReLU activation function is connected after the first two fully connected layers, wherein the negative semi-axis slope of the LeakyReLU activation function is 0.1;

[0099] The output of the fully connected layer is divided into a fault occurrence probability prediction branch and a fault propagation direction prediction branch, wherein the fault occurrence probability prediction branch outputs a fault occurrence probability value through a sigmoid activation function, and the fault propagation direction prediction branch outputs a fault propagation direction probability distribution through a softmax function;

[0100] The binary cross entropy loss is calculated by combining the fault occurrence probability value with the true fault label, and the multi-class cross entropy loss is calculated by combining the fault propagation direction probability distribution with the true propagation direction probability distribution. The total loss function is obtained by combining the binary cross entropy loss and the multi-class cross entropy loss based on a weight factor, and the value of the weight factor is 0.6;

[0101] The model parameters are updated through the back propagation algorithm, including: calculating the partial derivative of the total loss function with respect to the weight parameters of the fully connected layer to obtain the weight gradient; calculating the partial derivative of the total loss function with respect to the bias parameters of the fully connected layer to obtain the bias gradient; performing norm clipping on the weight gradient and the bias gradient to limit the gradient norm to the interval [-5,5]; accumulating the weight gradient and the bias gradient in 4 batches; and using an Adam optimizer to update the weight parameters and the bias parameters based on the accumulated weight gradient and the bias gradient, wherein the initial learning rate of the Adam optimizer is 0.001, and the learning rate is reduced to 0.1 times of the original value every 50 rounds of training.

[0102] In order to predict the probability of occurrence and propagation direction of faults in complex systems, a method based on fault propagation prediction model is proposed. This method uses deep learning technology to analyze the status information of service nodes in the system, predict the risk of potential faults, and identify the fault propagation path, so as to take preventive measures in advance and reduce the losses caused by faults.

[0103] First, collect the status data of each service node in the system. This data can include indicators such as CPU usage, memory occupancy, network traffic, disk IO, etc. For example, the status vector of a service node can be expressed as [0.85, 0.92, 0.78, 0.65], which represent CPU usage, memory occupancy, network traffic, and disk IO, respectively.

[0104] Then, the collected state vector is input into the fault propagation prediction model. The model consists of three fully connected layers with 512, 256 and 128 neurons respectively. The LeakyReLU activation function is connected after the first two fully connected layers, and the negative semi-axis slope is 0.1. The LeakyReLU activation function can effectively avoid the "death" phenomenon of neurons and improve the training efficiency of the model.

[0105] Next, the output of the last fully connected layer is divided into a fault probability prediction branch and a fault propagation direction prediction branch. The fault probability prediction branch outputs the fault probability value through the sigmoid activation function. For example, if the output value of this branch is 0.7, it means that the probability of the service node failing is 70%. The fault propagation direction prediction branch outputs the fault propagation direction probability distribution through the softmax function.

[0106] In order to train the fault propagation prediction model, the cross entropy loss function is used as the objective function. The predicted fault occurrence probability value is compared with the actual fault label to calculate the binary cross entropy loss. The predicted fault propagation direction probability distribution is compared with the actual propagation direction probability distribution to calculate the multi-class cross entropy loss. Then, the binary cross entropy loss and the multi-class cross entropy loss are combined based on the weight factor (e.g. 0.6) to obtain the total loss function.

[0107] During the model training process, the back-propagation algorithm is used to update the model parameters. First, the partial derivatives of the total loss function with respect to the weight parameters and bias parameters of the fully connected layer are calculated to obtain the weight gradient and bias gradient. In order to prevent gradient explosion, the norm of the weight gradient and bias gradient is clipped, and the gradient norm is limited to the interval [-5,5]. Then, the weight gradient and bias gradient are accumulated in 4 batches to reduce the influence of gradient noise. Finally, the Adam optimizer is used to update the weight parameters and bias parameters based on the accumulated weight gradient and bias gradient. The initial learning rate of the Adam optimizer is set to 0.001, and the learning rate is reduced to 0.1 times the original after every 50 rounds of training to improve the convergence speed and stability of the model.

[0108] The solution of this application can:

[0109] Improve fault prediction accuracy: Through deep learning models, the probability and propagation direction of faults can be predicted more accurately, so that preparations can be made in advance. Reduce fault losses: Through early prediction and prevention, the economic losses and service interruption time caused by faults can be effectively reduced. Improve system stability: By identifying the fault propagation path, the system architecture and resource allocation can be optimized, and the overall stability and reliability of the system can be improved.

[0110] In an optional implementation, a fault situation vector of a service node is calculated based on the fault propagation prediction model, wherein the fault situation vector includes a fault occurrence probability, a propagation risk coefficient, and a node importance; a fault propagation path diagram is constructed based on the fault situation vector, and a high-risk propagation path is marked; when a fault is detected, the fault source node is located based on the high-risk propagation path, and the fault impact range is predicted, including:

[0111] Calculate the fault situation vector of the service node based on the fault propagation prediction model, obtain the fault occurrence probability through the fault prediction branch of the fault propagation prediction model, calculate the information entropy of the fault propagation probability distribution between the node and the neighboring nodes to obtain the propagation risk coefficient, and the propagation risk coefficient is normalized by dividing the information entropy by the maximum entropy value; calculate the node importance based on the degree centrality, betweenness centrality and eigenvector centrality of the node, normalize the degree centrality, the betweenness centrality and the eigenvector centrality to the minimum-maximum value, and determine the weight coefficient through the hierarchical analysis method;

[0112] The fault occurrence probability is mapped to the node size, the node importance is mapped to the node color depth, and the propagation risk coefficient is mapped to the thickness of the edge to construct a fault propagation path diagram; a risk threshold is set, and the edge with a propagation risk coefficient greater than the risk threshold is marked as a high-risk propagation path;

[0113] When a fault is detected, a system status snapshot is obtained to determine a set of faulty nodes, each faulty node in the set of faulty nodes is traced back on the high-risk propagation path to construct a set of reversely reachable nodes, and the intersection of all the reversely reachable node sets is calculated to obtain a set of candidate fault source nodes; nodes in the set of candidate fault source nodes are screened based on the fault occurrence time series and propagation delay estimation;

[0114] The confidence score of each node in the candidate fault source node set as a fault source is calculated in combination with the fault situation vector, and the node with the highest confidence score is selected as the final fault source node; a breadth-first search is performed on the high-risk propagation path with the final fault source node as the starting point, and the time for the fault to propagate to each node is calculated. The severity of the node affected by the fault is evaluated based on the fault situation vector, and a time-layered fault impact range prediction diagram is generated for the affected nodes according to the time and the severity.

[0115] In order to more accurately locate the fault source and predict the fault impact range, this embodiment proposes a fault diagnosis method based on a fault propagation prediction model. This method constructs a fault situation vector of the service node and combines it with a fault propagation path diagram to quickly locate the fault source and accurately predict the fault impact range.

[0116] First, a fault propagation prediction model is constructed. The model contains a fault prediction branch and a propagation prediction branch. The fault prediction branch is used to predict the probability of fault occurrence of each service node. The propagation prediction branch is used to predict the probability distribution of fault propagation between nodes.

[0117] Then, the fault situation vector of the service node is calculated. The fault situation vector contains three elements: fault occurrence probability, propagation risk coefficient and node importance. The fault occurrence probability is directly obtained from the fault prediction branch of the fault prediction model. The propagation risk coefficient is obtained by calculating the information entropy of the fault propagation probability distribution between the node and its neighboring nodes, and the information entropy is normalized by dividing it by the maximum entropy value. The node importance is calculated based on the degree centrality, betweenness centrality and eigenvector centrality of the node. After the three centrality indicators are normalized to the minimum-maximum value, the weight coefficient is determined by the hierarchical analysis method, and the node importance is finally obtained by weighted summation.

[0118] For example, the fault propagation probabilities of node A and neighboring nodes B and C are 0.8 and 0.2 respectively. Then the information entropy is -0.8*log2(0.8)-0.2*log2(0.2)≈0.72. Assuming the maximum entropy value is 1, the propagation risk coefficient is 0.72. The degree centrality, betweenness centrality, and eigenvector centrality of node A are 0.5, 0.3, and 0.2 respectively. Assuming that the weight coefficients determined by the hierarchical analysis method are 0.4, 0.3, and 0.3 respectively, the node importance is 0.5*0.4+0.3*0.3+0.2*0.3=0.35.

[0119] Next, construct a fault propagation path graph. Map the probability of fault occurrence to node size, node importance to node color depth, and propagation risk coefficient to edge thickness. Set a risk threshold, such as 0.6. Mark edges with a propagation risk coefficient greater than 0.6 as high-risk propagation paths.

[0120] For example, if the propagation risk coefficient between node A and node B is 0.7, which is greater than the threshold value of 0.6, the edge connecting A and B is marked as a high-risk propagation path.

[0121] When a fault is detected, the system state snapshot is first obtained to determine the set of faulty nodes. For example, if nodes C and D are detected to be faulty, the set of faulty nodes is {C, D}.

[0122] Then, each faulty node in the faulty node set is traced back on the high-risk propagation path to construct a reverse reachable node set. For example, tracing back from node C, the reachable node set is {A, B}; tracing back from node D, the reachable node set is {B, E}.

[0123] Calculate the intersection of all reverse reachable node sets to obtain the candidate fault source node set. In this example, the candidate fault source node set is {B}.

[0124] Next, the nodes in the candidate fault source node set are screened based on the fault occurrence time series and propagation delay estimation. For example, if the fault occurrence time of node B is earlier than that of nodes C and D, node B is considered to be a possible fault source.

[0125] Then, the confidence score of each node in the candidate fault source node set as a fault source is calculated in combination with the fault situation vector. For example, the confidence score of node B is calculated by considering factors such as the fault probability of node B, the node importance, and the transmission risk coefficient with the faulty node.

[0126] The node with the highest confidence score is selected as the final fault source node. In this example, node B is the final fault source node.

[0127] Finally, starting from the final fault source node, a breadth-first search is performed on the high-risk propagation path to calculate the time it takes for the fault to propagate to each node. The severity of the node affected by the fault is evaluated based on the fault situation vector. A time-layered fault range prediction diagram is generated for the affected nodes according to time and severity.

[0128] The solution of this application can:

[0129] Improve the accuracy of fault location: By combining the fault propagation path and node status information, the fault source node can be identified more accurately to avoid misjudgment. Improve the accuracy of fault prediction: Based on the fault propagation model and high-risk path, the scope and time of the fault can be predicted more accurately, providing a more reliable basis for fault handling. Enhance the efficiency of fault handling: By predicting the impact of the fault in advance, emergency plans can be formulated in advance, shortening the fault handling time and reducing the losses caused by the fault.

[0130] In an optional implementation, the output probability of the fault propagation prediction model is used to calibrate the fault warning threshold; the fault propagation prediction model is continuously optimized according to the actual fault propagation situation to improve the prediction accuracy; and the microservice nodes are dynamically scheduled based on the fault situation vector to reduce the fault propagation risk, including:

[0131] Obtain the original predicted probability output by the fault propagation prediction model, map the original predicted probability to the actual fault distribution interval, and obtain the true distribution of the fault occurrence through probability density estimation; construct a calibration mapping function based on the true distribution, convert the original predicted probability into a calibrated predicted probability through the calibration mapping function, and use the calibrated predicted probability as a calibration benchmark for the fault warning threshold;

[0132] Collect actual fault propagation data during system operation, classify the actual fault propagation data according to fault type and propagation path, and extract feature vectors and propagation modes of each type of fault; update the fault propagation prediction model online based on the feature vectors and the propagation modes, and integrate new fault modes into the prediction model through incremental learning;

[0133] Calculate the fault situation vector of the microservice node, the fault situation vector includes the node failure probability, service dependency strength and load status; construct a node risk assessment matrix based on the fault situation vector, the node risk assessment matrix reflects the fault propagation risk between nodes;

[0134] The microservice nodes are grouped and isolated according to the node risk assessment matrix, and service instances with redundant backups are deployed in different fault domains; the dynamic health of the nodes is calculated based on the fault situation vector, and service requests are load-balanced among the nodes according to the dynamic health;

[0135] Continuously monitor the changes in the fault situation of the node, and when the fault situation vector indicator of the node exceeds the fault warning threshold, trigger the migration operation of the service instance; select the optimal migration target node based on the node risk assessment matrix, and reduce the overall fault propagation risk of the system by adjusting the service deployment structure.

[0136] Get the original predicted probability output by the fault propagation prediction model. For example, a prediction model outputs that the probability of node A failing in the next hour is 0.2, node B is 0.05, and node C is 0.1. Map the original predicted probability to the actual fault distribution interval. For example, through historical data statistics, it is found that the actual failure rate of nodes with predicted probabilities between 0 and 0.1 is about 0.02; the actual failure rate of nodes with predicted probabilities between 0.1 and 0.2 is about 0.15; the actual failure rate of nodes with predicted probabilities between 0.2 and 0.3 is about 0.25. Get the true distribution of fault occurrence through probability density estimation. For example, using the kernel density estimation method, a probability density function is fitted based on historical fault data and the corresponding predicted probabilities, which can describe the relationship between the predicted probability and the actual failure rate. Construct a calibration mapping function based on the true distribution. For example, through interpolation or fitting methods, a function is constructed to map the original predicted probability to the calibrated predicted probability, so that the calibrated predicted probability is closer to the true failure rate. For example, the original prediction probability of node A is 0.2. After the calibration mapping function, the calibrated prediction probability is 0.22. The calibrated prediction probability is used as the calibration benchmark for the fault warning threshold. For example, if the fault warning threshold is set to 0.2, the calibrated prediction probability of node A, 0.22, exceeds the threshold and triggers a warning.

[0137] Collect actual fault propagation data during system operation. For example, record the information that after node A fails, nodes B and C also fail, including the time of the failure, the type of failure, the fault propagation path, etc. Classify the actual fault propagation data according to the fault type and propagation path. For example, classify different types of faults such as database connection failure, network failure, and code error, and distinguish different propagation paths such as A->B and A->C. Extract the feature vector and propagation mode of each type of fault. For example, the feature vector of a database connection failure may include connection timeout time, connection error code, etc.; its propagation mode may be from the database server node to the application server node connected to it. Update the fault propagation prediction model online based on the feature vector and propagation mode. For example, use an online learning algorithm to adjust the model parameters according to the new fault data so that the model can better predict the probability of future faults and propagation paths. Integrate new fault modes into the prediction model through incremental learning. For example, when a new fault type or propagation mode appears, the model can automatically learn and include it in the prediction range.

[0138] Calculate the failure situation vector of the microservice node. For example, the failure situation vector of node A is (0.22, 0.8, 0.9), where 0.22 is the calibrated failure probability, 0.8 is the service dependency strength, indicating the degree to which node A depends on other services, and 0.9 is the load status, indicating the current resource usage of node A. Construct a node risk assessment matrix based on the failure situation vector. For example, the risk value of node A to node B is 0.3, indicating that if node A fails, there is a 0.3 probability that node B will also fail. The node risk assessment matrix is ​​an N×N matrix, where N is the number of microservice nodes, and each element of the matrix represents the risk of fault propagation between nodes. Group and isolate microservice nodes according to the node risk assessment matrix. For example, divide nodes with higher risks into different fault domains to prevent the fault of one fault domain from spreading to other fault domains. Deploy service instances with redundant backups in different fault domains. For example, deploy nodes A and B in different fault domains, and deploy backup instances of nodes A and B in each fault domain to ensure that even if all nodes in one fault domain fail, nodes in other fault domains can still provide services. Calculate the dynamic health of the node based on the fault situation vector. For example, a comprehensive health index is calculated based on the node's failure probability, service dependency strength, and load status. For example, 0.85 means that node A is currently in good health. Load-balance service requests among nodes based on dynamic health. For example, more requests are allocated to nodes with higher health to reduce pressure on high-risk nodes.

[0139] Continuously monitor changes in node failure patterns. For example, collect indicators such as node failure probability, service dependency strength, and load status in real time. When the node failure pattern vector indicator exceeds the failure warning threshold, trigger the migration of the service instance. For example, when the failure probability of node A exceeds the warning threshold of 0.2, trigger the migration of the service instance on node A. Select the optimal migration target node based on the node risk assessment matrix. For example, select a node with a lower risk than node A as the migration target, such as node C. Reduce the overall system fault propagation risk by adjusting the service deployment structure. For example, after migrating the service instance on node A to node C, the impact of node A failure on other nodes is reduced.

[0140] The solution of this application can:

[0141] Improve the accuracy of fault warning: Through probability calibration, the predicted probability is closer to the actual fault distribution, thereby improving the accuracy of fault warning and reducing false positives and false negatives. Enhance the adaptability of fault prediction models: Through online updates and incremental learning, the model can adapt to the changing system environment and new fault modes, improving the accuracy of predictions. Reduce the risk of fault propagation: Through dynamic scheduling and group isolation, reduce the risk of fault propagation between nodes and improve the stability and reliability of the system.

[0142] According to a second aspect of the embodiments of the present invention,

[0143] Figure 2 FIG. 1 is a schematic diagram of the structure of a distributed interface defect detection system for a microservice architecture according to an embodiment of the present invention. Figure 2 As shown, the system comprises:

[0144] The first unit is used to deploy distributed tracing probes to collect microservice interface call data, wherein the interface call data includes a call timestamp, a request identifier, a source service identifier, a target service identifier, a call status code, and a response time; a service call topology graph is constructed based on the interface call data, wherein the nodes of the service call topology graph represent microservice instances, and the edges represent the call relationships between services; call link features are extracted based on the service call topology graph, wherein the call link features include link length, call depth, number of concurrent connections, error rate distribution, and average response time; and the time series variation features of the call link features are calculated through a sliding time window to obtain a feature sequence matrix;

[0145] The second unit is used to input the feature sequence matrix into the long short-term memory neural network to extract the timing dependency features; input the timing dependency features and the service call topology graph into the graph attention network to calculate the attention weight coefficients between nodes; fuse the node features based on the attention weight coefficients to generate the state vector of the service node; input the state vector into the fault propagation prediction model, and the fault propagation prediction model outputs the probability of fault occurrence and the propagation direction; use the cross entropy loss function to train the fault propagation prediction model, and update the model parameters through the back propagation algorithm;

[0146] The third unit is used to calculate the fault situation vector of the service node based on the fault propagation prediction model, wherein the fault situation vector includes the fault occurrence probability, the propagation risk coefficient, and the node importance; construct a fault propagation path diagram according to the fault situation vector, and mark the high-risk propagation path; when a fault is detected, locate the fault source node based on the high-risk propagation path, and predict the scope of the fault; calibrate the fault warning threshold using the output probability of the fault propagation prediction model; continuously optimize the fault propagation prediction model according to the actual fault propagation situation to improve the prediction accuracy; dynamically schedule the microservice nodes based on the fault situation vector to reduce the risk of fault propagation.

[0147] According to a third aspect of the embodiments of the present invention,

[0148] An electronic device is provided, comprising:

[0149] processor;

[0150] a memory for storing processor-executable instructions;

[0151] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0152] A fourth aspect of the embodiments of the present invention is:

[0153] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.

[0154] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.

[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A distributed interface defect detection method for microservice architecture, characterized in that: include: Deploy distributed tracing probes to collect microservice interface call data, where the interface call data includes call timestamp, request identifier, source service identifier, target service identifier, call status code, and response time; Based on the interface call data, a service call topology graph is constructed, wherein the nodes of the service call topology graph represent microservice instances, and the edges represent the call relationships between services; based on the service call topology graph, call link features are extracted, wherein the call link features include link length, call depth, number of concurrent connections, error rate distribution, and average response time; Calculate the time series variation characteristics of the call link characteristics through a sliding time window to obtain a feature sequence matrix; Collect microservice interface call data through a distributed tracing system, wherein the microservice interface call data includes a call timestamp, a target service identifier, a call status code, and a response time; Building a service call topology graph based on the microservice interface call data, wherein the nodes of the service call topology graph represent microservice instances, the edges of the service call topology graph represent call relationships between services, and the weight information of the edges includes call frequency information and response time information; Adopting an adjacency matrix to store the direct call relationship between services in the service call topology graph, and calculating a k-step reachability matrix between services based on the adjacency matrix, wherein the k-step reachability matrix is ​​used to characterize the indirect call relationship between services; Based on the k-step reachability matrix, the Floyd-Warshall algorithm is used to calculate the shortest call path length between any service pairs, the depth-first search algorithm is used to traverse the service nodes of the service call topology graph to obtain the maximum call level, the sum of the in-degree and out-degree of the service nodes is counted to obtain the number of concurrent connections, the call failure ratio per unit time is calculated based on the weight information of the edge to obtain the error rate distribution, and the average response time of the service call is calculated based on the timestamp information in the weight information of the edge; The shortest call path length, the maximum call level, the number of concurrent connections, the error rate distribution, and the average response time constitute topological features; A sliding time window is set, and a time series analysis is performed on the topological features based on the sliding time window, and the feature changes between adjacent time windows are calculated to obtain differential features, and the mean, variance, skewness, and kurtosis of the features in the sliding time window are calculated to obtain statistical features, and the frequency components of the feature sequence are extracted by fast Fourier transform to obtain periodic features, and the Pearson correlation coefficient and mutual information between different features are calculated to obtain related features; a feature sequence matrix is ​​constructed by combining the differential features, the statistical features, the periodic features, and the related features; the feature mean and variance are calculated by exponentially weighted moving average, and the feature sequence matrix is ​​subjected to online standardization processing to obtain a standardized feature sequence matrix; Inputting the feature sequence matrix into a long short-term memory neural network to extract time-dependent features; Input the timing dependency features and the service call topology graph into the graph attention network to calculate the attention weight coefficients between nodes; fuse the node features based on the attention weight coefficients to generate a state vector of the service node; input the state vector into a fault propagation prediction model, and the fault propagation prediction model outputs the probability of fault occurrence and the propagation direction; train the fault propagation prediction model using a cross entropy loss function, and update the model parameters using a back propagation algorithm; Calculate the fault situation vector of the service node based on the fault propagation prediction model, where the fault situation vector includes the probability of fault occurrence, the propagation risk coefficient, and the node importance; Construct a fault propagation path diagram based on the fault situation vector and mark high-risk propagation paths; when a fault is detected, locate the fault source node based on the high-risk propagation path and predict the scope of the fault; calibrate the fault warning threshold using the output probability of the fault propagation prediction model; The fault propagation prediction model is continuously optimized according to the actual fault propagation situation to improve the prediction accuracy; the microservice nodes are dynamically scheduled based on the fault situation vector to reduce the risk of fault propagation.

2. The method according to claim 1, characterized in that Input the feature sequence matrix into a long short-term memory neural network to extract time-dependent features; input the time-dependent features and the service call topology graph into a graph attention network to calculate the attention weight coefficients between nodes; Based on the attention weight coefficient, the node features are fused to generate a state vector of the service node, including: Input a feature sequence matrix into a bidirectional long short-term memory neural network, wherein the feature sequence matrix includes multi-dimensional historical time series features, and the bidirectional long short-term memory neural network includes a forward long short-term memory layer and a backward long short-term memory layer, each layer includes three gating structures: an input gate, a forget gate, and an output gate, wherein the input gate controls the input ratio of new information at the current moment, the forget gate controls the retention ratio of historical information, and the output gate controls the output ratio of information at the current moment, and dynamically adjusts feature weights based on the three gating structures to generate time series dependent features; Input the timing dependency features and the service call topology graph into a graph attention network, wherein the graph attention network comprises a plurality of attention layers, each of the attention layers comprises a plurality of attention heads, each of the attention heads calculates an attention correlation coefficient between a pair of nodes based on a shared attention vector and a linear transformation matrix, and inputs the attention correlation coefficient into a softmax function to obtain a normalized attention weight coefficient; Based on the normalized attention weight coefficient, the node features are weighted and summed to obtain a fused feature, and the fused features of multiple attention heads are spliced ​​to obtain a new feature representation of the node, and the new feature representation contains topological association information between nodes; the new feature representation is input into a multilayer perceptron, the middle layer of the multilayer perceptron uses a ReLU activation function, and the output layer uses a tanh activation function to generate a state vector of the service node, and the value range of the state vector of the service node is between [-1,1].

3. The method according to claim 1, characterized in that Inputting the state vector into a fault propagation prediction model, the fault propagation prediction model outputs a fault occurrence probability and a propagation direction; training the fault propagation prediction model using a cross entropy loss function, and updating the model parameters using a back propagation algorithm include: Input the state vector of the service node into the fault propagation prediction model, wherein the fault propagation prediction model comprises three fully connected layers, wherein the number of neurons in the three fully connected layers is 512, 256, and 128 respectively, and a LeakyReLU activation function is connected after the first two fully connected layers, wherein the negative semi-axis slope of the LeakyReLU activation function is 0.1; The output of the fully connected layer is divided into a fault occurrence probability prediction branch and a fault propagation direction prediction branch, wherein the fault occurrence probability prediction branch outputs a fault occurrence probability value through a sigmoid activation function, and the fault propagation direction prediction branch outputs a fault propagation direction probability distribution through a softmax function; The binary cross entropy loss is calculated by combining the fault occurrence probability value with the true fault label, and the multi-class cross entropy loss is calculated by combining the fault propagation direction probability distribution with the true propagation direction probability distribution. The total loss function is obtained by combining the binary cross entropy loss and the multi-class cross entropy loss based on a weight factor, and the value of the weight factor is 0.6; The model parameters are updated through the back propagation algorithm, including: calculating the partial derivative of the total loss function with respect to the weight parameters of the fully connected layer to obtain the weight gradient; calculating the partial derivative of the total loss function with respect to the bias parameters of the fully connected layer to obtain the bias gradient; performing norm clipping on the weight gradient and the bias gradient to limit the gradient norm to the interval [-5,5]; accumulating the weight gradient and the bias gradient in 4 batches; and using an Adam optimizer to update the weight parameters and the bias parameters based on the accumulated weight gradient and the bias gradient, wherein the initial learning rate of the Adam optimizer is 0.001, and the learning rate is reduced to 0.1 times of the original value every 50 rounds of training.

4. The method according to claim 1, characterized in that: Calculate the fault situation vector of the service node based on the fault propagation prediction model, where the fault situation vector includes the probability of fault occurrence, the propagation risk coefficient, and the node importance; construct a fault propagation path diagram based on the fault situation vector, and mark the high-risk propagation path; When a fault is detected, the fault source node is located based on the high-risk transmission path, and the fault impact range is predicted including: Calculate the fault situation vector of the service node based on the fault propagation prediction model, obtain the fault occurrence probability through the fault prediction branch of the fault propagation prediction model, calculate the information entropy of the fault propagation probability distribution between the node and the neighboring nodes to obtain the propagation risk coefficient, and the propagation risk coefficient is normalized by dividing the information entropy by the maximum entropy value; calculate the node importance based on the degree centrality, betweenness centrality and eigenvector centrality of the node, normalize the degree centrality, the betweenness centrality and the eigenvector centrality to the minimum-maximum value, and determine the weight coefficient through the hierarchical analysis method; The fault occurrence probability is mapped to the node size, the node importance is mapped to the node color depth, and the propagation risk coefficient is mapped to the thickness of the edge to construct a fault propagation path diagram; a risk threshold is set, and the edge with a propagation risk coefficient greater than the risk threshold is marked as a high-risk propagation path; When a fault is detected, a system status snapshot is obtained to determine a set of faulty nodes, each faulty node in the set of faulty nodes is traced back on the high-risk propagation path to construct a set of reversely reachable nodes, and the intersection of all the reversely reachable node sets is calculated to obtain a set of candidate fault source nodes; nodes in the set of candidate fault source nodes are screened based on the fault occurrence time series and propagation delay estimation; The confidence score of each node in the candidate fault source node set as a fault source is calculated in combination with the fault situation vector, and the node with the highest confidence score is selected as the final fault source node; a breadth-first search is performed on the high-risk propagation path with the final fault source node as the starting point, and the time for the fault to propagate to each node is calculated. The severity of the node affected by the fault is evaluated based on the fault situation vector, and a time-layered fault impact range prediction diagram is generated for the affected nodes according to the time and the severity.

5. The method according to claim 1, characterized in that The output probability of the fault propagation prediction model is used to calibrate the fault warning threshold; the fault propagation prediction model is continuously optimized according to the actual fault propagation situation to improve the prediction accuracy; Dynamically scheduling microservice nodes based on the fault situation vector to reduce the risk of fault propagation includes: Obtain the original predicted probability output by the fault propagation prediction model, map the original predicted probability to the actual fault distribution interval, and obtain the true distribution of the fault occurrence through probability density estimation; construct a calibration mapping function based on the true distribution, convert the original predicted probability into a calibrated predicted probability through the calibration mapping function, and use the calibrated predicted probability as a calibration benchmark for the fault warning threshold; Collect actual fault propagation data during system operation, classify the actual fault propagation data according to fault type and propagation path, and extract feature vectors and propagation modes of each type of fault; update the fault propagation prediction model online based on the feature vectors and the propagation modes, and integrate new fault modes into the fault propagation prediction model through incremental learning; Calculate the fault situation vector of the microservice node, the fault situation vector includes the node failure probability, service dependency strength and load status; construct a node risk assessment matrix based on the fault situation vector, the node risk assessment matrix reflects the fault propagation risk between nodes; The microservice nodes are grouped and isolated according to the node risk assessment matrix, and service instances with redundant backups are deployed in different fault domains; the dynamic health of the nodes is calculated based on the fault situation vector, and service requests are load-balanced among the nodes according to the dynamic health; Continuously monitor the changes in the fault situation of the node, and when the fault situation vector indicator of the node exceeds the fault warning threshold, trigger the migration operation of the service instance; select the optimal migration target node based on the node risk assessment matrix, and reduce the overall fault propagation risk of the system by adjusting the service deployment structure.

Citation Information

Patent Citations

  • Fault prediction method and system based on observable data

    CN118713991A

  • Fault detection method and device of network equipment and electronic equipment

    CN118740678A