Online service recommendation method in micro-service system based on knowledge graph

By building a microservice knowledge graph and improving gLSTM sequence modeling, combined with the attention context embedding module, the dependency management problem in complex microservice environments is solved, and accurate online service recommendations and adaptive decision-making are achieved.

CN120763403APending Publication Date: 2025-10-10PLA DALIAN NAVAL ACADEMY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510945727.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

Traditional methods find it difficult to effectively manage and coordinate dependencies and combination patterns in complex microservice environments, and are unable to flexibly adapt to business needs and scenario changes, making decision-making more difficult.

Method used

Build a microservice knowledge graph, obtain the microservice anchor combination path through the path generation strategy, combine the improved gLSTM sequence modeling and attention context embedding module, and build a combination path network model for microservice prediction and recommendation.

Benefits of technology

It truly reflects the dependencies between microservices, accurately generates service combination paths, strengthens sequence modeling and context awareness, adaptively optimizes models, realizes real-time online recommendations, reduces the burden of manual intervention, and improves system scheduling efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120763403A_ABST
    Figure CN120763403A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge graph-based online service recommendation method in a micro-service system. The method comprises the following steps: constructing a micro-service knowledge graph according to historical dependency records of micro-services in a workflow storage library; obtaining a micro-service anchor point combination path set according to the micro-service knowledge graph based on a path generation strategy; constructing a combined path network model for micro-service prediction, and performing model training by using the micro-service anchor point combined path set to obtain an optimized combined path network model; and obtaining the micro-service prediction probability that each candidate micro-service is used as an original workflow to execute the next service by optimizing the combined path network model, carrying out descending sorting on the micro-service prediction probabilities, and selecting the micro-service with the top k in the sorting result as the online recommended target micro-service. The problems that an existing micro-service recommendation method lacks the capacity of mining information in a micro-service dependency graph, and a traditional auxiliary decision support system is often difficult to deal with complexity and variability of micro-services and cannot flexibly adapt to new business requirements and scenes are solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of micro-service recommendation, and in particular to an online service recommendation method in a micro-service system based on a knowledge graph, which is especially suitable for realizing real-time online prediction and recommendation of next services by analyzing the dependency relationship and combination mode among micro-services in a complex system environment. BACKGROUND

[0002] With the increasing complexity of the micro-service environment and the diversification of micro-service recommendation methods, more and more tasks and processes need to be effectively managed and coordinated in the recommendation task, which greatly increases the difficulty of user decision-making. The micro-service system in the micro-service environment can be set as a graph structure with complex structure and rich structure information through the micro-service dependency graph. However, the traditional method of processing graph data, such as random walk, will convert the graph structure into a sequence form, destroying the complex network topology structure of branching, concurrency, and cycle in the micro-service workflow, and lacking the ability to mine information in the micro-service dependency graph. In addition, the traditional decision support system is often difficult to cope with such complexity and variability, and cannot flexibly adapt to new business requirements and scenarios. Therefore, there is an urgent need to provide an online service recommendation method in a micro-service system based on a knowledge graph. SUMMARY

[0003] The present application discloses an online service recommendation method in a micro-service system based on a knowledge graph to overcome the above technical problems.

[0004] To achieve the above purpose, the technical scheme of the present application is:

[0005] An online service recommendation method in a micro-service system based on a knowledge graph, comprising the steps of:

[0006] S1: constructing a micro-service knowledge graph according to the historical dependency records of micro-services in the workflow repository;

[0007] S2: constructing a path generation strategy and obtaining a set of micro-service anchor point combination paths satisfying the non-cyclic constraint from the micro-service knowledge graph based on the path generation strategy;

[0008] S3: constructing a combination path network model for micro-service prediction, and training the combination path network model using the set of micro-service anchor point combination paths to obtain an optimized combination path network model;

[0009] S4: For the original workflow being constructed, a set of microservice anchor combination paths is extracted one by one from the set of microservice anchor combination paths obtained in S2, and the microservice anchor combination paths are input into the optimized combination path network model described in S3. The microservice context vector is obtained through the optimized combination path network model to obtain the predicted probability of each candidate microservice as the microservice to execute the next service of the original workflow. The predicted probabilities of the microservices are sorted in descending order, and the top k microservices in the sorting results are selected as the target microservices for online recommendation.

[0010] Furthermore, the method for constructing the microservice knowledge graph in S1 specifically includes the following steps:

[0011] S11: historical dependency records of microservices in the workflow repository;

