Backend service automation design method and system

Through real-time monitoring data and multi-dimensional service anomaly detection models, the anomaly detection, root cause location and recovery execution of the back-end service system are automatically completed, solving the problems of high operation and maintenance complexity and low automation in the existing technology, and achieving high efficiency. , accurate exception management process.

CN119025396BActive Publication Date: 2025-01-21NANJING XINMI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411509893.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-01-21
Estimated Expiration
2044-10-28

AI Technical Summary

Technical Problem

The existing technology is difficult to realize the full process automation of abnormal discovery of back-end service systems and the root cause positioning and recovery execution, resulting in high operation and maintenance complexity, untimely abnormal discovery, inaccurate positioning, and inefficient recovery, which seriously affects business continuity.

Method used

By obtaining real-time monitoring data of the back-end service system, the pre-trained multi-dimensional service anomaly detection model is used to determine whether there are anomalies in the system and trigger the anomaly positioning process. The process includes building a service dependency topology graph, using graph neural network to generate a low-dimensional vector representation of service dependencies, and locating abnormal root cause services by combining service operation indicators and business key performance indicators. Based on the historical processing data of the root cause service, the service recovery strategy is automatically generated and dynamically adjusted through the container orchestration interface until the system is fully restored.

Benefits of technology

It realizes the automation of the entire process from anomaly detection, root cause location to recovery execution, greatly reduces manual participation and delay, improves the accuracy of anomaly detection and diagnosis, and enhances the reliability and operation and maintenance efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025396B_ABST
    Figure CN119025396B_ABST
Patent Text Reader

Abstract

The present invention provides a back-end service automation design method and system, which relates to the technical field of back-end services, including obtaining real-time monitoring data of a back-end service system, using a pre-trained multi-dimensional service anomaly detection model to determine whether there is an anomaly in the back-end service system, and triggering an anomaly location process when an anomaly is detected; inputting service operation indicators and business key performance indicators into a pre-built joint reasoning model to locate the root cause service of the anomaly; automatically generating a service recovery strategy based on historical processing data of the root cause service, and dynamically adjusting the relevant service instances of the back-end service system by calling a container orchestration interface according to the service recovery strategy, and obtaining recovery monitoring data of the service instance in real time, adaptively optimizing the service recovery strategy based on the recovery monitoring data, and continuously performing service adjustment according to the optimized recovery strategy until the back-end service system is fully recovered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to backend service technology, and in particular to a backend service automation design method and system. Background Art

[0002] With the rapid development of Internet technology, more and more companies choose to build their business systems on cloud computing platforms and adopt the microservice architecture model for development and deployment. The microservice architecture improves the flexibility, scalability and fault tolerance of the system by splitting the system into multiple independent and reusable service components. However, the microservice architecture also brings about the problem of a sharp increase in operation and maintenance complexity. The backend service system usually contains a large number of service instances, and there are intricate call dependencies between them. When a service instance fails or has performance abnormalities, it will quickly cause the failure to spread and business interruption, which brings huge challenges to the operation and maintenance team to locate and fix the problem.

[0003] Traditional operation and maintenance methods mainly rely on manual monitoring and troubleshooting. Operation and maintenance personnel manually determine whether the system is abnormal and locate the cause of the failure by checking various dashboards and logs and combining their own experience. This method is difficult to cope with the real-time and complex requirements of large-scale microservice systems, and is prone to problems such as untimely detection of anomalies, inaccurate positioning, and inefficient recovery, which seriously affects business continuity.

[0004] In view of the above background, there is an urgent need for a back-end service automation design method to achieve full process automation from anomaly discovery, root cause location to recovery execution, improve system reliability and operation and maintenance efficiency, and provide strong support for the rapid development of enterprise business. Summary of the invention

[0005] The embodiments of the present invention provide a backend service automation design method and system, which can solve the problems in the prior art.

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

[0007] Provides a backend service automation design method, including:

[0008] Acquire real-time monitoring data of the backend service system, the real-time monitoring data including service call link information, service operation indicators and business key performance indicators, and based on the real-time monitoring data, use a pre-trained multi-dimensional service anomaly detection model to determine whether there is an anomaly in the backend service system, and trigger an anomaly location process when an anomaly is detected;

[0009] Build a service dependency topology graph based on the service call link information, and use a graph neural network to encode the service dependency topology graph to generate a low-dimensional vector representation of the service dependency relationship. Input the service operation indicators and business key performance indicators into the pre-built joint reasoning model, and locate the root cause service of the abnormality in combination with the low-dimensional vector representation of the service dependency relationship.

[0010] Based on the historical processing data of the root cause service, a service recovery strategy is automatically generated. According to the service recovery strategy, by calling the container orchestration interface, dynamic adjustments are performed on the relevant service instances of the back-end service system, and the recovery monitoring data of the service instances are obtained in real time. The service recovery strategy is adaptively optimized based on the recovery monitoring data, and service adjustments are continuously performed according to the optimized recovery strategy until the back-end service system is fully recovered.

[0011] In an optional embodiment,

[0012] Based on the real-time monitoring data, a pre-trained multi-dimensional service anomaly detection model is used to determine whether there is an anomaly in the backend service system, and when an anomaly is detected, the anomaly location process is triggered, including:

[0013] The acquired real-time monitoring data is preprocessed and the sampling frequencies of different indicators are aligned according to the timestamps. The sliding window method is used to extract features from the preprocessed real-time monitoring data. The statistical features of each indicator in the window are extracted with a fixed time window as the unit, and the key feature subset is screened through the feature selection algorithm.

[0014] A twin neural network consisting of two sub-networks with the same structure is constructed as a multi-dimensional service anomaly detection model. Each sub-network consists of a multi-layer one-dimensional convolutional neural network and a long short-term memory network. The two sub-networks share parameters, and a similarity measurement module is introduced after the two sub-networks.

[0015] The key feature subset of the service status to be tested in the real-time monitoring data is input into the pre-trained multi-dimensional service anomaly detection model to obtain the feature vector of the service status to be tested, and multiple normal service status samples are randomly selected from the support set. The distance between the service status to be tested and each normal service status sample in the feature space is calculated, and the average value is taken as the anomaly score. According to the comparison result between the set anomaly threshold and the obtained anomaly score, it is determined whether there is an anomaly in the backend service system. When it is determined that there is an anomaly in the backend service system, the anomaly location process is triggered.

[0016] In an optional embodiment,

[0017] The steps before inputting the key feature subset of the service status to be tested in the real-time monitoring data into the pre-trained multi-dimensional service anomaly detection model to obtain the feature vector of the service status to be tested also include:

[0018] Randomly sample a batch of normal service statuses from historical monitoring data as a support set, and construct positive sample pairs and negative sample pairs based on the support set, wherein the positive sample pair consists of two normal service status samples randomly selected from the support set, and the negative sample pair consists of a normal service status sample randomly selected from the support set and a service status sample randomly selected from the historical monitoring data;

