Fault positioning method for learning from link data to carry out micro-service application
By adopting the Transformer-BiLSTM model with spatiotemporal characteristics in the microservice system, combining spatiotemporal and joint attenuation factor and multi-head attention mechanism, the problem of complexity of fault detection and positioning of microservice systems is solved, efficient fault prediction and positioning is achieved, and the reliability and robustness of the system are improved.
Patent Information
- Application Number
- CN202510377832.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-28
AI Technical Summary
The fault detection and positioning of microservice systems are complex, and the existing technology is difficult to effectively capture the spatio-temporal characteristics of data, making it difficult to detect and position the fault detection and positioning, and the abnormality of a single service node is difficult to detect in time.
The Transformer-BiLSTM model integrating spatiotemporal features is adopted to predict and locate the microservice system. Microservice link data is collected and preprocessed through a hybrid fault injection policy and Kubernetes' Istio service mesh. The model combines space-time and space-time joint attenuation factor and multi-head attention mechanism to capture the time-dependent relationship and spatial structure characteristics, and uses multimodal adaptive fusion technology to predict and locate faults.
It significantly improves the effectiveness of microservice abnormal detection and fault location, can more accurately analyze and respond to interaction and communication problems between services, and improves the reliability and robustness of the system.
Smart Images

Figure CN119883714A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of distributed architecture fault location technology, and in particular to a method for fault location of microservice applications by learning from link data. Background Art
[0002] With the widespread adoption of distributed systems and microservices architecture in modern enterprises, the complexity of service deployment, maintenance, and expansion has reached unprecedented levels. Microservices architecture has become a core technology to support large-scale distributed applications due to its excellent scalability, flexibility, and modularity. However, the inherent dynamics, distributed characteristics, and heterogeneity of microservices systems make fault detection and location particularly complex. In a microservices environment, the close dependencies between services and the high requirements for real-time response mean that any system failure may spread rapidly, resulting in a sharp drop in performance or even a complete system crash. Therefore, developing a technology that can efficiently and accurately detect and locate microservice failures has become a key challenge to ensure system stability and reliability.
[0003] Traditional microservice fault detection and location methods mainly rely on machine learning and deep learning technologies, including support vector machines (SVM), random forests, long short-term memory networks (LSTM), and CNN-LSTM. These technologies usually identify anomalies based on single log data or monitoring the usage of resources such as CPU, memory, and network. However, when dealing with microservice call relationships, these methods cannot fully analyze the topological relationship graph of the service. Although LSTM and CNN-LSTM can process time series data, and CNN-LSTM can also process spatial data, they are still insufficient in capturing the spatiotemporal characteristics of data. In addition, with the continuous expansion of microservice architecture, the anomalies of a single service node are not only difficult to detect in time, but once they occur, they often trigger a chain reaction, thereby greatly increasing the difficulty of fault diagnosis of the system as a whole. Summary of the invention
[0004] In view of the above problems, the present invention proposes a microservice application fault location method based on link data learning. The method uses the Transformer-BiLSTM model that integrates spatiotemporal features to predict and locate faults in the microservice system. In order to meet the needs of actual application scenarios, this model is integrated into the microservice system to realize the real-time fault prediction and location function of online applications.
[0005] The method of the present invention is mainly reflected in two aspects of microservice fault prediction and location. On the one hand, a hybrid fault injection strategy is used to simulate real application scenarios, and the Istio service grid of Kubernetes is used to collect microservice link data through its distributed tracking and pre-process the data. On the other hand, the microservice application fault characteristics are learned from the link data, and then the Transformer-BiLSTM model that integrates spatiotemporal features is used to predict and locate potential faults of microservice applications.
[0006] S1. In order to simulate the real usage scenario, the present invention injects hybrid faults into the open source microservice system, and then uses the Istio service grid of Kubernetes to collect microservice link data through its distributed tracing and pre-process the data.
[0007] Further: Step 1 includes the following sub-steps:
[0008] S1-1. Perform hybrid fault injection on open source microservice systems.
[0009] S1-2. Use Kubernetes' Istio service mesh to collect microservice link data and process the data through its distributed tracing.
[0010] S1-3. Data preprocessing:
[0011] First, the link data matrix is defined as , where T is the time step, N is the number of microservices, and M is the feature dimension.
[0012] Next, we constructed a call relationship graph between services and set up a static service call adjacency matrix. If service i calls service j, then , otherwise 0.
[0013] S2. Construction of fault prediction and location model.
[0014] After data preprocessing, the present invention uses the Transformer-BiLSTM model that integrates spatiotemporal features to locate the faults of microservice applications. The model combines spatiotemporal features and can fully learn the time dependency and spatial structure features in the microservice system.
[0015] S2-1. Perform time series embedding and causal position encoding on the preprocessed data.
[0016] In a microservice system, the propagation of faults has obvious causal timing characteristics. In order to accurately capture and understand this causal relationship, the causal position can be encoded. The specific formula is as follows:
[0017]
[0018] in, is to learn causal weights through historical abnormal data, If the time The time is If it is a potential cause, it is set to 1, otherwise it is 0. is the standard sinusoidal position encoding vector.
[0019] In addition, dynamic causal injection technology is also used to simulate and observe the response of the microservice system in the face of configuration changes, traffic changes, changes in service calls, etc. Through this technology, the dynamic changes of the system can be observed in real time, and the causal relationship model of the present invention can be further verified and adjusted. The specific formula is as follows:
[0020]
[0021] in, is the input feature matrix, is the embedding layer weight matrix.
[0022] S2-2. Time-aware multi-head attention mechanism.
[0023] A time-aware multi-head attention mechanism is introduced to enhance the spatiotemporal awareness of the model by integrating the service call path distance into the attention calculation.
[0024] First, by combining the service space topology graph and the time decay factor, a spatiotemporal joint decay factor is constructed. This decay factor not only takes into account the time factor, but also incorporates the spatial distance between services, thereby achieving joint perception of spatiotemporal information. The specific formula is as follows:
[0025]
[0026] in, is the shortest path distance from service i to j, , and is a learnable parameter, and Represents the timestamp of service i and service j.
[0027] Next, the attention mechanism is optimized using the above-mentioned spatiotemporal joint attenuation factor. The specific formula is as follows:
[0028]
[0029] Among them, Q, K and V are query, key and value respectively.
[0030] Finally, this optimized attention mechanism is extended to a multi-head setting to enhance the expressiveness and generalization ability of the model. Each head processes a different representation subspace, thereby capturing multi-faceted features of the input data. The final output of the multi-head attention is the concatenation of the outputs of each head.
[0031] S2-3. Based on the output of the time-aware multi-head attention mechanism, BiLSTM time series modeling is performed to obtain the final time features.
[0032] The link data of the microservice is processed through Transformer, and then the high-dimensional features that can reflect the dynamics of the time series are input into the BiLSTM layer. The time series features of the output of Transformer It is input into the BiLSTM network to capture local temporal dependencies. BiLSTM performs temporal modeling through the forward and reverse paths, and finally obtains the final temporal features by concatenating the bidirectional hidden states. .
[0033] S2-4. Combine the spatiotemporal hypergraph attention mechanism to extract spatial features.
[0034] When extracting spatial features, we first construct node features and map the temporal features to This process involves calculating the attention score of each node to its neighbors in order to more accurately capture the interactions and information flows between nodes. The specific formula is as follows:
[0035]
[0036] Next, the spatiotemporal hypergraph attention mechanism is used to reflect the collaborative anomalies of multiple services. Each service and all its upstream dependent services constitute a hyperedge is the set of direct upstream services of service i, is the hyperedge of service i, and the specific formula is as follows:
[0037]
[0038] in, is the maximum pooling operation, is the activation function, is the attention coefficient vector.
[0039] Finally, in order to solve the complex relationship between services in the microservice architecture, the dependency relationship is expressed through hyperedge feature aggregation to help detect service anomalies. The specific formula is as follows:
[0040]
[0041] S2-5. Based on spatial features, multimodal adaptive fusion is performed through a multimodal adaptive gating mechanism.
[0042] When dealing with a large amount of data generated by inter-service communication, such as log files, performance indicators, and network traffic, a multimodal adaptive gating mechanism is proposed to effectively analyze these data. A triple gating system is designed to optimize the fusion weights of temporal features, spatial features, and cross features.
[0043] First, in order to improve the accuracy of the model, the cross-attention features are projected and a comprehensive cross-attention mechanism is calculated. This mechanism involves the application of the attention weight matrix, which is as follows:
[0044]
[0045] in, , and is the attention weight matrix, is the time feature, is the spatial feature, is the crossover feature, is the feature dimension.
[0046] Next, a multimodal gating vector is introduced. This vector helps the model adjust the weight of information according to the characteristics of different data. The specific formula is as follows:
[0047]
[0048] in, ,First, the temporal features, spatial features and cross features are input into the multilayer perceptron, and then the weight of each feature is learned by the multilayer perceptron, and the gating vector is output.
[0049] Finally, multimodal dynamic fusion is achieved by introducing a triple-weight gating mechanism. This mechanism further optimizes feature integration based on spatiotemporal fusion. The specific formula is as follows:
[0050]
[0051] in, They are the gating weights of time, space, and cross features respectively.
[0052] This integration process ensures the full integration of temporal, spatial and cross-features, providing strong support for fault prediction and location. In this way, the interaction and communication problems between various services can be analyzed and responded to more accurately.
[0053] S2-6, fault prediction and location, output fault location results.
[0054] In the fault prediction and location system, the fused spatiotemporal features are firstly processed by global average pooling. This step helps to reduce the dimension of the data while retaining the key spatiotemporal information, thus providing a more concise and effective feature representation for subsequent analysis. .
[0055] Next, the features , a classifier is used to achieve system-level fault prediction. This classifier is based on the processed average pooling features and can effectively identify various possible fault modes in the system. The working principle of the classifier is based on supervised learning, which trains the model with known fault and normal operation data, so as to quickly and accurately predict faults in actual operation.
[0056] In addition, the features ,By classifying node features, service level fault location can be ,further achieved.
[0057] S3. In the process of training the fault location model, a binary labeling method is used to distinguish service status.
[0058] S4. Automated testing is introduced in the real-time running microservice system. In addition, the trained fault location model is integrated into the online microservice system to predict and locate potential faults in real time.
[0059] Beneficial effects of the present invention:
[0060] (1) Enhanced spatiotemporal feature expression capability: This paper proposes a Transformer-BiLSTM model that integrates spatiotemporal features. The model uses time-aware attention and dynamic graph attention combined with spatiotemporal joint decay factors, and effectively captures the dependencies and competition between service performance resources through multimodal adaptive fusion technology. This innovative design enables the model to adapt to the complexity and dynamics of microservice architecture, and significantly improves the microservice anomaly detection and fault location effect based on microservice dependencies and link data.
[0061] (2) Dynamically adjust the number of service instances: In the online prediction system, the present invention can dynamically adjust the number of service instances in the microservice system according to the results of model prediction. This adaptive adjustment mechanism not only ensures the continuous and stable operation of the microservice system when facing potential failure risks, but also significantly improves the reliability and robustness of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 The flowchart of Transformer-BiLSTM that integrates spatiotemporal features;
[0063] Figure 2 An overview of potential fault prediction and fault location for microservices. DETAILED DESCRIPTION
[0064] The present invention is further described below in conjunction with the accompanying drawings.
[0065] In view of the above problems, the present invention proposes a microservice application fault location method based on link data learning, such as Figure 1 As shown in the figure. This method uses the Transformer-BiLSTM model that integrates spatiotemporal features to predict and locate faults in microservice systems. In order to meet the needs of actual application scenarios, this model is integrated into the microservice system to achieve real-time fault prediction and location functions for online applications.
[0066] Figure 2 This paper provides an overview of the microservice fault detection and location process, which is divided into an offline training phase and an online prediction phase. In the offline training phase, the microservice application is deployed in a test environment, and the prediction model is trained by collecting application-level log data. In order to fully train the model, not only the log data of the service when it is running normally is collected, but also the error log information. By combining fault injection and automated testing methods, the execution logs when the application fails are simulated. These tests are designed to simulate microservice calls and user requests. In order to increase the diversity of experimental data, different service configurations are also set for testing. The online prediction phase focuses on monitoring the running status of the application in the production environment to predict potential errors and their specific locations, including which microservice the failure occurred in and the type of failure. In this phase, the system continuously collects and analyzes log data from the running application, extracts features similar to data annotation, and uses the trained model to predict potential failures.
[0067] S1. In order to simulate the real usage scenario, the present invention performs hybrid fault injection on two open source microservice systems, TrainTicket and Shop-Sock, and then uses Kubernetes's Istio service grid to collect microservice link data through its distributed tracing and pre-process the data.
[0068] Further: Step 1 includes the following sub-steps:
[0069] S1-1. Perform hybrid fault injection on the two open source microservice systems, TrainTicket and Shop Sock.
[0070] In order to simulate real application scenarios and test the robustness, fault tolerance and recovery capabilities of the microservice architecture, the present invention adopts the following four methods.
[0071] Use the traffic control function of the Istio service grid in Kubernetes to simulate network delay and packet loss.
[0072] Set limits on a container's memory or CPU usage to simulate resource exhaustion scenarios.
[0073] Exception handling is implemented through code injection technology to simulate service crashes.
[0074] Use Istio's fault injection feature to simulate HTTP error codes, such as 500, 502, etc.
[0075] By combining the above strategies, the present invention can fully simulate network problems, resource exhaustion, service crashes and different types of system failures, thereby providing test data for further anomaly detection and analysis.
[0076] S1-2. Use Kubernetes' Istio service mesh to collect microservice link data and process the data through its distributed tracing.
[0077] After using fault injection technology to generate historical error data, this paper obtains link data of microservices through the service grid (Istio), including indicators such as CPU usage, memory consumption, and network traffic, and constructs a data set based on these data. When running a microservice system in a simulated scenario, abnormal behaviors often occur, such as abnormally high CPU and memory usage, increased network latency, and service call timeouts. By comparing normal and abnormal data, this paper sets reasonable thresholds for each performance indicator and generates a training set for model training.
[0078] S1-3. Data preprocessing.
[0079] First, the link data matrix is defined as , where T is the time step, N is the number of microservices, and M is the feature dimension (including CPU usage, memory consumption, network traffic, request return value, request response time, and service name after one-hot encoding).
[0080] Next, we constructed a call relationship graph between services and set up a static service call adjacency matrix. If service i calls service j, then , otherwise 0.
[0081] In order to meet the requirements of model training, all numerical data are standardized using MinMaxScaler, and service names are converted into vector form through one-hot encoding. , K is the total number of services.
[0082] S2. Construction of fault prediction and location model.
[0083] After data preprocessing, the present invention uses the Transformer-BiLSTM model that integrates spatiotemporal features to predict and locate faults in microservice applications. The model combines spatiotemporal features and can fully learn the time dependency and spatial structure features in the microservice system.
[0084] S2-1. Temporal embedding and causal position encoding.
[0085] In a microservice system, the propagation of faults has obvious causal timing characteristics. For example, when service M fails, the associated service N may also fail. In order to accurately capture and understand this causal relationship, the causal position can be encoded. The specific formula is as follows:
[0086] ;
[0087] in, is to learn causal weights through historical abnormal data, If the time The time is If it is a potential cause, it is 1, otherwise it is 0. is the standard sinusoidal position encoding vector.
[0088] In addition, dynamic causal injection technology is also used to simulate and observe the response of the microservice system in the face of configuration changes, traffic changes, changes in service calls, etc. Through this technology, the dynamic changes of the system can be observed in real time, and the causal relationship model of the present invention can be further verified and adjusted. The specific formula is as follows:
[0089] ;
[0090] in, is the input feature matrix, is the embedding layer weight matrix.
[0091] S2-2. Time-aware multi-head attention mechanism.
[0092] In this paper, in order to enhance the model's ability to extract temporal features from input sequences, a time-aware multi-head attention mechanism is introduced. This mechanism specifically considers the spatial relationship of service call paths and enhances the model's spatiotemporal perception by integrating the service call path distance into the attention calculation.
[0093] First, by combining the service space topology graph and the time decay factor, a spatiotemporal joint decay factor is constructed. This decay factor not only takes into account the time factor, but also incorporates the spatial distance between services, thereby achieving joint perception of spatiotemporal information. The specific formula is as follows:
[0094] ;
[0095] in, is the shortest path distance from service i to j, , and is a learnable parameter; and Represents the timestamp of service i and service j.
[0096] Next, the attention mechanism is optimized using the above-mentioned spatiotemporal joint attenuation factor. The specific formula is as follows:
[0097] ;
[0098] Among them, Q, K and V are query, key and value respectively.
[0099] Finally, this optimized attention mechanism is extended to a multi-head setting to enhance the expressiveness and generalization ability of the model. Each head processes a different representation subspace, thereby capturing multiple aspects of the input data. The final output of the multi-head attention is the concatenation of the outputs of each head, and the specific formula is as follows:
[0100] ;
[0101] ;
[0102] in, is the projection matrix after splicing multiple outputs, , and is the projection matrix of the kth attention head.
[0103] S2-3. BiLSTM time series modeling.
[0104] Temporal features of Transformer output It is input into the BiLSTM network to capture local time dependencies. BiLSTM performs time series modeling through forward and reverse paths, and finally obtains the final time features by concatenating bidirectional hidden states. The specific formula is as follows:
[0105] ;
[0106] in, and are the hidden states of the forward and backward LSTM, is the temporal feature of the output.
[0107] S2-4, spatial feature extraction.
[0108] When extracting spatial features, we first construct node features and map the temporal features to This process involves calculating the attention score of each node to its neighbors in order to more accurately capture the interactions and information flows between nodes. The specific formula is as follows:
[0109] ;
[0110] Next, in order to solve the problem of multi-service collaborative detection, a spatiotemporal hypergraph attention mechanism is used. This mechanism can reflect the collaborative anomalies of multiple services. Each service and all its upstream dependent services constitute a hyperedge , is the set of direct upstream services of service i, is the hyperedge of service i, and the specific formula is as follows:
[0111] ;
[0112] in, is the maximum pooling operation, is the activation function, is the attention coefficient vector.
[0113] Finally, in order to solve the complex relationship between services in the microservice architecture, the dependency relationship is expressed through hyperedge feature aggregation to help detect service anomalies. The specific formula is as follows:
[0114] ;
[0115] S2-5, multi-modal adaptive fusion.
[0116] When dealing with a large amount of data generated by inter-service communication, such as log files, performance indicators, and network traffic, a multimodal adaptive gating mechanism is proposed to effectively analyze these data. A triple gating system is designed to optimize the fusion weights of temporal features, spatial features, and cross features.
[0117] First, in order to improve the accuracy of the model, the cross-attention features are projected and a comprehensive cross-attention mechanism is calculated. This mechanism involves the application of the attention weight matrix, which is as follows:
[0118] ;
[0119] in, , and is the attention weight matrix, is the time feature, is the spatial feature, is the crossover feature, is the feature dimension.
[0120] Next, in order to enable the model to effectively extract and utilize information from each modality, a multimodal gating vector is introduced. This vector helps the model adjust the weight of information according to the characteristics of different data, so as to detect anomalies more effectively. The specific formula is as follows:
[0121] ;
[0122] in, (Constrain the gated sum to 1), first input the temporal features, spatial features, and cross features into the multilayer perceptron, and then learn the weight of each feature through the multilayer perceptron to output the gating vector.
[0123] Finally, multimodal dynamic fusion is achieved by introducing a triple-weight gating mechanism. This mechanism further optimizes feature integration based on spatiotemporal fusion. The specific formula is as follows:
[0124] ;
[0125] in, They are the gating weights of time, space, and cross features respectively.
[0126] This integration process ensures the full integration of temporal, spatial and cross-features, providing strong support for fault prediction and location. In this way, the interaction and communication problems between various services can be analyzed and responded to more accurately.
[0127] S2-6. Fault prediction and location.
[0128] In the fault prediction and location system of the present invention, the fused spatiotemporal features are firstly subjected to global average pooling. This step helps to reduce the dimension of the data while retaining key spatiotemporal information, thereby providing a more concise and effective feature representation for subsequent analysis. The specific formula is as follows:
[0129] ;
[0130] Where N is the total number of services, i represents the current microservice, is the feature vector after global pooling.
[0131] Next, a well-designed classifier is used to achieve system-level fault prediction. This classifier is based on the processed average pooling features and can effectively identify various possible fault modes in the system. The working principle of the classifier is based on supervised learning. The model is trained with known fault and normal operation data, so as to quickly and accurately predict faults in actual operation. The specific formula is as follows:
[0132] ;
[0133] in, are system-level classifier parameters.
[0134] In addition, by classifying node features, service-level fault location can be further achieved. The specific formula is as follows:
[0135] ;
[0136] in, are the node-level classifier parameters.
[0137] S3. In the process of training the fault prediction model, a binary labeling method is used to distinguish the service status.
[0138] Specifically, if the performance indicators or link data of the service show abnormalities, indicating that the service has failed, the status is marked as 1; conversely, if all performance indicators are within the normal range, the status is marked as 0, indicating that the service is running normally. For the training of the fault classification model, a more detailed marking system is used to identify specific fault types. If the CPU usage is too high, it is marked as 1, memory leaks are marked as 2, and when network delays occur, it is marked as 3; if the request return value and request response time are abnormal, it is marked as 4, indicating a multi-instance fault. If all performance indicators of the service are within the normal range, the instance status is marked as 0, indicating no fault. This marking strategy not only helps the model to accurately learn and predict the service status, but also effectively identify and classify specific fault types, thereby providing guidance for subsequent fault handling and optimization.
[0139] S4. In order to enhance the robustness of the system and simulate real failure scenarios, automated testing is introduced into the real-time running microservice system. This enables the present invention to simulate various potential failure situations in a controlled and safe environment. In addition, the pre-trained model is integrated into the online microservice system to predict and locate potential failures in real time. The main function of the model is to use the current system status and historical data to predict the probability of failure of each microservice.
[0140] When the model predicts that a microservice may fail, the system automatically increases the number of instances of the service. This adaptive response mechanism ensures that microservice applications can maintain stable operation even when facing the risk of potential failures. This strategy not only improves the system's ability to prevent failures, but also optimizes the dynamic allocation of resources, thereby improving the availability and reliability of services. This integrated automated testing and real-time failure prediction system is the key to ensuring the continued stable operation of the microservice architecture.
[0141] Table 1
[0142]
[0143] Table 2
[0144]
[0145] Table 1 and Table 2 show the performance of fault prediction accuracy and Top-k prediction accuracy respectively. The results show that in the ShopSock system, the present invention shows better performance than the TrainTicket system. This difference mainly comes from the relatively small number of services in the ShopSock system and the simpler service execution trajectory. Compared with the CNN-LSTM and LSTM methods, the present invention performs better in predicting potential faults and can more effectively adapt to the dynamic changes and complexity of microservice systems.
[0146] Table 3
[0147]
[0148] Table 4
[0149]
[0150] Table 3 shows the comparison results of the present invention and other methods in terms of fault type prediction accuracy. As can be seen from the table, in the two systems of ShopSock and TrainTicket, the method proposed by the present invention shows significant performance advantages over CNN-LSTM and LSTM. This advantage mainly stems from the fact that the present invention conducts an in-depth analysis of the spatiotemporal characteristics of link data and service dependencies, thereby greatly improving the accuracy of fault type identification.
[0151] Table 4 shows the fault prediction accuracy in actual application scenarios. The results show that the TrainTicket system performs relatively well in configuration fault prediction. However, due to its extensive microservice architecture leading to complex dependencies and interactions, the potential multi-instance fault prediction accuracy is low. In contrast, the Sock Shop system shows higher prediction accuracy and recall for configuration faults such as memory leaks and CPU usage. In addition, the Sock Shop system also significantly outperforms the TrainTicket system in prediction accuracy and recall for multi-instance faults. This difference may be due to the fact that the Sock Shop system has a smaller number of microservices and clearer service dependencies, which facilitates the training and prediction of fault detection models.
[0152] This paper proposes an innovative method that focuses on learning from link data to achieve error prediction and fault location in microservice applications. Through a series of experimental verifications, the present invention can achieve high accuracy in the in-application prediction of potential errors, faulty microservices, and fault types, and outperforms the most advanced fault diagnosis methods for distributed systems. In addition, the present invention can also effectively predict potential errors caused by actual fault cases. It provides strong support for improving the stability and reliability of microservice systems.
Claims
1. A method for locating faults in microservice applications by learning from link data, characterized in that: The following steps are involved: S1. Perform hybrid fault injection on the open source microservice system, and then use Kubernetes' Istio service grid to collect microservice link data through its distributed tracing and pre-process the data. S2. Build a fault location model: After data preprocessing, the fault location of microservice applications is performed through the Transformer-BiLSTM model that integrates spatiotemporal features; S3. In the process of training the fault location model, a binary labeling method is used to distinguish the service status and output the fault location result; S4. Automated testing is introduced into the real-time microservice system. In addition, the trained fault location model is integrated into the online microservice system to predict and locate potential faults in real time. When the model predicts that a microservice will fail, the number of instances of the service is automatically increased.
2. According to claim 1, the method for locating faults in microservice applications by learning from link data is characterized in that: The specific implementation process of step 1 is as follows: S1-1. Hybrid fault injection into open source microservice systems: Use the traffic control of the Istio service grid in Kubernetes to simulate network delay and packet loss; set limits on the memory or CPU usage of containers to simulate resource exhaustion scenarios; implement exception handling through code injection technology to simulate service crashes; use Istio's fault injection function to simulate HTTP error codes; S1-2. Use Kubernetes' Istio service grid to collect microservice link data and process the data through its distributed tracing: After the fault injection technology generates historical error data, the link data of microservices, including CPU usage, memory consumption, and network traffic, is obtained through the service mesh Istio, and a data set is built based on this data. By comparing normal and abnormal data, thresholds are set for each performance indicator, and a training set is generated. S1-3. Data preprocessing: First, the link data matrix is defined as , where T is the time step, N is the number of microservices, and M is the feature dimension, including CPU usage, memory consumption, network traffic, request return value, request response time, and service name after one-hot encoding; Then, build the call relationship graph between services and set the static service call adjacency matrix ; If service i calls service j, then , otherwise 0; all numerical data are standardized using MinMaxScaler, and service names are converted into vector form through one-hot encoding , K is the total number of services.
3. The method for locating a fault in a microservice application by learning from link data according to claim 2, characterized in that: The specific implementation process of step S2 is as follows: S2-1, perform temporal embedding and causal position encoding on the preprocessed data; S2-2. After encoding, a time-aware multi-head attention mechanism is introduced to consider the spatial relationship of the service call path. By integrating the service call path distance into the attention calculation, the spatiotemporal perception ability is enhanced. S2-3. Based on the output of the time-aware multi-head attention mechanism, BiLSTM time series modeling is performed to obtain the final time features; S2-4, combine the spatiotemporal hypergraph attention mechanism to extract spatial features; S2-5, based on spatial features, multi-modal adaptive fusion is performed through a multi-modal adaptive gating mechanism to obtain features ; S2-6, perform fault prediction and location based on the multi-modal adaptive fusion results, and output the fault location results: perform global average pooling on the fused spatiotemporal features to obtain the feature ; A system-level fault prediction is achieved through a classifier. In addition, based on the feature ,By classifying node features, service-level fault location is achieved.
4. The method for locating a fault in a microservice application by learning from link data according to claim 3, characterized in that: The specific process of temporal embedding and causal position encoding is as follows: Encode the causal position, the specific formula is as follows: ; in, is to learn causal weights through historical abnormal data, If the time The time is If it is a potential cause, it is 1, otherwise it is 0. is the standard sinusoidal position encoding vector; Dynamic causal injection technology is used to simulate and observe the response of the microservice system in the face of configuration changes, traffic changes, and changes in service calls. The specific formula is as follows: ; in, is the input feature matrix, is the embedding layer weight matrix.
5. The method for locating a fault in a microservice application by learning from link data according to claim 4, characterized in that: The specific implementation process of the time-aware multi-head attention mechanism is as follows: First, by combining the service space topology graph and the time decay factor, a spatiotemporal joint decay factor is constructed. The specific formula is as follows: ; in, is the shortest path distance from service i to j, , and is a learnable parameter; and Represents the timestamps of service i and service j; The above-mentioned spatiotemporal joint attenuation factor is used to optimize the attention mechanism. The specific formula is as follows: ; Among them, Q, K and V are query, key and value respectively; Finally, the optimized attention mechanism is extended to a multi-head setting, where each head processes a different representation subspace to capture multi-faceted features of the input data; the final output of the multi-head attention is the concatenation of the outputs of each head.
6. The method for locating a fault in a microservice application by learning from link data according to claim 5, characterized in that: The specific implementation process of BiLSTM time series modeling in step S2-3 is as follows: The link data of the microservice is processed through Transformer, and then the high-dimensional features that can reflect the dynamics of the time series are input into the BiLSTM layer. The time series features output by Transformer It is input into the BiLSTM network to capture local time dependencies; BiLSTM performs time series modeling through forward and reverse paths, and finally obtains the final time features by concatenating bidirectional hidden states .
7. The method for locating a fault in a microservice application by learning from link data according to claim 6, characterized in that: The specific implementation process of the spatiotemporal hypergraph attention mechanism is as follows: When performing spatial feature extraction, the spatiotemporal hypergraph attention mechanism is first used. Each service and all its upstream dependent services form a hyperedge. , is the set of direct upstream services of service i, is the hyperedge of service i, and the specific formula is as follows: ; is the maximum pooling, is the activation function, is the attention coefficient vector; Then, the dependency is expressed through hyperedge feature aggregation. The specific formula is as follows: 。 8. The method for locating a fault in a microservice application by learning from link data according to claim 7, characterized in that: The specific implementation process of multi-modal adaptive fusion through the multi-modal adaptive gating mechanism is as follows: A multi-modal adaptive gating mechanism is proposed, and a triple gating system is designed to optimize the fusion weights of temporal features, spatial features, and cross-features. First, the criss-cross attention features are projected and a comprehensive criss-cross attention mechanism is calculated: ; in, , and is the attention weight matrix, is the time feature, is the spatial feature, is the crossover feature, is the feature dimension; Next, the multimodal gating vector is introduced. The specific formula is as follows: ; in, ,First, the temporal features, spatial features and cross features are input into the multilayer perceptron, and then the weight of each feature is learned by the multilayer perceptron, and the gating vector is output; Finally, multi-modal dynamic fusion is achieved by introducing a triple-weight gating mechanism. The specific formula is as follows: ; in, They are the gating weights of time, space, and cross features respectively.
9. The method for locating a fault in a microservice application by learning from link data according to claim 8, characterized in that: The binary marking method is specifically used to distinguish the service status: if the performance indicator or link data of the service shows abnormality, indicating that the service fails, the status is marked as 1; On the contrary, if all performance indicators are within the normal range, the status is marked as 0, indicating that the service is running normally; For the training of the fault classification model, a more detailed marking system is used to identify the specific fault type. If the CPU usage is too high, it is marked as 1, if the memory leak is marked as 2, and if a network delay occurs, it is marked as 3; if the request return value and request response time are abnormal, it is marked as 4, indicating a multi-instance failure; if all performance indicators of the service are within the normal range, the instance status is marked as 0, indicating no fault.
Citation Information
Patent Citations
Microservice call chain anomaly detection method and device based on graph convolutional neural network
CN115185736A
Root cause positioning method, system and device
CN119496690A
Fault detection method based on multi-modal attention mechanism
CN119621401A
Trigger point detection for online root cause analysis and system fault diagnosis
US20240054043A1
Processing method for implementing monitoring intellectualization on the basis of micro-services, and electronic device
WO2021008031A1
Cited By
Predictive maintenance method and system for industrial equipment
CN120871774A