[0012] S12: Define the microservices with historical dependency records as microservice entity nodes, and construct a microservice entity node directed graph G=(N,e ij ,φ); where N={m1,m2,…,m n Represents a collection of microservice nodes, Represents the set of dependency edges between microservices, φ represents the edge weight function, and the expression of the edge weight function is:

[0013]

[0014] Where: f(m i ,m j ) represents microservice m i Call microservice m j The frequency of; F represents the normalization factor;

[0015] S13: Obtain all edge weight sets and microservice entity node sets according to the microservice entity node directed graph to form the microservice knowledge graph

[0016] Furthermore, the path generation strategy constructed in S2 includes intra-workflow generation rules and inter-workflow generation rules;

[0017] S21: The specific rules generated in the constructed workflow are:

[0018] Define the starting microservice entity node m s and terminate microservice entity node m t , and based on the path generation probability, in the microservice knowledge graph In the example, path p is generated according to the edge weight function value and p=(m s ,m s+1 ,…,m t), to obtain the microservice anchor point combination path of the workflow;

[0019] The expression of the path generation probability P(p) is

[0020]

[0021] In the formula: denotes all neighbor nodes of the microservice entity node m k . denotes the edge weight between the microservice entity node m k and the microservice entity node m k+1 . denotes the edge weight between the microservice entity node m k and the neighbor node m ' .

[0022] The generated inter-workflow rule S22 is specifically:

[0023] The root node m r of the microservice entity node is defined, and the root node m r is taken as the starting microservice entity node. Based on the softmax probability function, the root node m r is obtained from the microservice knowledge graph , and the path generation probability of the next microservice node is generated based on the neighbor node set of the root node m r , to obtain the microservice anchor point combination path of the workflow.

[0024] The expression of the path generation probability P(m j |m r ) is

[0025]

[0026] In the formula: β denotes a smoothing parameter; denotes the edge weight between the microservice entity node m r and the microservice entity node m j . denotes the edge weight between the microservice entity node m r and the neighbor node m k .

[0027] Further, the combination path network model for microservice prediction S3 is constructed, including the constructed sequentially connected input module, improved gLSTM sequence modeling module, attention-based context embedding module, and context-aware service prediction module for next step microservice prediction.

[0028] The input module is configured to obtain vector representations of each microservice in the microservice anchor point combination path p=(m1, m2, …, m L ) according to the microservice anchor point combination path set, so as to constitute an embedding vector matrix V d ; P ;

[0029] The embedding vector matrix V P is expressed as

[0030] V P = [v(m1), v(m2), …, v(m L )

[0031] In the formula, v(m L ) represents a vector representation of an Lth microservice in the microservice anchor point combination path p.

[0032] The input module is further configured to convert the target workflow requirement text into a target vector u target ∈R d by using a Doc2Vec model.

[0033] The improved gLSTM sequence modeling module is configured to mine dependency relationships in the microservices to obtain microservice semantic features according to the embedding vector matrix V P based on the target vector u target .

[0034] The expression of the improved gLSTM sequence modeling module is

[0035] f t = σ(W f v(m t )+U f h t-1 +Q f u target +b f )

[0036] i t = σ(W i v(m t )+U i h t-1 +Q i u target +b i )

[0037] o t = σ(W o v(m t )+U o h t-1 +Q o u target +b o)

[0038] g t = tanh(W g v(m t ) + U g h t-1 + Q g u target + b g )

[0039] c t = f t ⊙c t-1 + i t ⊙g t

[0040] h t = o t ⊙tanh(c t )

[0041] wherein W f , W i , W o , W g , U f , U i , U o , U g , Q f , Q i , Q o , Q g denote the weight parameter matrices of the improved gLSTM sequence modeling module; b f , b i , b o , b g denote the bias vectors; σ(·) denotes the sigmoid function; ⊙ denotes element-wise multiplication; t denotes the time step; h t denotes the hidden state function reflecting the current semantic information of the workflow sequence at the time step t to obtain the microservice semantic feature; c t denotes the cell state used to store and deliver the long-term dependency information of the microservice; f t denotes the forget gate activation vector; i t denotes the input gate activation vector; o t denotes the output gate activation vector; g t denotes the candidate update vector;

[0042] The attention-based context embedding module is used to obtain the attention weight α t of different microservices at each time step t according to the microservice semantic feature;

[0043] and the attention weight α tA microservice scenario vector is acquired, which integrates dynamic semantic features of each microservice in the microservice anchor point combination path.

[0044] The attention weight α t The acquisition formula is

[0045]

[0046] In the formula, r is in R d , which represents a trainable attention weight parameter vector. , which represents the transpose of h t ; r represents a trainable weight vector with the same dimension as h t . , which represents the inner product score of all time steps in the microservice anchor point combination path sequence, and is normalized, so that the attention weight α t of each time step becomes a part of the summation of the probability value.

[0047] The acquisition formula of the microservice scenario vector c path is

[0048]

[0049] The scenario-aware service prediction module is used to map the microservice scenario vector to the preset candidate microservice space by using a full connection layer, to acquire original scores of each candidate microservice.

[0050] The original scores are converted into microservice prediction probabilities by using a softmax probability function.

[0051] The recommendation set composed of the top k microservices in the candidate microservice set in descending order of the prediction probability is selected as the target microservice of online recommendation.

[0052] The expression of the scenario-aware service prediction module is

[0053] S(m', c path ) = W p c path +b p

[0054]

[0055] In the formula, S(m', c path ) represents the original score of the microservice node m ' ; S(m, c path ) represents the original score of the candidate microservice; m represents the index of the candidate microservice in the set N; and c pathThe microservice context vector output by the attention-based context embedding module represents the global semantic information of the entire service anchor point combination path. p represents the weight matrix of the fully connected layer and has a dimension of |N|xd; |N| represents the size of the candidate microservice set; d represents the dimension of the microservice context vector c path ; exp(S(m', c path )) represents the sum of the exponential scores of all candidate microservices, ensuring that the probability sum of the entire output is 1; b p represents the bias vector of the fully connected layer and has a dimension of |N|; exp(S(m, c path )) represents the exponential operation on the original score of the candidate microservice m; P(m|c path ) represents the probability that the candidate microservice m is predicted as the next step service under the condition of the given microservice context vector c path .

[0056] Further, the S3 utilizes the microservice anchor point combination path set to train the combination path network model to obtain an optimized combination path network model, specifically including:

[0057] S31: Randomly divide the microservice anchor point combination path set into a training set and a test set;

[0058] S32: Train the combination path network model according to the training set to obtain a trained combination path network model;

[0059] S33: Based on the cross-entropy loss function, verify the trained combination path network model according to the test set to determine whether the trained combination path network model converges or reaches the maximum number of iterations;

[0060] If yes, the trained combination path network model is used as the optimized combination path network model;

[0061] Otherwise, the weight parameters of the trained combination path network model are adaptively adjusted based on the back propagation method, and step S32 is repeatedly executed.

[0062] Further, the S4 specifically includes the following steps:

[0063] S41: For the original workflow being constructed, a group of microservice anchor point combination paths p is extracted from the microservice anchor point combination path set obtained in S2;

[0064] S42: Input the microservice anchor combination path p into the optimized combination path network model trained in S3, and calculate and obtain the microservice scenario vector c of the combination path through the input module, the improved gLSTM sequence modeling module, the attention-based context embedding module, and the context-aware service prediction module for the next microservice prediction. path ;

[0065] S43: According to the microservice scenario vector c path , calculate and obtain the recommended microservice set consisting of the top k microservices with the highest predicted probability in the microservice candidate set, and use them as the target microservices for online recommendation;

[0066] The online recommendation formula for the target microservice is:

[0067]

[0068] Where: represents the final set of recommended microservices; argtop represents the sorting interception function that obtains the top k microservices themselves to form the set through the scores of the microservice scenario vectors.

[0069] Beneficial effects: The present invention provides an online service recommendation method in a microservice system based on a knowledge graph, which has the following beneficial effects and advantages:

[0070] (1) Truly reflect the dependency relationship of microservices: By constructing a microservice knowledge graph, the actual calls and dependencies between microservices are fully captured, and the edge weight function is used to quantify the dependency strength between microservices, thereby overcoming the shortcomings of traditional methods that only rely on simple call records or functional similarity, making the constructed dependency graph more in line with the needs of actual orchestration scenarios.

[0071] (2) Accurate service composition path generation: By constructing a path generation strategy, two composition path generation rules, intra-workflow and inter-workflow, are adopted. Normalized edge weights and softmax sampling mechanisms are used to generate microservice anchor composition paths. This can not only extract local service composition patterns, but also capture global composition characteristics across workflows, providing rich and diverse training samples for subsequent predictions.

[0072] (3) Strengthening sequence modeling and context awareness: By introducing an improved gLSTM model and an attention-based context embedding module, the target workflow requirement information is organically combined with the microservice call sequence, which not only retains the short-term dynamic context but also accumulates the long-term dependency information, thereby achieving in-depth mining of the combined path context and significantly improving the accuracy of the next service prediction.

[0073] (4) End-to-end model adaptive optimization: using full connection mapping and softmax normalization technology, the micro-service context vector is converted into the prediction probability of the candidate micro-service, and the loss function is optimized through the back propagation algorithm to ensure that the combined path network model adaptively adjusts the weight and stably converges during the training process, thereby obtaining the optimal recommendation effect.

[0074] (5) Real-time online recommendation and automatic decision: based on the micro-service knowledge graph and the overall system of the combined path network model, the workflow state being constructed can be analyzed in real time, and the candidate micro-service can be predicted and sorted automatically, so as to realize efficient and automatic online service recommendation, significantly reduce the burden of manual intervention, and improve the efficiency and flexibility of system scheduling. BRIEF DESCRIPTION OF DRAWINGS

[0075] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings described below are some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0076] Figure 1 The flowchart of the online service recommendation method in the micro-service system based on the knowledge graph of the present application;

[0077] Figure 2 The comparison chart of the experimental results of the Hit@5 of the five models in the present embodiment;

[0078] Figure 3 The comparison chart of the experimental results of the Hit@10 of the five models in the present embodiment;

[0079] Figure 4 The comparison chart of the experimental results of the average response time of the five models in the high-concurrency scenario in the present embodiment. DETAILED DESCRIPTION

[0080] In order to make the purpose, technical scheme and advantages of the embodiments of the present application more clear, the technical scheme of the embodiments of the present application will be described clearly and completely below in combination with the drawings of the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0081] The present embodiment introduces an online service recommendation method in a micro-service system based on a knowledge graph, as shown in Figure 1 The method comprises the following steps:

[0082] S1: Constructing the microservice knowledge graph according to the historical dependency records of microservices in the workflow repository, specifically including the following steps:

[0083] S11: Calling the historical microservice dependency records in the workflow repository;

[0084] In this example, to construct a knowledge graph that truly reflects the microservice invocation relationship, the "CloudMicroservice-D" dataset is selected, which is publicly available by the Chinese Academy of Sciences Software Institute in cooperation with a cloud service platform, and collects about 1500 workflows and their corresponding microservice invocation records from actual enterprise environments. First, by calling the RESTful API interface provided by the dataset, this embodiment automatically obtains all historical microservice dependency records. In the specific operation, the system initiates a request to the API at regular intervals to download the dependency data for the past year, and each record contains the calling microservice identifier, the called microservice identifier, the invocation timestamp, and the number of invocations, and other key information. For example, during a data download process, the system receives a JSON-formatted record, which shows that the service identifier "ms_auth" is the calling party and has performed several invocations on the service identifier "ms_user", along with the time information of the invocations. This process ensures the completeness and real-time nature of data collection, providing a solid raw foundation for subsequent data cleaning and knowledge graph construction.

[0085] S12: Defining the microservices in the historical dependency records as microservice entity nodes, and constructing a directed graph G=(N, e, φ) of microservice entity nodes based on their dependency relationships; where N={m1, m2, …, m ij} represents the set of microservice nodes, n e represents the set of dependency edges between microservices, and φ represents the edge weight function, and the expression of the edge weight function is:

[0086]

[0087] In the formula: f(m i ,m j ) represents the frequency of microservice m i invoking microservice m j ; F represents a normalization factor;

[0088] ​In this example, after obtaining the original dependency data, in order to ensure the accuracy of subsequent graph construction, the data must also be strictly pre-processed and standardized. In this embodiment, first, all microservice identifiers are uniformly processed, converted to lowercase, and redundant spaces and special symbols are removed to ensure that the same microservice has consistent names in different records. Subsequently, the original data is cleaned, and records with missing key fields (such as empty calling parties or called parties) are removed, and duplicate records are merged. The number of calls between the same pair of microservices in different workflows is accumulated to form a complete and accurate dependency statistics table. During the preprocessing process, the call scenario information (such as workflow number or business scenario label) attached to each record is also extracted, which plays an important role in labeling the edges in the subsequent construction. After data cleaning, the system generates a structured data file that stores all standardized dependency records in a predetermined format, laying a solid foundation for knowledge graph construction.

[0089] S13: Obtaining all edge weight sets and microservice entity node sets from the above-mentioned microservice entity node directed graph to form the microservice knowledge graph

[0090] In this example, after completing data preprocessing, the next step is to construct a microservice knowledge graph using the cleaned dependency records. In the specific implementation process, the system first considers each unique microservice (processed after S12) in the data file as a microservice node in the graph, forming a microservice node set. Subsequently, according to each microservice dependency record, the system constructs a directed edge in the graph based on the calling party and the called party information. During construction, not only the existence of the edge is recorded, but also the call frequency information obtained in the preprocessing stage is used to assign a weight to each edge. The edge weight calculation uses normalization processing to ensure that the weight values of each edge are within a reasonable range, thereby truly reflecting the dependency strength between microservices. In addition, when constructing the edge, the system saves the call scenario or workflow number extracted from each record as an additional label of the edge to facilitate the differentiation of calling relationships under different business scenarios in the subsequent path generation process. Finally, by traversing all pre-processed microservice dependency records, the system obtains a complete microservice knowledge graph and saves it as a GraphML format file for subsequent module calling and processing.

[0091] S2: Constructing a path generation strategy and obtaining a set of microservice anchor point combination paths that meet the non-cyclic constraint from the microservice knowledge graph based on the path generation strategy;

[0092] and the constructed path generation strategy includes intra-workflow generation rules and inter-workflow generation rules, specifically

[0093] S21: The specific rules generated in the constructed workflow are:

[0094] Define the starting microservice entity node m s and terminate microservice entity node m z , and based on the path generation probability, in the microservice knowledge graph In the example, path p is generated according to the edge weight function value and p=(m s ,m s+1 ,…,m z ) to obtain the microservice anchor combination path of the workflow;

[0095] The expression of the path generation probability P(p) is:

[0096]

[0097] Where: Represents node m k All outgoing neighbors of ; Represents the microservice entity node m k With microservice entity node m k+1 The edge weights between ; Represents the microservice entity node m k With neighbor node m ' The edge weight between them; z represents the index of the last microservice node in the microservice anchor combination path; m s+1 Indicates the s+1th microservice entity node, i.e., the next position in the microservice anchor combination path sequence; m s Indicates the starting microservice entity node;

[0098] In this embodiment, to generate a composite path that reflects the order of microservice calls within a single workflow, the system first analyzes the constructed microservice knowledge graph to identify the microservice entities that frequently appear at the starting and ending positions in historical workflows. Specifically, the system uses statistical data to automatically select microservices that appear as entry points in most workflows as starting nodes, and simultaneously selects microservices that frequently serve as ending calls as terminating microservice entity nodes. After determining the starting and ending nodes of the microservices, the system begins at the starting microservice entity node and traverses all outgoing edges of each node in the knowledge graph. At each microservice node, the system compares the weights of all outgoing edges and selects the edge with the highest weight as the direction for continued traversal. This process continues until the system reaches the predetermined terminating microservice entity node. During this process, the system calculates the probability of the generated path by multiplying the normalized edge weights selected at each step in the path. This method generates a composite path of microservice anchor points that fully reflects the service call order and local dependencies within a single workflow. In actual implementation, this embodiment uses dependency records extracted from the "CloudMicroservice-D" dataset for statistical analysis to ensure that the selected start and end nodes are representative and that the generated paths are of moderate length to reflect common business processes. After automated script processing, all generated combined paths are stored in a database for subsequent model training.

[0099] S22: The specific rules for generating workflows are as follows:

[0100] Define the root node m of the microservice entity node r , and the root node m r As the starting microservice entity node, based on the softmax probability function, according to the microservice knowledge graph Get the root node m r Its neighbor node set Sampling generates the path generation probability of the next microservice node to obtain the microservice anchor combination path of the workflow;

[0101] The path generation probability P(m j ∣m r ) is expressed as

[0102]

[0103] Where: β represents the smoothing parameter; Represents the microservice entity node m r With microservice entity node m j The edge weights between ; Microservice entity node m r With neighbor node mk The embodiment obtains the service anchor point combination path set by using all the paths generated by the above rules to satisfy the non-cyclic constraint.

[0104] In this example, inter-workflow generation rules are designed to capture diversified microservice call combinations across different workflows. First, the system selects a root node from the constructed microservice knowledge graph, which is usually automatically determined based on its frequency of occurrence or centrality indicators in all workflows. After selecting the root node, the system obtains all directly related microservice entities from the neighbor set of the node. Unlike the intra-workflow generation rules, in this rule, the system does not directly select the edge with the highest weight, but uses a probability sampling method to perform softmax normalization on all neighbors of the root node, thereby obtaining the probability of selecting each candidate node. In this way, the system randomly samples subsequent nodes to construct a candidate set containing multiple different service combination paths. During the sampling process, to avoid cycles caused by generating duplicate nodes, the system checks the currently generated paths in real time to ensure that each newly selected microservice node has not appeared in the current path. This random sampling method balances exploration and exploitation, and by adjusting the softening parameter, the sampling process can focus on edges with higher weights while maintaining a certain randomness, thereby generating paths with higher diversity. After sampling is complete, all generated combination paths satisfy the non-cyclic constraint condition and are added to the subsequent model training dataset as training samples.

[0105] S3: Construct a combination path network model for microservice prediction, and train the combination path network model using the microservice anchor point combination path set to obtain an optimized combination path network model;

[0106] Specifically, the combination path network model for microservice prediction includes an input module, an improved gLSTM sequence modeling module, an attention-based context embedding module, and a context-aware service prediction module for next-step microservice prediction, which are connected in sequence.

[0107] The input module is used to obtain vector representations of each microservice in the microservice anchor point combination path p = (m1, m2, …, m L ) according to the microservice anchor point combination path set, to form an embedding vector matrix V d . P ;

[0108] The embedding vector matrix V P is represented as

[0109] V P = [v(m1), v(m2), …, v(m L

[0110] where v(m L ) denotes the vector representation of the Lth microservice in the microservice anchor combined path p;

[0111] and the target workflow requirement text is converted into a vector u target ∈R d .

[0112] In this example, the purpose of the input module is to convert the discrete service combined paths obtained from the knowledge graph and path generation stage into continuous, fixed-dimensional numerical representations, and at the same time, to vectorize the requirement text of the target workflow, so as to provide uniform input data for the subsequent sequence modeling module. Specifically, first, the system reads each microservice anchor combined path from the set of microservice anchor combined paths obtained through the S2 stage. Assume that a combined path is represented as p = (m1, m2, …, mL), where m1, m2, …, mL represent the respective microservices in the combined path. L L In order to convert each microservice into a continuous vector, the embodiment selects a microservice embedding model, i.e., an embedding function v(m), which is pre-trained based on the CloudMicroservice-D dataset. The microservice embedding model is further fine-tuned to adapt to the current business scenario, and can effectively capture the semantic and functional characteristics of microservices. In specific implementation, using Python language and TensorFlow framework, the system first calls the embedding layer interface, inputs the unique identifier of each microservice in the combined path to the embedding layer, and outputs a d-dimensional vector. For example, for the microservice "ms_auth", the vector obtained after embedding is v(ms_auth) ∈ R d ; then, the system concatenates all service vectors into a two-dimensional matrix according to the order of services in the combined path, forming the embedding matrix V P = [v(m1), v(m2), …, v(m L )], which not only preserves the semantic information of the services, but also reflects the order information of the services in the combined path. At the same time, in order to enable the combined path network model to fully consider the guiding role of business requirements when processing microservice call sequences, the embodiment introduces vectorization processing of the target workflow requirement text. Specifically, using the Doc2Vec model implemented in the Gensim library, the input workflow requirement text is treated as an independent document, and after text preprocessing including word segmentation, stop word removal, and morphological restoration, the system sends the document to the Doc2Vec model. The model, after pre-training and fine-tuning, can convert the text document into a fixed-dimensional vector u target ∈R​​d . In order to improve the accuracy and robustness of vector representation, the system adopts a distributed memory model (PV-DM) when training Doc2Vec, and sets appropriate window size and training iteration number to ensure that the obtained vector can fully reflect the semantic information in the text. In this embodiment, the entire input module calls the pre-trained embedding model and the Doc2Vec model to finally output two standardized data: one is the embedding matrix V P of the combined path, and the other is the vector u target of the target workflow requirement. Both data are used as inputs of the improved gLSTM sequence modeling module to realize effective conversion of discrete data to continuous vector representation and provide a solid foundation for the improved gLSTM sequence modeling module.

[0113] The improved gLSTM sequence modeling module is used to mine the dependency relationship in the microservice based on the target vector u target and the embedding vector matrix V P to obtain the semantic features of the microservice.

[0114] Specifically, in each time step t (1≤t≤L), the state update formula is used to obtain the hidden state h t and the cell state c t : where h t is the hidden state, reflecting the current semantic information of the sequence at time step t; c t is the cell state, used to store and transmit long-term dependency information; updating these two states can ensure that the model retains short-term context while accumulating long-term features when capturing the dependency relationship between microservice calls; the specific formula for updating h t and c t is the expression of the improved gLSTM sequence modeling module:

[0115] f t =σ(W f v(m t )+U f h t-1 +Q f u target +b f )

[0116] i t =σ(W i v(m t )+U i h t-1 +Q i u target +b i )

[0117] o t= σ(W o v(m t )+ U o h t-1 + Q o u target + b o )

[0118] g t = tanh(W g v(m t )+ U g h t-1 + Q g u target + b g )

[0119] c t = f t ⊙ c t-1 + i t ⊙ g t

[0120] h t = o t ⊙ tanh(c t )

[0121] wherein: W f , W i , W o , W g , U f , U i , U o , U g , Q f , Q i , Q o , Q g denote the weight parameter matrices of the improved gLSTM sequence modeling module; b f , b i , b o , b g denote the bias vectors; σ(·) denotes the sigmoid function; ⊙ denotes element-wise multiplication; t denotes the time step; h t denotes the hidden state reflecting the current semantic information of the workflow sequence at time step t to obtain the microservice semantic feature; c t denotes the cell state used to store and deliver the long-term dependency information of the microservice; f t denotes the forget gate activation vector, which functions to determine how much information in the cell state at the previous time step should be forgotten at the current time step, and the closer the value is to 1, the more historical information is retained, and the closer the value is to 0, the more content is forgotten; i t denotes the input gate activation vector, which functions to measure the importance of the current input data for updating the cell state, and it The higher the value of , the greater the contribution of the current input to updating the cell state; t represents the output gate activation vector, which controls how much information is output as the hidden state after the current cell state undergoes nonlinear transformation, thereby affecting the state update and model output of subsequent time steps; g t Represents the candidate update vector, that is, the candidate information obtained by nonlinear mapping of the current input and the previous state, which is used to supplement the cell state and g t The value of is activated by tanh and is between -1 and 1, reflecting the new information that can be introduced by the current input;

[0122] In this example, the service composition path is converted into a fixed-dimensional embedding vector matrix V in the completion input module. P The target workflow requirement text is converted into the target vector u target Finally, the vector sequence is modeled in a time series manner by improving the gLSTM sequence modeling module to capture the dynamic relationship between microservice calls and long-term and short-term dependency information. To this end, this embodiment adopts an improved long short-term memory network (gLSTM). Based on the traditional LSTM structure, this network adds the target demand vector as an auxiliary input, allowing the model to better consider the guiding role of the overall business needs when processing service sequences.

[0123] The system first initializes the hidden state h t With cell state c tFor all-zero vectors, the two states are used to store the short-term semantic information of each time step and the long-term dependency information accumulated across time steps, respectively. For each time step, the system extracts the corresponding microservice vector from the embedding matrix in turn, and inputs it into the improved gLSTM sequence modeling module together with the hidden state of the previous moment and the pre-processed target demand vector. Inside the improved gLSTM sequence modeling module, the system calculates the activation values of the forget gate, the input gate and the output gate through a series of linear transformations, and these gating mechanisms determine how much historical information is retained and how much new information is introduced at the current moment. Subsequently, the candidate state is nonlinearly mapped through the gating mechanism, and the cell state of the last moment is fused with the current candidate state according to the gating weight to update the cell state of the current moment; then, the updated cell state is subjected to tanh activation, and the current time step hidden state is obtained by element-wise multiplication with the activation value of the output gate. In this process, the hidden state reflects the instantaneous service invocation characteristics at the moment, while the cell state records the long-term information of the entire sequence. In order to prevent overfitting, the embodiment adds a Dropout operation after each time step, and uses batch normalization to stabilize the training process. During the training process, the embodiment uses the Adam optimizer, the learning rate is set to 0.001, and the training period reaches 300 epochs. After several rounds of iterative training, the improved gLSTM model can effectively capture the dynamic changes of microservice invocation in the combined path and make accurate modeling of future service invocation trends.

[0124] The attention-based context embedding module is used to obtain the attention weight a of different microservices at each time step t according to the semantic characteristics of the microservices t ;

[0125] In order to integrate the information of each moment of the sequence and give different importance to different microservices, the embodiment calculates and obtains the attention weight a of each time step t t , and the formula for obtaining the attention weight a t is:

[0126]

[0127] In the formula, r e R d represents a trainable attention weight parameter vector; represents the transpose of h t , that is, converting a column vector into a row vector; h t represents the hidden state of the improved gLSTM sequence modeling module at time step t; r represents a trainable weight vector with the same dimension as h t , so is the vector h tand r is an inner product operation that yields a scalar value reflecting the similarity or importance score between the hidden state at time step t and the attention vector; for denotes the normalization of the inner product scores over all time steps in the sequence of microservice anchor point combination paths, such that the attention weights a t become a summation part of the probability value, which represents the importance proportion of this time step in the entire sequence of microservice anchor point combination paths, so that the model can automatically learn which time steps are more critical to the final output through the softmax normalization operation;

[0128] and on this basis, according to the attention weights a t get the microservice context vector c path which is specifically expressed as:

[0129]

[0130] and the microservice context vector c path integrates the dynamic semantic information of each microservice in the microservice anchor point combination path; in this example, since in the improved gLSTM sequence modeling module, each time step hidden state output by the gLSTM contains part of the semantic information, but in the entire service combination path, the contribution of each time step is not equal, therefore the context embedding module adopts the attention mechanism to weight and fuse these outputs, thereby generating a comprehensive microservice context vector as the global semantic representation of the entire combination path. In specific implementation, the system first collects all the hidden states output by the improved gLSTM, and then uses a trainable attention vector to score each time step hidden state. Here, the system performs an inner product operation between each hidden state and the attention vector to obtain a score value, and all score values are normalized by softmax to generate the attention weight of each time step. These weights represent the important role played by each time step in the entire service sequence. Then, the system weights and sums all the hidden states of the time steps according to the corresponding attention weights, and finally obtains a context vector, which is the comprehensive representation of the entire combination path. In practical applications, this module is implemented through a self-defined attention layer, and the attention parameters are repeatedly debugged during training to ensure that the model can automatically learn which microservice calls have a key impact on the next prediction. Through this method, the context embedding module can fully integrate local time series information to form a global representation that is most representative of the entire service sequence, thereby providing a more accurate context basis for subsequent service prediction.

[0131] The context-aware service prediction module is configured to map the microservice context vector to a preset candidate microservice space by using a full connection layer, and obtain an original score of each candidate microservice, and the specific formula is as follows:

[0132] S(m,c path )=W p c path +b p

[0133] In the formula, m represents the index of the candidate microservice in the set N; c path is the microservice context vector output by the attention-based context embedding module, representing the global semantic information of the entire service anchor point combination path, and the vector has fused the weighted information of the hidden state of each time step; W p represents the weight matrix of the full connection layer and has a dimension of |N|*d; |N| represents the size of the candidate microservice set; d represents the dimension of the microservice context vector c path ; wherein the role of W p is to map the microservice context vector to a space equal to the number of candidate microservices, and each element corresponds to a matching score of a microservice; b p represents the bias vector of the full connection layer and has a dimension of |N|, and b p , together with W p , adjusts the mapping result by translation, thereby improving the expression ability and fitting effect of the model;

[0134] Then, the original score is converted into a microservice prediction probability by using a softmax probability function, and the specific formula is as follows:

[0135]

[0136] In the formula, S(m',c path ) represents the original score of the microservice node m ' ; S(m,c path ) represents the original score of the candidate microservice; m represents the index of the candidate microservice in the set N; c path is the microservice context vector output by the attention-based context embedding module, representing the global semantic information of the entire service anchor point combination path; W p represents the weight matrix of the full connection layer and has a dimension of |N|*d; |N| represents the size of the candidate microservice set; d represents the dimension of the microservice context vector c path ; exp(S(m',c path )) represents the sum of the exponential scores of all candidate microservices, ensuring that the probability sum of the entire output is 1; b p represents the bias vector of the full connection layer and has a dimension of |N|; and exp(S(m,c path) represents an exponential operation on the original score of the candidate microservice m, aiming to convert the score into a positive number and amplify the difference between scores; P(m|c path ) represents the probability of the candidate microservice m being predicted as the next service under the condition of the given microservice context vector c path .

[0137] The recommended set of target microservices is obtained by selecting the top k microservices in the candidate microservice set according to the descending order of the predicted probability.

[0138] In specific embodiments, the combination path network model is trained using the microservice anchor point combination path set in S3 to obtain an optimized combination path network model, specifically including:

[0139] S31: Randomly divide the microservice anchor point combination path set into a training set and a test set;

[0140] S32: Train the combination path network model according to the training set to obtain a trained combination path network model;

[0141] S33: Based on the cross-entropy loss function, verify the trained combination path network model according to the test set to determine whether the trained combination path network model converges or reaches the maximum number of iterations;

[0142] If yes, the trained combination path network model is used as the optimized combination path network model;

[0143] Otherwise, the weight parameters of the trained combination path network model are adaptively adjusted based on the back propagation method, and step S32 is repeated.

[0144] In the training phase of the combination path network model, the loss function, i.e., the cross-entropy loss function, is optimized to maximize the predicted probability of the correct next microservice.

[0145] In this example, after obtaining the microservice context vector output by the attention-based context embedding module, the microservice context vector is mapped into the preset candidate microservice space by the context-aware service prediction module, and the microservice most suitable for the next call under the current context is predicted. Specifically, the system first passes the context vector as input to a fully connected layer, which maps the context vector to an original score vector with the same number of candidate microservices through linear transformation. Each element in the original score vector corresponds to a candidate microservice, reflecting its matching degree in the current combination path context. To ensure that the scores between the results can be compared, the system then normalizes the original score vector using the softmax probability function to convert it into a distribution of microservice prediction probabilities. This distribution of microservice prediction probabilities directly represents the confidence value of each candidate microservice as the next service selection according to the combination path network model for microservice prediction. In the implementation process, to improve the generalization ability of the combination path network model, Dropout and batch normalization processing are introduced before and after the fully connected layer, and the cross-entropy loss function is used to supervise the prediction results. After training and parameter tuning, the combination path network model can be more effective in the offline training phase, proving its effectiveness in actual online recommendation scenarios. Finally, the context-aware service prediction module generates a prediction probability as input to the existing microservice online recommendation system to further sort and filter the candidate microservices, thereby providing and implementing real-time and accurate microservice recommendations.

[0146] S4: For the original workflow being constructed, a set of microservice anchor point combination paths is extracted from the set of microservice anchor point combination paths obtained in S2, and the microservice anchor point combination paths are input into the optimized combination path network model in S3. The microservice context vector is obtained by the optimized combination path network model to obtain the microservice prediction probability of each candidate microservice as the next service of the original workflow execution. The microservice prediction probability is sorted in descending order, and the top k microservices in the sorting result are selected as the target microservices for online recommendation.

[0147] Specifically, the following steps are included:

[0148] S41: For the original workflow being constructed, a set of microservice anchor point combination paths p is extracted from the set of microservice anchor point combination paths obtained in S2;

[0149] In this example, the system extracts a set of anchor point combination paths from the previously constructed knowledge graph according to the path generation strategy previously formulated in the S2 stage for the original workflow being constructed, and inputs the microservice anchor point combination paths into the optimized combination path network model described in S3, and obtains the microservice context vector through the optimized combination path network model to obtain the microservice prediction probability of each candidate microservice as the next service of the original workflow execution, to filter out the path that best matches the current workflow business scenario. When the specific implementation of the path is filtered out, the system first filters out the path that best matches the current workflow business scenario from the service combination path set generated in the S2 stage. The filtering rules are mainly based on historical statistical data and business priority settings. For example, the system will preferentially retain those microservice combinations that frequently appear in historical data and have a key role in core business processes. To achieve this process, the system compares the real-time workflow log with the knowledge graph generated in the S1 stage to extract the calling sequence of the selected microservices in the current workflow. This embodiment uses predefined rules to set that the starting microservice entity node must be the business entry service and the terminating microservice entity node must be the key data processing service to filter and trim the microservice anchor point combination paths. After a series of data matching and filtering processes, the system finally generates a set containing several anchor point combination paths. These paths not only reflect the calling order of the current workflow, but also contain key node information in the business scenario, providing high-quality input for subsequent prediction calculations. The implementation of this stage completely depends on the previously pre-trained microservice knowledge graph and path generation strategy on the CloudMicroservice-D dataset, ensuring that the extracted microservice anchor point combination paths have sufficient representativeness and business relevance.

[0150] S42: input the microservice anchor point combination path p into the optimized combination path network model trained in S3, and calculate and obtain the microservice context vector c of the combination path through the input module, the improved gLSTM sequence modeling module, the attention-based context embedding module, and the context-aware service prediction module for next microservice prediction path ;

[0151] In this example, the system inputs the anchor point combined path data obtained in the S41 stage into the optimized combined path network model trained in the S3 stage, aiming to perform time series modeling and global semantic extraction on the combined path through the model. In actual operation, the system first calls the pre-trained microservice embedding module to convert each microservice identifier in each combined path in the S41 into a fixed-dimension vector, forming a continuous embedding matrix; at the same time, the system also converts the business requirement text of the current workflow into a vector through the Doc2Vec model. Next, the system inputs the embedding matrix and the business requirement vector as input into the improved gLSTM sequence modeling module. The module uses the parameters obtained through large-scale offline training on the CloudMicroservice-D dataset in the early stage to process the combined path step by step, updating the hidden state and cell state at each step to capture the real-time calling features and long-term dependency information between microservices. In particular, during state updating, the model considers the current input vector, the previous time state, and the target requirement vector, ensuring that the output hidden state can fully reflect the dynamic changes in the combined path. After processing the entire sequence, the output of the model at each time step is further weighted and fused through the attention-based context embedding module to generate a context vector of the entire combined path. This context vector, as a representation of the global semantics of the combined path, not only contains the sequence information of microservice calling, but also incorporates the guiding factors of business requirements, providing a solid context basis for subsequent service prediction. This process has been optimized through batch data and multiple iterations during offline training, ensuring that the model output has high stability and accuracy.

[0152] S43: According to the microservice scenario vector c path , the recommended microservice set composed of the top k microservices with the highest prediction probability in the microservice candidate set is calculated and obtained as the target microservice for online recommendation;

[0153] The online recommendation formula of the target microservice is:

[0154]

[0155] In the formula: represents the final recommended microservice set; argtop represents a sorting interception function that obtains the top k microservices themselves to form a set through the score of the microservice scenario vector.

[0156] In this example, the microservice online recommendation system utilizes the microservice context vector obtained in stage S42 to make online prediction on candidate microservices, and finally generates the recommendation result of the next step microservice. Specifically, the system first passes the microservice context vector obtained in stage S42 to the context-aware service prediction module, which maps through the fully connected layer to convert the context vector into the original score of the candidate microservice. The original score here reflects the adaptation degree of each candidate microservice in the current workflow context. Subsequently, the system converts the original score into a microservice prediction probability distribution by using the softmax normalization method, obtaining the microservice prediction probability of each candidate microservice as the next service selection. In order to ensure the accuracy and real-time performance of the microservice prediction result, the system also utilizes the sorting interception algorithm in stage S43, i.e., descendingly sorting the prediction probabilities of all candidate microservices, and automatically selecting the top k microservices with the highest prediction probability from the candidate microservices as the final recommended target service set through the argtop function. This process can fully utilize the model parameters obtained in offline training, ensuring that the model can quickly respond and give accurate service recommendations in online environment. In actual deployment, this embodiment can input the state data of the current workflow into the model in real time through the interface between the system and the internal real-time data warehouse, ensuring that the prediction in stage S43 can reflect the latest business scenario, thereby effectively improving the practicality and efficiency of online recommendation.

[0157] In order to verify the effect of the method of this embodiment (hereinafter referred to as KG-MicroRec), a large number of experiments were conducted on the CloudMicroservice-D dataset. This dataset contains more than 1500 workflow and more than 2000 microservice call dependency records in real enterprise, and a large number of microservice anchor point combination path data are generated after processing stages S1 to S3, serving as the basis for offline training and online testing. In the experiment, this embodiment randomly selects 200 real-time workflows from the dataset as test samples, extracts the microservice anchor point combination path according to the rules in stage S2 for each workflow, then calculates the microservice context vector using the trained optimized combination path network model, obtains the microservice prediction probability of the candidate microservice through the context-aware service prediction module, and finally sorts the top 5 or top 10 microservices in descending order of microservice prediction probability as the recommendation result.

[0158] In the experimental comparison, as Figures 2 to 3As shown, four online service recommendation methods with similar structures were selected as benchmarks in this embodiment, namely GRU4Rec, SASRec, MA-GNN and KGCN. These four methods have all been applied in similar microservice recommendation tasks, and the Hit@5 or Hit@10 indicators reported in the public literature are all between 25% and 45%. The specific experimental results show that, in terms of the Hit@5 indicator, the GRU4Rec model achieves an average hit rate of 29.2%, SASRec is 33.0%, MA-GNN reaches 41.0%, and KGCN is 38.5%; while the KG-MicroRec method of the present application achieves a Hit@5 hit rate of 43.5% under the same conditions, which is about 2.5 percentage points higher than MA-GNN, and is also significantly higher than GRU4Rec and SASRec. For the Hit@10 indicator, GRU4Rec performs 33.1%, SASRec is 36.2%, MA-GNN is 45.0%, KGCN is 42.0%, and the Hit@10 hit rate of the KG-MicroRec method is 47.0%, further verifying the advantages of the method of the present embodiment in candidate microservice ranking. In addition, the online response time is also tested in this embodiment. In the actual deployment environment, the system uses GPU acceleration and batch processing technology, and the average response time of the method remains within 70 milliseconds under a high concurrency scenario (processing 500 real-time workflow requests at the same time), while the response times of the comparative models are 410 milliseconds (GRU4Rec), 260 milliseconds (SASRec), 320 milliseconds (MA-GNN) and 118 milliseconds (KGCN), respectively. These data show that the method of the present application not only has advantages in recommendation accuracy, but also significantly outperforms existing methods in real-time response capability, and can meet the requirements of enterprise-level online service scheduling.

[0159] In summary, through the above experimental data and comparative analysis, the combination path network model (KG-MicroRec) in the online service recommendation method of the microservice system based on a knowledge graph in this embodiment achieves hit rates of 43.5% and 47.0% in Hit@5 and Hit@10 indicators, respectively, which is about 14.3% and 11.0% higher than the traditional GRU4Rec, SASRec, MA-GNN and KGCN models, respectively; at the same time, the present embodiment performs better in online response time, with an average response time of only 107 milliseconds, which is significantly better than the comparative methods. As Figure 4 As shown, the experimental results fully verify the significant advantages of the method of the present embodiment in deep capturing of microservice call timing information, fusion of global context and efficient generation of online recommendation results, providing strong technical support for microservice scheduling and automated recommendation in actual business scenarios.

[0160] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions recorded in the above embodiments can be modified, or some or all of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for online service recommendation in a microservice system based on knowledge graph, characterized in that: Including steps: S1: Build a microservice knowledge graph based on the historical dependency records of microservices in the workflow repository; S2: construct a path generation strategy, and based on the path generation strategy, obtain a set of microservice anchor combination paths that meet the acyclic constraint from the microservice knowledge graph; S3: Build a combined path network model for microservice prediction and train it using the microservice anchor combined path set to obtain an optimized combined path network model. S4: For the original workflow being constructed, a set of microservice anchor combination paths is extracted one by one from the set of microservice anchor combination paths obtained in S2, and the microservice anchor combination paths are input into the optimized combination path network model described in S3. The microservice context vector is obtained through the optimized combination path network model to obtain the predicted probability of each candidate microservice as the microservice to execute the next service of the original workflow. The predicted probabilities of the microservices are sorted in descending order, and the top k microservices in the sorting results are selected as the target microservices for online recommendation.

2. The method according to claim 1, characterized in that The method for constructing a microservice knowledge graph in S1 specifically includes the following steps: S11: historical dependency records of microservices in the workflow repository; S12: Define the microservices with historical dependency records as microservice entity nodes, and construct a microservice entity node directed graph G=(N,e ij ,φ); Where N={m1,m2,…,m n } represents a collection of microservice nodes, Represents the set of dependency edges between microservices, φ represents the edge weight function, and the expression of the edge weight function is: Where: f(m i ,m j ) represents microservice m i Call microservice m j The frequency of; F represents the normalization factor; S13: Obtain all edge weight sets and microservice entity node sets according to the microservice entity node directed graph to form the microservice knowledge graph 3. The online service recommendation method in a microservice system based on a knowledge graph according to claim 2 is characterized in that: The path generation strategy constructed in S2 includes intra-workflow generation rules and inter-workflow generation rules; S21: The specific rules generated in the constructed workflow are: Define the starting microservice entity node m s and terminate microservice entity node m Z , and based on the path generation probability, in the microservice knowledge graph In the example, path p is generated according to the edge weight function value and p=(m s ,m s+1 ,…,m z ) to obtain the microservice anchor combination path of the workflow; The expression of the path generation probability P(p) is: Where: Represents the microservice entity node m k All neighbor nodes of Represents the microservice entity node m k With microservice entity node m k+1 The edge weights between ; Represents the microservice entity node m k With neighbor node m ' The edge weight between them; z represents the index of the last microservice node in the microservice anchor combination path; m s+1 Indicates the s+1th microservice entity node; m s Indicates the starting microservice entity node; S22: The specific rules for generating workflows are as follows: Define the root node m of the microservice entity node r , and the root node m r As the starting microservice entity node, based on the softmax probability function, according to the microservice knowledge graph Get the root node m r Its neighbor node set Sampling generates the path generation probability of the next microservice node to obtain the microservice anchor combination path of the workflow; The path generation probability P(m j ∣m r ) is expressed as Where: β represents the smoothing parameter; Represents the microservice entity node m r With microservice entity node m j The edge weights between ; Microservice entity node m r With neighbor node m k The edge weights between .

4. The online service recommendation method in a microservice system based on a knowledge graph according to claim 3 is characterized in that: In S3, a combined path network model for microservice prediction is constructed, including a sequentially connected input module, an improved gLSTM sequence modeling module, an attention-based context embedding module, and a context-aware service prediction module for the next microservice prediction. The input module is used to convert the microservice anchor combination path p=(m1, m2, ..., m L ) Each microservice in the system embeds a function v(m)∈R d Get the vector representation to form the embedding vector matrix V P ; And the embedding vector matrix V P Expressed as In P =[v(m1),v(m2),…,v(m L )] Where: v(m L ) represents the vector representation of the Lth microservice in the microservice anchor combination path p; The input module is also used to convert the target workflow requirement text into a target vector u using the Doc2Vec model target ∈R d ; The improved gLSTM sequence modeling module is used to target , according to the embedding vector matrix V P Mining dependencies among microservices to obtain microservice semantic features; The expression of the improved gLSTM sequence modeling module is: f t =σ(W f v(m t )+U f h t-1 +Q f u target +b f ) i t =σ(W i v(m t )+U i h t-1 +Q i u target +b i ) o t =σ(W o v(m t )+U o h t-1 +Q o u target +b o ) g t =tanh(W g v(m t )+U g h t-1 +Q g u target +b g ) c t =f t ⊙c t-1 +i t ⊙g t h t =o t ⊙tanh(c t ) Where: W f ,W i ,W o ,W g ,U f ,U i ,U o ,U g ,Q f ,Q i ,Q o ,Q g represents the weight parameter matrix of the improved gLSTM sequence modeling module; b f ,b i ,b o ,b g represents the bias vector; σ(·) represents the sigmoid function; ⊙ represents element-by-element multiplication; t represents the time step; h t Represents the current semantic information of the workflow sequence at time step t to obtain the hidden state of the microservice semantic features; c t Represents the cell state used to store and transmit long-term dependency information of microservices; f t represents the forget gate activation vector; i t represents the input gate activation vector; o t represents the output gate activation vector; g t represents the candidate update vector; The attention-based context embedding module is used to obtain the attention weight α of different microservices at each time step t according to the semantic features of microservices t ; And according to the attention weight α t Obtain a microservice scenario vector that integrates the dynamic semantic features of each microservice in the microservice anchor combination path; The attention weight α t The formula for obtaining is Where: r∈R d represents the trainable attention weight parameter vector; Indicates h t The transpose of ; r represents a trainable dimension and h t Same weight vector; Indicates that the inner product scores of all time steps in the microservice anchor combination path sequence are normalized, so that the attention weight α of each time step is t Become the summation part of a probability value; The microservice scenario vector c path The formula for obtaining is The context-aware service prediction module is used to map the microservice context vector to a preset candidate microservice space using a fully connected layer to obtain the original score of each candidate microservice; Use the softmax function to convert the original score into the microservice prediction probability; The recommended set consisting of the top k microservices in the candidate set of microservices sorted from high to low according to the predicted probability is selected as the target microservice for online recommendation; The expression of the context-aware service prediction module is: S(m,c path )=W p c path +b p Where: S(m',c path ) represents the microservice node m ' The original score of S(m,c path ) represents the original score of the candidate microservice; represents the index of the candidate microservice in the set N; c path is the microservice context vector output by the attention-based context embedding module, which represents the global semantic information of the entire service anchor combination path; W p represents the weight matrix of the fully connected layer and has the dimension |N|×d; |N| represents the size of the candidate microservice set; d represents the microservice context vector c path Dimension of exp(S(m',c path )) represents the index score of all candidate microservices, ensuring that the total probability of the output is 1; b p represents the bias vector of the fully connected layer and has a dimension of |N|; exp(S(m,c path )) represents the exponential operation on the original score of the candidate microservice m; P(m|c path ) represents the given microservice context vector c path The probability that the candidate microservice m is predicted as the next service under the condition 5. The online service recommendation method in a microservice system based on knowledge graph according to claim 1 is characterized in that: As described in S3, the combined path network model is trained using the microservice anchor combined path set to obtain an optimized combined path network model, specifically including: S31: Randomly divide the microservice anchor combination path set into training set and test set; S32: training the combined path network model according to the training set to obtain a trained combined path network model; S33: Based on the cross entropy loss function, the trained combined path network model is verified according to the test set to confirm whether the trained combined path network model has converged or whether the maximum number of iterations has been reached; If so, the trained combined path network model is used as the optimized combined path network model; Otherwise, the weight parameters of the trained combined path network model are adaptively adjusted based on the back propagation method, and step S32 is repeated.

6. The online service recommendation method in a microservice system based on a knowledge graph according to claim 4 is characterized in that: The S4 specifically includes the following steps: S41: For the original workflow being built, extract a set of microservice anchor combination paths p one by one from the set of microservice anchor combination paths obtained in S2; S42: Input the microservice anchor combination path p into the optimized combination path network model trained in S3, and calculate and obtain the microservice scenario vector c of the combination path through the input module, the improved gLSTM sequence modeling module, the attention-based context embedding module, and the context-aware service prediction module for the next microservice prediction. path ; S43: According to the microservice scenario vector c path , calculate and obtain the recommended microservice set consisting of the top k microservices with the highest predicted probability in the microservice candidate set, and use them as the target microservices for online recommendation; The online recommendation formula for the target microservice is: Where: represents the final set of recommended microservices; argtop represents the sorting interception function that obtains the top k microservices themselves to form the set through the scores of the microservice scenario vectors.

Citation Information

Cited By

  • Service adaptation method and device based on skill dependence atlas and QoS (Quality of Service) perception

    CN121349706A