[0019] Inputting the constructed positive sample pairs and negative sample pairs into the twin neural network, and obtaining feature mapping vectors of the positive sample pairs and negative sample pairs in the feature space through the twin neural network;

[0020] An adaptive threshold and hard negative sample mining mechanism are introduced. The contrastive learning loss function is constructed by minimizing the distance between the feature mapping vectors of the positive sample pairs and maximizing the distance between the feature mapping vectors of the negative sample pairs until it is greater than the threshold. Based on the contrastive learning loss function, the gradient descent method is used to train the parameters of the twin neural network, and finally a trained multi-dimensional service anomaly detection model is obtained.

[0021] In an optional embodiment,

[0022] Adaptive threshold and hard negative sample mining mechanism are introduced to construct contrastive learning loss function by minimizing the distance between feature mapping vectors of positive sample pairs and maximizing the distance between feature mapping vectors of negative sample pairs until it is greater than the threshold.

[0023] An adaptive threshold function is introduced to dynamically adjust the threshold according to the similarity of positive and negative sample pairs. The formula of the adaptive threshold function is as follows:

[0024] ;

[0025] Where τ(·) represents the adaptive threshold function, represents the cosine similarity of the i-th positive sample pair, represents the cosine similarity of the i-th negative sample pair, η represents the hyperparameter, α represents the constant that controls the upper limit of the threshold, and β represents the constant that controls the lower limit of the threshold;

[0026] The hard negative sample mining mechanism includes: for each positive sample, find the C target negative samples with the closest distance in the feature space, and calculate the weighted average of the similarity between each target negative sample and the positive sample to obtain the corresponding hard negative sample. The hard negative sample calculation formula is as follows:

[0027] ;

[0028] in, represents the hard negative sample corresponding to the i-th positive sample, C represents the number of negative samples closest to the feature space, represents the cosine similarity between the cth closest negative sample and the positive sample in the i-th positive sample pair, and X represents the temperature hyperparameter;

[0029] Adaptive threshold and hard negative sample mining mechanism are introduced. The formula of contrastive learning loss function is constructed by minimizing the distance between feature mapping vectors of positive sample pairs and maximizing the distance between feature mapping vectors of negative sample pairs until it is greater than the threshold:

[0030] ;

[0031] Among them, L represents the contrastive learning loss function and N represents the number of training sample pairs.

[0032] In an optional embodiment,

[0033] A service dependency topology graph is constructed based on the service call link information, and the graph neural network is used to encode the service dependency topology graph to generate a low-dimensional vector representation of the service dependency relationship. The service operation indicators and business key performance indicators are input into the pre-built joint reasoning model, and combined with the low-dimensional vector representation of the service dependency relationship, the root cause of the abnormality is located. Services include:

[0034] Construct a service dependency topology graph according to the service call link information, wherein the service dependency topology graph includes service nodes and underlying resource nodes, as well as call relationship edges between service nodes and deployment association edges between service nodes and resource nodes, wherein the underlying resource nodes include hosts, containers, and middleware to which the service belongs;

[0035] A heterogeneous graph convolutional network is used to encode the service dependency topology graph. The heterogeneous graph convolutional network aggregates the semantic information of neighbor nodes of different node types by introducing an attention mechanism to obtain a low-dimensional vector representation of the service node.

[0036] Constructing a causal graph based on expert knowledge and data-driven methods, wherein the causal graph is a directed acyclic graph including service nodes and business indicator nodes in a service dependency topology graph, wherein directed edges represent causal dependencies between nodes;

[0037] A structural causal model is constructed for each node in the causal graph as a joint reasoning model. The low-dimensional vector representation of the service node, the operating indicators of the service node, and the business indicators are input into the structural causal model. The structural causal model is trained by minimizing the mean square error loss function between the predicted values ​​and the true values ​​of all nodes.

[0038] When an abnormal business indicator node is detected, a set of candidate abnormal service nodes that have a causal path with the abnormal business indicator node is obtained, and counterfactual reasoning is performed on each service node in the candidate abnormal service node set. The counterfactual reasoning is performed by setting the service node to a normal state and using the trained structural causal model to estimate the counterfactual value of the abnormal business indicator node, so as to obtain the causal effect of the current candidate abnormal service node on the abnormality, and arrange the candidate abnormal service nodes in descending order based on the size of their causal effects to obtain a priority list of abnormal root cause services, and locate the abnormal root cause service according to the priority list.

[0039] In an optional embodiment,

[0040] Based on the historical processing data of the root cause service, a service recovery strategy is automatically generated. According to the service recovery strategy, by calling the container orchestration interface, a dynamic adjustment is performed on the relevant service instances of the backend service system, including:

[0041] Acquire the historical abnormality diagnosis and disposal data accumulated in the service root cause location phase, perform denoising, normalization and dimension reduction processing on the historical abnormality diagnosis and disposal data, and obtain the pre-processed historical abnormality diagnosis and disposal data;

[0042] Based on the pre-processed historical abnormal diagnosis and disposal data, the key features reflecting the fault mode, the measurement features related to the recovery effect, and the high-order combination features between the fault features are extracted to construct a fault recovery sample set containing multi-dimensional features.

[0043] Using the fault recovery sample set as training data, training a pre-built service recovery strategy generation model, learning the mapping relationship between fault features and recovery action sequences, calculating the probability distribution of the recovery action sequence through the service recovery strategy generation model, and using the maximum likelihood estimation method to learn the optimal parameters of the model, to obtain a trained service recovery strategy generation model;

[0044] When a new fault feature is received, the new fault feature is input into the trained service recovery strategy generation model, and the recovery action sequence with the highest conditional probability is inferred through the Viterbi decoding algorithm, and the recovery action sequence with the highest conditional probability is used as the service recovery strategy;

[0045] The service recovery strategy is passed to the container orchestration platform, resource configuration updates are performed on the working nodes where the service is running through the API interface of the container orchestration platform, and a rolling update mechanism is used to dynamically adjust the service instances of the backend service system.

[0046] In an optional embodiment,

[0047] The calculation formula for calculating the probability distribution of the recovery action sequence through the service recovery strategy generation model is as follows:

[0048] ;

[0049] Where y represents the recovery action sequence, μ(x) represents the fault feature sequence, P(·) represents the probability distribution, Z(·) represents the normalization factor, K represents the length of the recovery action sequence, and θ k represents the weight of the transfer feature function, T represents transposition, f k (·) represents the transfer characteristic function, y k represents the kth recovery action in the recovery action sequence, J represents the number of feature functions, and λ j represents the weight of the state characteristic function, g j (·) represents the state characteristic function, y k+1 Represents the k+1th recovery action in the recovery action sequence.

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

[0051] Provided is a backend service automation design system, including:

[0052] The first unit is used to obtain real-time monitoring data of the backend service system, wherein the real-time monitoring data includes service call link information, service operation indicators and business key performance indicators, and based on the real-time monitoring data, use a pre-trained multi-dimensional service anomaly detection model to determine whether there is an anomaly in the backend service system, and trigger an anomaly location process when an anomaly is detected;

[0053] The second unit is used to build a service dependency topology map based on the service call link information, and use a graph neural network to encode the service dependency topology map to generate a low-dimensional vector representation of the service dependency relationship, input the service operation indicators and business key performance indicators into a pre-built joint reasoning model, and locate the root cause service of the abnormality in combination with the low-dimensional vector representation of the service dependency relationship;

[0054] The third unit is used to automatically generate a service recovery strategy based on the historical processing data of the root cause service, and according to the service recovery strategy, dynamically adjust the relevant service instances of the back-end service system by calling the container orchestration interface, and obtain the recovery monitoring data of the service instances in real time, adaptively optimize the service recovery strategy based on the recovery monitoring data, and continuously execute service adjustments according to the optimized recovery strategy until the back-end service system is fully recovered.

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

[0056] An electronic device is provided, comprising:

[0057] processor;

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

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

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

[0061] 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.

[0062] In this embodiment, from anomaly detection, root cause location to recovery execution, a complete automated exception management closed loop is achieved, which greatly reduces manual participation and delays. The accuracy of anomaly detection and diagnosis is improved by comprehensively utilizing multi-source heterogeneous data such as service topology, call links, operation indicators and business indicators. Modeling and reasoning using service dependencies can effectively analyze and locate the true root cause of anomalies in complex topologies. By continuously accumulating abnormal recovery cases and adaptively optimizing the generated recovery strategies, the recovery effect is continuously improved. The exception management process is seamlessly integrated into the existing container orchestration platform to achieve smooth transition and resource reuse, which greatly reduces the workload of manual intervention and processing and reduces the labor cost of operation and maintenance. The full process automation from anomaly detection, root cause location to recovery strategy generation is achieved, which greatly reduces the manual operation and maintenance costs and improves the reliability and stability of the service. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 A schematic diagram of a flow chart of a method for automatically designing backend services according to an embodiment of the present invention;

[0064] Figure 2 A schematic diagram of the structure of a backend service automation design system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0065] 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.

[0066] 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.

[0067] Figure 1The flowchart of the backend service automation design method according to the embodiment of the present invention is as follows: Figure 1 As shown, the method includes:

[0068] S101. Obtain real-time monitoring data of the backend service system, wherein the real-time monitoring data includes service call link information, service operation indicators, and business key performance indicators. Based on the real-time monitoring data, use a pre-trained multi-dimensional service anomaly detection model to determine whether there is an anomaly in the backend service system, and trigger the anomaly location process when an anomaly is detected.

[0069] Among them, the service call link information reflects the call dependency relationship between services; service operation indicators include the CPU utilization rate, memory usage, request response time, etc. of the service instance; business key performance indicators reflect the operation health of the service from the business level, such as order success rate, payment response delay, etc.

[0070] In an optional embodiment,

[0071] Based on the real-time monitoring data, a pre-trained multi-dimensional service anomaly detection model is used to determine whether there is an anomaly in the backend service system, and when an anomaly is detected, the anomaly location process is triggered, including:

[0072] The acquired real-time monitoring data is preprocessed and the sampling frequencies of different indicators are aligned according to the timestamps. The sliding window method is used to extract features from the preprocessed real-time monitoring data. The statistical features of each indicator in the window are extracted with a fixed time window as the unit, and the key feature subset is screened through the feature selection algorithm.

[0073] A twin neural network consisting of two sub-networks with the same structure is constructed as a multi-dimensional service anomaly detection model. Each sub-network consists of a multi-layer one-dimensional convolutional neural network and a long short-term memory network. The two sub-networks share parameters, and a similarity measurement module is introduced after the two sub-networks.

[0074] The key feature subset of the service status to be tested in the real-time monitoring data is input into the pre-trained multi-dimensional service anomaly detection model to obtain the feature vector of the service status to be tested, and multiple normal service status samples are randomly selected from the support set. The distance between the service status to be tested and each normal service status sample in the feature space is calculated, and the average value is taken as the anomaly score. According to the comparison result between the set anomaly threshold and the obtained anomaly score, it is determined whether there is an anomaly in the backend service system. When it is determined that there is an anomaly in the backend service system, the anomaly location process is triggered.

[0075] For example, first obtain real-time multi-dimensional time series indicator data from the monitoring platform of the service system, including CPU utilization, memory occupancy, request response time, error rate, etc. Perform preprocessing operations such as cleaning and normalization on the original data, and align the sampling frequencies of different indicators according to the timestamp.

[0076] Perform feature extraction and selection on the preprocessed time series data. Using the sliding window method, with a fixed time window (such as 5 minutes) as the unit, extract the statistical features of each indicator in the window, such as mean, variance, kurtosis, etc. Then use statistical test methods (such as t-test, F-test) or feature selection algorithms (such as Lasso regression, tree model), etc., to evaluate the abnormal discrimination ability of each feature and screen out a set of the most representative key feature subsets.

[0077] Two sub-networks with the same structure are designed. Each sub-network consists of a multi-layer one-dimensional convolutional neural network (1D-CNN) and a long short-term memory network (LSTM). The CNN layer is used to extract local temporal feature patterns, and the LSTM layer is used to capture long-term temporal dependencies. The two sub-networks share parameters to ensure the consistency of feature mapping for different inputs. After the two sub-networks, a similarity measurement module is introduced, using the L1 norm distance function to measure the similarity between two samples in the feature space.

[0078] The twin neural network is pre-trained unsupervised using historical normal service status data. A batch of normal states are randomly sampled from historical data as the support set to construct positive sample pairs and negative sample pairs. The positive sample pair consists of two normal samples in the support set, and the negative sample pair consists of a normal sample and a randomly sampled state. Then the contrast loss function is used to train the twin network so that the feature distance of the positive sample pair is less than a threshold and the feature distance of the negative sample pair is greater than another threshold. Through this self-supervised learning method, the network can learn the general normal mode of the service status.

[0079] In the test phase, the state to be tested is input into the trained twin network to obtain its feature vector. Then, K normal state samples are randomly selected from the support set, and the L1 distance between the state to be tested and each support sample in the feature space is calculated, and the average value is taken as the anomaly score. An anomaly threshold is set. When the anomaly score exceeds the threshold, it is judged as an abnormal state. The threshold can be tuned according to the anomaly detection performance on the validation set, such as F1 score, AUC and other indicators.

[0080] Optionally, in order to adapt to the dynamic changes of the service system, the anomaly detection model needs to be continuously learned and updated online. An incremental learning strategy based on memory playback is adopted to maintain a dynamic support set, regularly supplement or replace support samples from newly collected data, and use new samples to fine-tune the twin network. During the fine-tuning process, only the last few layers of the twin network parameters are updated to reduce the risk of catastrophic forgetting. At the same time, a knowledge distillation mechanism is introduced to use the historical network model as a teacher network to guide the incremental learning of the new network, further improving the robustness of the model.

[0081] In this embodiment, there is no need to manually label abnormal samples, and the data of normal service status can be used to automatically detect system operation anomalies. Combining multiple monitoring indicators, it is possible to capture complex system abnormal patterns and automatically extract effective features from the original monitoring data without manual feature engineering. New normal samples can be continuously included to expand the support set and improve detection performance, which can significantly improve the automation level and timeliness of anomaly detection and enhance the observability and maintainability of the service system.

[0082] In an optional embodiment,

[0083] The steps before inputting the key feature subset of the service status to be tested in the real-time monitoring data into the pre-trained multi-dimensional service anomaly detection model to obtain the feature vector of the service status to be tested also include:

[0084] Randomly sample a batch of normal service statuses from historical monitoring data as a support set, and construct positive sample pairs and negative sample pairs based on the support set, wherein the positive sample pair consists of two normal service status samples randomly selected from the support set, and the negative sample pair consists of a normal service status sample randomly selected from the support set and a service status sample randomly selected from the historical monitoring data;

[0085] Inputting the constructed positive sample pairs and negative sample pairs into the twin neural network, and obtaining feature mapping vectors of the positive sample pairs and negative sample pairs in the feature space through the twin neural network;

[0086] An adaptive threshold and hard negative sample mining mechanism are introduced. The contrastive learning loss function is constructed by minimizing the distance between the feature mapping vectors of the positive sample pairs and maximizing the distance between the feature mapping vectors of the negative sample pairs until it is greater than the threshold. Based on the contrastive learning loss function, the gradient descent method is used to train the parameters of the twin neural network, and finally a trained multi-dimensional service anomaly detection model is obtained.

[0087] For example, a batch of normal service states are randomly sampled from massive historical monitoring data as a support set, where the support set refers to a set of samples that can represent normal service states and is used for subsequent model training and abnormality judgment.

[0088] After obtaining the support set, construct positive sample pairs and negative sample pairs based on the support set. The positive sample pair consists of two normal service status samples randomly selected from the support set, reflecting the distribution characteristics of the normal service status in the feature space. The negative sample pair consists of a normal service status sample randomly selected from the support set and a service status sample randomly selected from the historical monitoring data, where the latter may be a normal state or an abnormal state. Through the negative sample pair, the boundary between the normal state and the abnormal state can be learned.

[0089] The constructed positive sample pairs and negative sample pairs are input into the twin neural network for feature extraction. The twin neural network consists of two sub-networks with the same structure and shared parameters. It can map the input samples into a high-dimensional feature space to obtain their feature mapping vectors. Through the twin network, the similarity between samples can be effectively measured, laying the foundation for subsequent comparative learning.

[0090] On the basis of feature extraction, adaptive threshold and hard negative sample mining mechanism are introduced to construct contrastive learning loss function. The core idea of ​​contrastive learning is to minimize the distance between the feature mapping vectors of positive sample pairs and maximize the distance between the feature mapping vectors of negative sample pairs, so that positive samples gather in the feature space and negative samples stay away from each other. Among them, the adaptive threshold mechanism dynamically adjusts the contrastive learning intensity according to the difficulty of the sample. For samples that are easy to distinguish, the threshold is small and the contrastive learning intensity is relatively weak; for samples that are difficult to distinguish, the threshold is large and the contrastive learning intensity is relatively strong. Through the adaptive threshold, the sample diversity can be taken into account and the generalization ability of the model can be improved. The hard negative sample mining mechanism focuses on those negative samples that are closest to the positive samples and are most likely to cause misjudgment. By giving these hard negative samples higher weights, the model can be more focused on the subtle differences near the boundary between abnormal and normal, thereby improving the sensitivity and accuracy of anomaly detection.

[0091] Based on the constructed contrastive learning loss function, the gradient descent method is used to perform end-to-end training optimization on the parameters of the twin neural network. By continuously iteratively updating the network parameters and minimizing the loss function, the distance between positive sample pairs is continuously reduced, and the distance between negative sample pairs is continuously increased until it exceeds the set threshold, and finally a multi-dimensional service anomaly detection model with excellent performance is obtained. This model can comprehensively characterize the service status from multiple dimensions of service operation, and timely discover and warn abnormal behaviors hidden in high-dimensional data, providing strong support for intelligent operation and maintenance.

[0092] When new service status data to be tested arrives, it is input into the trained anomaly detection model to obtain the mapping vector of the status in the feature space. The average distance between the vector and all positive sample feature mapping vectors in the support set is calculated. If the average distance exceeds a certain threshold, the service status is judged to be abnormal, otherwise it is normal.

[0093] In an optional embodiment,

[0094] Adaptive threshold and hard negative sample mining mechanism are introduced to construct contrastive learning loss function by minimizing the distance between feature mapping vectors of positive sample pairs and maximizing the distance between feature mapping vectors of negative sample pairs until it is greater than the threshold.

[0095] An adaptive threshold function is introduced to dynamically adjust the threshold according to the similarity of positive and negative sample pairs. The formula of the adaptive threshold function is as follows:

[0096] ;

[0097] Where τ(·) represents the adaptive threshold function, represents the cosine similarity of the i-th positive sample pair, represents the cosine similarity of the i-th negative sample pair, η represents the hyperparameter, α represents the constant that controls the upper limit of the threshold, and β represents the constant that controls the lower limit of the threshold;

[0098] The hard negative sample mining mechanism includes: for each positive sample, find the C target negative samples with the closest distance in the feature space, and calculate the weighted average of the similarity between each target negative sample and the positive sample to obtain the corresponding hard negative sample. The hard negative sample calculation formula is as follows:

[0099] ;

[0100] in, represents the hard negative sample corresponding to the i-th positive sample, C represents the number of negative samples closest to the feature space, represents the cosine similarity between the cth closest negative sample and the positive sample in the i-th positive sample pair, and X represents the temperature hyperparameter;

[0101] Adaptive threshold and hard negative sample mining mechanism are introduced. The formula of contrastive learning loss function is constructed by minimizing the distance between feature mapping vectors of positive sample pairs and maximizing the distance between feature mapping vectors of negative sample pairs until it is greater than the threshold:

[0102] ;

[0103] Among them, L represents the contrastive learning loss function and N represents the number of training sample pairs.

[0104] In this embodiment, by constructing negative sample pairs, limited historical abnormal samples can be used to improve the discrimination ability. Through the adaptive threshold mechanism, the abnormal discrimination threshold can be automatically tuned to improve the detection performance. The introduction of hard negative sample mining allows the model to pay more attention to difficult-to-distinguish boundary samples and enhance the discrimination ability. Training based on the contrast loss function helps to learn more discriminative feature representations. The entire process does not require manual annotation of abnormal samples, which is a true self-supervised learning paradigm. By mining boundary samples, the model's generalization ability for anomalies is enhanced. The performance and robustness of unsupervised anomaly detection are further improved. Through mechanisms such as adaptive thresholds, hard negative sample mining, and contrastive learning paradigms, discriminative feature representations are learned from limited abnormal samples, which improves the model's discrimination and generalization ability.

[0105] S102. Construct a service dependency topology map based on the service call link information, and use a graph neural network to encode the service dependency topology map to generate a low-dimensional vector representation of the service dependency relationship. Input the service operation indicators and business key performance indicators into a pre-built joint reasoning model, and combine the low-dimensional vector representation of the service dependency relationship to locate the root cause of the abnormal service.

[0106] In an optional embodiment,

[0107] A service dependency topology graph is constructed based on the service call link information, and the graph neural network is used to encode the service dependency topology graph to generate a low-dimensional vector representation of the service dependency relationship. The service operation indicators and business key performance indicators are input into the pre-built joint reasoning model, and combined with the low-dimensional vector representation of the service dependency relationship, the root cause of the abnormality is located. Services include:

[0108] Construct a service dependency topology graph according to the service call link information, wherein the service dependency topology graph includes service nodes and underlying resource nodes, as well as call relationship edges between service nodes and deployment association edges between service nodes and resource nodes, wherein the underlying resource nodes include hosts, containers, and middleware to which the service belongs;

[0109] A heterogeneous graph convolutional network is used to encode the service dependency topology graph. The heterogeneous graph convolutional network aggregates the semantic information of neighbor nodes of different node types by introducing an attention mechanism to obtain a low-dimensional vector representation of the service node.

[0110] Constructing a causal graph based on expert knowledge and data-driven methods, wherein the causal graph is a directed acyclic graph including service nodes and business indicator nodes in a service dependency topology graph, wherein directed edges represent causal dependencies between nodes;

[0111] A structural causal model is constructed for each node in the causal graph as a joint reasoning model. The low-dimensional vector representation of the service node, the operating indicators of the service node, and the business indicators are input into the structural causal model. The structural causal model is trained by minimizing the mean square error loss function between the predicted values ​​and the true values ​​of all nodes.

[0112] When an abnormal business indicator node is detected, a set of candidate abnormal service nodes that have a causal path with the abnormal business indicator node is obtained, and counterfactual reasoning is performed on each service node in the candidate abnormal service node set. The counterfactual reasoning is performed by setting the service node to a normal state and using the trained structural causal model to estimate the counterfactual value of the abnormal business indicator node, so as to obtain the causal effect of the current candidate abnormal service node on the abnormality, and arrange the candidate abnormal service nodes in descending order based on the size of their causal effects to obtain a priority list of abnormal root cause services, and locate the abnormal root cause service according to the priority list.

[0113] For example, a service dependency topology diagram is first constructed based on the service call link information to depict the call relationship between service nodes and the deployment relationship between service nodes and underlying resource nodes. Among them, the service nodes represent the various microservice components in the system, and the underlying resource nodes include the host, container, middleware and other infrastructure that the service depends on. By constructing a service dependency topology diagram, the dependency structure and deployment topology of the microservice architecture can be fully presented.

[0114] After obtaining the service dependency topology graph, a heterogeneous graph convolutional network is used to encode and represent it. Unlike traditional homogeneous graph convolutional networks, heterogeneous graph convolutional networks can handle complex heterogeneous graph structures containing multiple types of nodes and edges. The core idea is to introduce an attention mechanism to aggregate the semantic information of neighboring nodes under different node types and obtain a low-dimensional vector representation of the node. Specifically, for each node in the service dependency topology graph, the heterogeneous graph convolutional network considers its different types of neighboring nodes, such as the caller service, the callee service, the deployment host, etc., and uses the attention weight to adaptively fuse the feature information of these neighboring nodes to obtain the semantic representation vector of the current node. In this way, the heterogeneous graph convolutional network can fully mine the semantic information of the service node in the topological structure and provide a good feature foundation for subsequent causal reasoning.

[0115] After obtaining the semantic representation of the service node, a causal graph is further constructed based on expert knowledge and data-driven methods to characterize the causal dependency between service nodes and business indicator nodes. A causal graph is essentially a directed acyclic graph, in which directed edges represent the causal dependency between nodes, that is, the change of a node will cause the change of its neighboring nodes. Constructing a causal graph requires the comprehensive use of the prior knowledge of domain experts and the statistical information contained in the data. On the one hand, expert knowledge can provide an intuitive understanding of the internal causal mechanism of the system and guide the initial construction of the causal graph; on the other hand, data-driven methods such as conditional independence tests can automatically discover potential causal dependencies from the data, which are used to improve and optimize the causal graph structure. Through the organic combination of expert knowledge and data-driven, a causal graph representation that is consistent with both domain cognition and data characteristics can be obtained.

[0116] Based on the constructed causal graph, a structural causal model is constructed for each node as a joint reasoning engine. The structural causal model uses the causal graph as the skeleton and the nodes in the graph as variables to characterize the causal dependency between variables, which can be used for causal effect estimation and counterfactual inference. The low-dimensional vector representation of the service node, the operating indicators of the service node, and the business indicators are used as input. The structural causal model is trained by minimizing the mean square error loss function between the predicted values ​​and the true values ​​of all nodes, so that it can fit the causal dependency law between nodes. The operating indicators here can be performance metrics such as the response time, throughput, and resource utilization of the service node, reflecting the operating status of the service node; business indicators are related to business semantics, such as order success rate, user experience satisfaction, etc., reflecting the overall business performance of the system. Through end-to-end training, the structural causal model can establish a causal mapping relationship from the service node status to the performance of business indicators.

[0117] When the system detects an abnormal business indicator, it first obtains a set of candidate abnormal service nodes that have a causal path with the abnormal business indicator node. A causal path refers to a path in the causal graph that starts from a service node, passes through a series of directed edges, and finally reaches the target business indicator node. By analyzing the causal path of the abnormal business indicator node, the search scope of the root cause of the abnormality can be quickly narrowed down, focusing on those upstream service nodes that may cause the abnormal business indicator.

[0118] For each node in the set of candidate abnormal service nodes, counterfactual reasoning is performed using the trained structural causal model. Specifically, assuming that the current candidate abnormal service node is in a normal state, while the states of other nodes remain unchanged, based on this premise, the structural causal model is used to estimate the counterfactual value of the business indicator node, that is, the expected value of the business indicator node when the current service node is normal. This counterfactual value is compared with the actual abnormal value of the business indicator node, and the difference between the two is the causal effect of the current candidate abnormal service node on the abnormal business indicator. Intuitively speaking, if the abnormal state of a service node is corrected to normal, the greater the degree to which the business indicator returns to normal, the more likely the service node is to be the root cause of the abnormality.

[0119] By evaluating and comparing the causal effects of all candidate abnormal service nodes, we can obtain a priority list of abnormal root cause services in descending order of causal effect size. This list quantifies the impact of different service nodes on business indicator abnormalities from the perspective of causal reasoning, and the service nodes with the greatest possibility of abnormal root causes are ranked first. Based on this priority list, operation and maintenance personnel can locate abnormalities and diagnose problems in a targeted manner, quickly find the root cause of the abnormality, solve the problem at the source, and ensure business continuity and stability.

[0120] In this embodiment, a heterogeneous graph is used to comprehensively describe various dependencies such as service calls and resource deployment, providing key dependency topological structure information for abnormal root cause analysis. The heterogeneous graph convolutional network automatically mines the semantic information of service nodes in the topological structure, and learns the vector representation of service nodes end-to-end without artificial feature engineering. The domain knowledge is used to determine the potential causal relationship between nodes, and the precise causal strength between nodes is learned adaptively based on data. The structural causal model can use multiple indicators and dependency information for causal reasoning at the same time, which improves the comprehensiveness and interpretability of root cause analysis. Through counterfactual reasoning, the real contribution of each node to the abnormality is quantified, which effectively overcomes the limitations of single factor analysis and correlation analysis, and integrates the advantages of domain knowledge and data-driven. Based on heterogeneous graph neural networks and structural causal models, the complex dependencies of service systems can be fully modeled, and the real root causes of abnormalities can be effectively located through counterfactual analysis, which can greatly improve the accuracy and interpretability of abnormal diagnosis.

[0121] S103. Based on the historical processing data of the root cause service, a service recovery strategy is automatically generated. According to the service recovery strategy, by calling the container orchestration interface, dynamic adjustments are performed on the relevant service instances of the back-end service system, and the recovery monitoring data of the service instances are obtained in real time. The service recovery strategy is adaptively optimized based on the recovery monitoring data, and service adjustments are continuously performed according to the optimized recovery strategy until the back-end service system is fully recovered.

[0122] After the root cause service is determined, the system will enter the self-healing phase. The system will automatically retrieve historical processing data related to the root cause service, mine solutions to similar failures in the past, and generate a service recovery strategy. The strategy includes a set of service degradation and resource scheduling actions, such as reducing the priority of non-core services, expanding the capacity of bottleneck services, and adjusting the load balancing between services. These actions dynamically adjust the relevant service instances in the backend service system by calling the API interface of the container orchestration platform (such as Kubernetes).

[0123] Optionally, in order to evaluate the recovery effect, the recovery monitoring data of the service instance can be obtained in real time, including the changing trends of various performance indicators. Based on these feedback data, a reinforcement learning model is constructed to adaptively optimize the initial service recovery strategy through continuous trial and error and strategy iteration. The model represents the state of the system as a vector, regards the recovery action as the decision of the agent, and designs a reward function to judge the effect of the action, such as the degree of recovery of abnormal indicators, the utilization efficiency of resources, etc. By maximizing the long-term cumulative reward, the reinforcement learning model can learn an optimal recovery strategy. According to the optimized strategy, service adjustments are continuously performed, and the recovery of the system is monitored in real time to form a closed-loop feedback mechanism until the system is fully restored to normal.

[0124] In an optional embodiment,

[0125] Based on the historical processing data of the root cause service, a service recovery strategy is automatically generated. According to the service recovery strategy, by calling the container orchestration interface, a dynamic adjustment is performed on the relevant service instances of the backend service system, including:

[0126] Acquire the historical abnormality diagnosis and disposal data accumulated in the service root cause location phase, perform denoising, normalization and dimension reduction processing on the historical abnormality diagnosis and disposal data, and obtain the pre-processed historical abnormality diagnosis and disposal data;

[0127] Based on the pre-processed historical abnormal diagnosis and disposal data, the key features reflecting the fault mode, the measurement features related to the recovery effect, and the high-order combination features between the fault features are extracted to construct a fault recovery sample set containing multi-dimensional features.

[0128] Using the fault recovery sample set as training data, training a pre-built service recovery strategy generation model, learning the mapping relationship between fault features and recovery action sequences, calculating the probability distribution of the recovery action sequence through the service recovery strategy generation model, and using the maximum likelihood estimation method to learn the optimal parameters of the model, to obtain a trained service recovery strategy generation model;

[0129] When a new fault feature is received, the new fault feature is input into the trained service recovery strategy generation model, and the recovery action sequence with the highest conditional probability is inferred through the Viterbi decoding algorithm, and the recovery action sequence with the highest conditional probability is used as the service recovery strategy;

[0130] The service recovery strategy is passed to the container orchestration platform, resource configuration updates are performed on the working nodes where the service is running through the API interface of the container orchestration platform, and a rolling update mechanism is used to dynamically adjust the service instances of the backend service system.

[0131] Exemplarily, the historical abnormal diagnosis and disposal data accumulated in the service root cause location phase are first obtained, and then these data are preprocessed, including denoising, normalization, and dimensionality reduction. Denoising refers to removing dirty data and outliers in the data to improve data quality; normalization refers to normalizing continuous indicators to eliminate dimensional effects; dimensionality reduction refers to feature selection and dimensionality reduction of high-dimensional features to reduce computational overhead. After preprocessing, historical abnormal diagnosis and disposal data with high quality and moderate dimensionality are obtained.

[0132] Based on preprocessing, this method extracts three types of features from historical data: key features reflecting fault modes, metric features related to recovery effects, and high-order combined features between fault features. Key features characterize the modes and symptoms of faults and are an important basis for recovery decisions; metric features measure the effects of recovery, such as recovery time and recovery integrity, and can be used to optimize recovery strategies; high-order combined features consider the interactive effects between fault features, explore the intrinsic correlation of features, and improve the representation ability of faults. The extracted multi-dimensional features constitute a fault recovery sample set, each of which consists of a fault feature and a corresponding recovery action sequence.

[0133] The fault recovery sample set is used as training data to train the service recovery strategy generation model. The model learns the mapping relationship between fault features and recovery action sequences, that is, given the fault features, it predicts the appropriate recovery action sequence. Considering the correlation between recovery actions, the conditional random field is used as the service recovery strategy generation model to characterize the joint probability distribution of the recovery action sequence. During the model training process, the optimal parameters of the conditional random field are learned through methods such as maximum likelihood estimation to obtain a trained service recovery strategy generation model.

[0134] In the use phase, when a new fault feature is received, it is input into the trained service recovery strategy generation model. The model infers the recovery action sequence with the maximum conditional probability through the Viterbi decoding algorithm, and uses this sequence as the service recovery strategy for the fault feature. Since the Viterbi algorithm searches for all possible recovery action sequences, the generated recovery strategy is the global optimal one.

[0135] Finally, the generated service recovery strategy is passed to the container orchestration platform, such as Kubernetes. Through the API interface provided by the container orchestration platform, resource configuration updates are performed on the working nodes where the service is running, and a rolling update mechanism is used to dynamically adjust the service instances of the backend service system, such as scaling, restarting, and parameter modification. In this way, the service recovery strategy is automatically executed, realizing a closed loop of service recovery.

[0136] In an optional embodiment,

[0137] The calculation formula for calculating the probability distribution of the recovery action sequence through the service recovery strategy generation model is as follows:

[0138] ;

[0139] Where y represents the recovery action sequence, μ(x) represents the fault feature sequence, P(·) represents the probability distribution, Z(·) represents the normalization factor, K represents the length of the recovery action sequence, and θ k represents the weight of the transfer feature function, T represents transposition, f k (·) represents the transfer characteristic function, y k represents the kth recovery action in the recovery action sequence, J represents the number of feature functions, and λ j represents the weight of the state characteristic function, g j (·) represents the state characteristic function, y k+1 Represents the k+1th recovery action in the recovery action sequence.

[0140] In this embodiment, by automatically extracting fault mode and recovery strategy mapping knowledge from historical data, there is no need to manually summarize and hard-code complex recovery rules. Comprehensively consider the fault mode, recovery effect and feature combination to more comprehensively describe the fault diagnosis and recovery requirements, autonomously infer the best recovery action sequence based on the input features, and dynamically generate recovery strategies that adapt to various fault scenarios. From model training to strategy generation, and then to execution recovery, the entire process is automated, reducing manual participation, improving the timeliness and efficiency of recovery, and through integration with the container orchestration platform, reusing existing infrastructure, reducing system transformation costs, and achieving a smooth transition. An automated fault recovery framework based on machine learning is provided. By mining the experience accumulated from historical data, it can intelligently generate and automatically execute recovery strategies for different scenarios, significantly improving the timeliness, effectiveness and sustainability of fault handling, and providing strong support for improving the maintainability and reliability of the service system.

[0141] Figure 2 The schematic diagram of the structure of the back-end service automation design system according to the embodiment of the present invention is as follows: Figure 2 As shown, the system comprises:

[0142] The first unit is used to obtain real-time monitoring data of the backend service system, wherein the real-time monitoring data includes service call link information, service operation indicators and business key performance indicators, and based on the real-time monitoring data, use a pre-trained multi-dimensional service anomaly detection model to determine whether there is an anomaly in the backend service system, and trigger an anomaly location process when an anomaly is detected;

[0143] The second unit is used to build a service dependency topology map based on the service call link information, and use a graph neural network to encode the service dependency topology map to generate a low-dimensional vector representation of the service dependency relationship, input the service operation indicators and business key performance indicators into a pre-built joint reasoning model, and locate the root cause service of the abnormality in combination with the low-dimensional vector representation of the service dependency relationship;

[0144] The third unit is used to automatically generate a service recovery strategy based on the historical processing data of the root cause service, and according to the service recovery strategy, dynamically adjust the relevant service instances of the back-end service system by calling the container orchestration interface, and obtain the recovery monitoring data of the service instances in real time, adaptively optimize the service recovery strategy based on the recovery monitoring data, and continuously execute service adjustments according to the optimized recovery strategy until the back-end service system is fully recovered.

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

[0146] An electronic device is provided, comprising:

[0147] processor;

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

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

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

[0151] 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.

[0152] 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.

[0153] 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 backend service automation design method, characterized in that: include: Acquire real-time monitoring data of the backend service system, the real-time monitoring data including service call link information, service operation indicators and business key performance indicators, and based on the real-time monitoring data, use a pre-trained multi-dimensional service anomaly detection model to determine whether there is an anomaly in the backend service system, and trigger an anomaly location process when an anomaly is detected; Build a service dependency topology graph based on the service call link information, and use a graph neural network to encode the service dependency topology graph to generate a low-dimensional vector representation of the service dependency relationship. Input the service operation indicators and business key performance indicators into the pre-built joint reasoning model, and locate the root cause service of the abnormality in combination with the low-dimensional vector representation of the service dependency relationship. Based on the historical processing data of the root cause service, a service recovery strategy is automatically generated. According to the service recovery strategy, by calling the container orchestration interface, dynamic adjustments are performed on the relevant service instances of the back-end service system, and the recovery monitoring data of the service instances are obtained in real time. The service recovery strategy is adaptively optimized based on the recovery monitoring data, and service adjustments are continuously performed according to the optimized service recovery strategy until the back-end service system is fully recovered.

2. The method according to claim 1, characterized in that Based on the real-time monitoring data, a pre-trained multi-dimensional service anomaly detection model is used to determine whether there is an anomaly in the backend service system, and when an anomaly is detected, the anomaly location process is triggered, including: The acquired real-time monitoring data is preprocessed and the sampling frequencies of different indicators are aligned according to the timestamps. The sliding window method is used to extract features from the preprocessed real-time monitoring data. The statistical features of each indicator in the window are extracted with a fixed time window as the unit, and the key feature subset is screened through the feature selection algorithm. A twin neural network consisting of two sub-networks with the same structure is constructed as a multi-dimensional service anomaly detection model. Each sub-network consists of a multi-layer one-dimensional convolutional neural network and a long short-term memory network. The two sub-networks share parameters, and a similarity measurement module is introduced after the two sub-networks. The key feature subset of the service status to be tested in the real-time monitoring data is input into the pre-trained multi-dimensional service anomaly detection model to obtain the feature vector of the service status to be tested, and multiple normal service status samples are randomly selected from the support set. The distance between the service status to be tested and each normal service status sample in the feature space is calculated, and the average value is taken as the anomaly score. According to the comparison result between the set anomaly threshold and the obtained anomaly score, it is determined whether there is an anomaly in the backend service system. When it is determined that there is an anomaly in the backend service system, the anomaly location process is triggered.

3. The method according to claim 2, characterized in that The steps before inputting the key feature subset of the service status to be tested in the real-time monitoring data into the pre-trained multi-dimensional service anomaly detection model to obtain the feature vector of the service status to be tested also include: Randomly sample a batch of normal service status samples from historical monitoring data as a support set, and construct positive sample pairs and negative sample pairs according to the support set, wherein the positive sample pair consists of two normal service status samples randomly selected from the support set, and the negative sample pair consists of a normal service status sample randomly selected from the support set and a service status sample randomly selected from the historical monitoring data; Inputting the constructed positive sample pairs and negative sample pairs into the twin neural network, and obtaining feature mapping vectors of the positive sample pairs and negative sample pairs in the feature space through the twin neural network; An adaptive threshold and hard negative sample mining mechanism are introduced. The contrastive learning loss function is constructed by minimizing the distance between the feature mapping vectors of the positive sample pairs and maximizing the distance between the feature mapping vectors of the negative sample pairs until the distance between the feature mapping vectors of the negative sample pairs is greater than the adaptive threshold. Based on the contrastive learning loss function, the gradient descent method is used to train the parameters of the twin neural network, and finally a trained multi-dimensional service anomaly detection model is obtained.

4. The method according to claim 3, characterized in that Adaptive threshold and hard negative sample mining mechanism are introduced to construct contrastive learning loss function by minimizing the distance between feature mapping vectors of positive sample pairs and maximizing the distance between feature mapping vectors of negative sample pairs until the distance between feature mapping vectors of negative sample pairs is greater than the adaptive threshold. An adaptive threshold function is introduced to dynamically adjust the threshold according to the similarity of positive and negative sample pairs. The formula of the adaptive threshold function is as follows: Where τ(·) represents the adaptive threshold function, represents the cosine similarity of the i-th positive sample pair, represents the cosine similarity of the i-th negative sample pair, η represents the hyperparameter, α represents the constant that controls the upper limit of the threshold, and β represents the constant that controls the lower limit of the threshold; The hard negative sample mining mechanism includes: for each positive sample, find the C target negative samples with the closest distance in the feature space, and calculate the weighted average of the similarity between each target negative sample and the positive sample to obtain the corresponding hard negative sample. The hard negative sample calculation formula is as follows: in, represents the hard negative sample corresponding to the i-th positive sample, C represents the number of negative samples closest to the feature space, represents the cosine similarity between the cth closest negative sample and the positive sample in the i-th positive sample pair, and X represents the temperature hyperparameter; Adaptive threshold and hard negative sample mining mechanism are introduced to construct the contrastive learning loss function by minimizing the distance between the feature mapping vectors of the positive sample pairs and maximizing the distance between the feature mapping vectors of the negative sample pairs until the distance between the feature mapping vectors of the negative sample pairs is greater than the adaptive threshold. Among them, L represents the contrastive learning loss function and N represents the number of training sample pairs.

5. The method according to claim 1, characterized in that A service dependency topology graph is constructed based on the service call link information, and the graph neural network is used to encode the service dependency topology graph to generate a low-dimensional vector representation of the service dependency relationship. The service operation indicators and business key performance indicators are input into the pre-built joint reasoning model, and combined with the low-dimensional vector representation of the service dependency relationship, the root cause of the abnormality is located. Services include: Construct a service dependency topology graph based on the service call link information, wherein the service dependency topology graph includes service nodes and underlying resource nodes, as well as call relationship edges between service nodes and deployment association edges between service nodes and underlying resource nodes, wherein the underlying resource nodes include hosts, containers, and middleware to which the service belongs; A heterogeneous graph convolutional network is used to encode the service dependency topology graph. The heterogeneous graph convolutional network aggregates the semantic information of neighbor nodes of different node types by introducing an attention mechanism to obtain a low-dimensional vector representation of the service node. Constructing a causal graph based on expert knowledge and data-driven methods, wherein the causal graph is a directed acyclic graph including service nodes and business indicator nodes in a service dependency topology graph, wherein directed edges represent causal dependencies between nodes; A structural causal model is constructed for each node in the causal graph as a joint reasoning model. The low-dimensional vector representation of the service node, the operating indicators of the service node, and the business indicators are input into the structural causal model. The structural causal model is trained by minimizing the mean square error loss function between the predicted values ​​and the true values ​​of all nodes. When an abnormal business indicator node is detected, a set of candidate abnormal service nodes that have a causal path with the abnormal business indicator node is obtained, and counterfactual reasoning is performed on each service node in the candidate abnormal service node set. The counterfactual reasoning is performed by setting the service node to a normal state and using the trained structural causal model to estimate the counterfactual value of the abnormal business indicator node, so as to obtain the causal effect of the current candidate abnormal service node on the abnormality, and arrange the candidate abnormal service nodes in descending order based on the size of their causal effects to obtain a priority list of abnormal root cause services, and locate the abnormal root cause service according to the priority list.

6. The method according to claim 1, characterized in that Based on the historical processing data of the root cause service, a service recovery strategy is automatically generated. According to the service recovery strategy, by calling the container orchestration interface, a dynamic adjustment is performed on the relevant service instances of the backend service system, including: Acquire the historical abnormality diagnosis and disposal data accumulated in the service root cause location phase, perform denoising, normalization and dimension reduction processing on the historical abnormality diagnosis and disposal data, and obtain the pre-processed historical abnormality diagnosis and disposal data; Based on the pre-processed historical abnormal diagnosis and disposal data, the key features reflecting the fault mode, the measurement features related to the recovery effect, and the high-order combination features between the fault features are extracted to construct a fault recovery sample set containing multi-dimensional features. Using the fault recovery sample set as training data, training a pre-built service recovery strategy generation model, learning the mapping relationship between fault features and recovery action sequences, calculating the probability distribution of the recovery action sequence through the service recovery strategy generation model, and using the maximum likelihood estimation method to learn the optimal parameters of the model, to obtain a trained service recovery strategy generation model; When a new fault feature is received, the new fault feature is input into the trained service recovery strategy generation model, and the recovery action sequence with the highest conditional probability is inferred through the Viterbi decoding algorithm, and the recovery action sequence with the highest conditional probability is used as the service recovery strategy; The service recovery strategy is passed to the container orchestration platform, resource configuration updates are performed on the working nodes where the service is running through the API interface of the container orchestration platform, and a rolling update mechanism is used to dynamically adjust the service instances of the backend service system.

7. The method according to claim 6, characterized in that The calculation formula for calculating the probability distribution of the recovery action sequence through the service recovery strategy generation model is as follows: Where y represents the recovery action sequence, μ(x) represents the fault feature sequence, P(·) represents the probability distribution, Z(·) represents the normalization factor, K represents the length of the recovery action sequence, and θ k represents the weight of the transfer feature function, T represents transposition, and f k (·) represents the transfer characteristic function, y k represents the kth recovery action in the recovery action sequence, J represents the number of feature functions, and λ j represents the weight of the state characteristic function, g j (·) represents the state characteristic function, y k+1 Represents the k+1th recovery action in the recovery action sequence.

8. A backend service automation design system, used to implement the method according to any one of claims 1 to 7, characterized in that: include: The first unit is used to obtain real-time monitoring data of the backend service system, wherein the real-time monitoring data includes service call link information, service operation indicators and business key performance indicators, and based on the real-time monitoring data, use a pre-trained multi-dimensional service anomaly detection model to determine whether there is an anomaly in the backend service system, and trigger an anomaly location process when an anomaly is detected; The second unit is used to build a service dependency topology map based on the service call link information, and use a graph neural network to encode the service dependency topology map to generate a low-dimensional vector representation of the service dependency relationship, input the service operation indicators and business key performance indicators into a pre-built joint reasoning model, and locate the root cause service of the abnormality in combination with the low-dimensional vector representation of the service dependency relationship; The third unit is used to automatically generate a service recovery strategy based on the historical processing data of the root cause service, and according to the service recovery strategy, dynamically adjust the relevant service instances of the back-end service system by calling the container orchestration interface, and obtain the recovery monitoring data of the service instances in real time, adaptively optimize the service recovery strategy based on the recovery monitoring data, and continuously execute service adjustments according to the optimized recovery strategy until the back-end service system is fully recovered.

9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in any one of claims 1 to 7.

10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • An anomaly detection method for micro-service software system based on call graph analysis

    CN109213616A

  • Micro-service system fault root cause positioning method based on fault feature comparison

    CN113190373A