A microservice splitting method based on depth map reconstruction
Patent Information
- Application Number
- CN202310661122.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-06
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2043-06-06
AI Technical Summary
错误的分区数量还会导致极端分布(即多个微服务中仅包含一个类)的问题
[0052] 1. This invention solves the problem of manually defining the number of partitions (i.e. the number of microservices) when using graph neural networks for microservice decomposition, thereby improving the quality of microservice decomposition results and the degree of automation in the microservice decomposition process.
Smart Images

Figure CN116974523B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of microservice technology, and in particular relates to a method for microservice decomposition based on depth graph reconstruction. Background Technology
[0002] Microservices are an architecture and organizational method for developing software, and a variant of the Service-Oriented Architecture (SOA) style. Microservice architecture (MSA) consists of many highly cohesive, loosely coupled, autonomous, and independently deployable services, characterized by strong maintainability, scalability, automated deployment, and flexible technology selection. Furthermore, microservices are better suited to the current cloud-native era.
[0003] To better embrace the cloud-native era, more and more businesses are choosing to break down their existing monolithic applications into microservices. This requires identifying the program boundaries within the monolithic application and rationally decomposing and organizing the code. Incorrect decomposition methods can severely impact the performance of a microservice architecture.
[0004] Due to the ability of graphs to represent unstructured data, some microservice decomposition methods based on deep graph clustering have emerged in the past two years. These methods model monolithic applications using graphs, treating classes in the monolithic application as nodes in the graph, and using edges to represent the relationships between program fragments. For example, COGCN proposed by Desai et al. in the paper "Graph neural network to diluteoutliers for refactoring monolithapplication" uses graph convolutional neural networks to learn the calling relationships between degree fragments in a monolithic application. Then, the number of partitions (clusters) is manually defined, and clustering is performed using neural network methods, thereby achieving microservice decomposition.
[0005] Similar to COGCN, Qian et al. proposed GDC-DVF in their paper "Microservice extraction using graphdeepclustering based on dual view fusion". This method considers not only the calling relationships between classes but also the relationships between classes and business logic. It learns different relationships in the graph through different graph neural networks and aggregates multiple relationships through a semantic-level attention mechanism. Subsequently, it is necessary to define the number of partitions (i.e., the number of microservices) and introduce the FCM clustering method to group classes in the monolithic application, thereby realizing microservice decomposition.
[0006] Compared to some traditional methods, the aforementioned approach, which uses graph neural networks to learn the relationships between classes in a monolithic application for microservice decomposition, has achieved considerable results. However, due to limitations in the neural network optimization process, this deep graph clustering-based method requires manual definition of the number of partitions (i.e., the number of microservices) in practice. This not only affects the automation level of the microservice decomposition process but also impacts the overall performance of the resulting microservice architecture due to incorrect partition initialization. This situation is even more prevalent in large-scale monolithic applications. An incorrect number of partitions can also lead to extreme distributions (i.e., multiple microservices containing only one class). Summary of the Invention
[0007] This invention provides a microservice decomposition method based on depth graph reconstruction. While fully learning the different relationships in monolithic applications using graph neural networks, it can automatically determine the optimal number of partitions. While ensuring the accuracy of the microservice decomposition results, it reduces human intervention in the microservice decomposition process and avoids extreme distributions in the results.
[0008] A microservice decomposition method based on depth graph reconstruction includes the following steps:
[0009] (1) Treat the classes in a singleton application as nodes in a graph, denoted as C = {C1, C2, C3, ..., C}. N}, where N represents the number of classes in the monolithic application C, and C i This represents the i-th class.
[0010] Using four adjacency matrices A C A I A B A D This represents the relationship between classes in the diagram, where A C Indicates the calling relationship between classes, A I Indicates the inheritance relationship between classes, A B This represents the correspondence between classes and business logic, A. D This indicates the correspondence between a class and external resources;
[0011] (2) Embed the classes in the monolithic application into representation vectors so that classes that are frequently called by each other are close in the vector space; and concatenate the representation vectors of all classes in order to form the feature vector V representing the target monolithic application.
[0012] (3) Define the graph of the single application as: G = (V, A) C A I A B A D );
[0013] (4) Construct and train a depth map reconstruction model, the structure of which is as follows:
[0014] A gated graph neural network is introduced to learn multiple different relations in graph G, obtaining four types of relations A. C A I A B A D The result vector representation after passing through the gated graph neural network; a semantic-level attention mechanism is used to aggregate the result vectors of the four relations to obtain the final vector V that integrates and learns multiple relations. Final ; and through a multilayer perceptron (MLP) to convert V Final Converted to graph reconstruction, adjacency matrix A Re ;
[0015] (5) For the single application to be split, collect the adjacency matrix A of the reconstructed graph output by the depth graph reconstruction model. Re Based on this, the functional boundaries of the target monolithic application are identified and defined, and multiple microservices are obtained by splitting it.
[0016] This invention improves the automation level of the microservice decomposition process, enabling microservice decomposition to be carried out without relying on external expert knowledge to guide the decomposition process and define the number of decompositions, and obtaining microservice decomposition results with better overall performance.
[0017] In step (1), four adjacency matrices A are used. C A I A B A D The relationships between classes in the diagram specifically include:
[0018] A C This represents the calling relationship between classes in the target monolithic application, when the i-th class C i and the j-th class C j When there is a calling relationship between A and B, let A C [i][j]=A C [j][i] = 1, otherwise A C [i][j]=A C [j][i] = 0;
[0019] A I This represents the inheritance relationship between classes in a target monolithic application, when C... i and C j When an inheritance relationship exists, let A I [i][j]=A I [j][i] = 1, otherwise A I [i][j]=A I [j][i] = 0;
[0020] A B This represents the correspondence between classes and business logic. When C... i and C j When they belong to the same business, let A B [i][j]=A B [j][i] = 1, otherwise A B [i][j]=A B [j][i] = 0;
[0021] A D This represents the correspondence between a class and external resources. When C... i and C j Accessing the same external resource caused A D [i][j]=A D [j][i] = 1, otherwise A D [i][j]=A D [j][i] = 0.
[0022] Among them, A C A I A B A D All belong to {0,1} N*N , which is an N*N matrix with values of 0 or 1.
[0023] The specific process of step (2) is as follows:
[0024] First, an embedding representation vector is randomly generated for each class using a neural network, i.e., {v1, v2, v3, ..., v...}. N}, where v i For the i-th class C i The embedding vector representation, v i ∈R D , representing v i It is a D-dimensional real vector;
[0025] When optimizing v, for any two classes C in the target monolithic application... i and C j First, calculate C. i and C j The joint probability distribution p1(C) in space N*N i C j Then, the empirical probability distribution in the N*N space is calculated.
[0026] By minimizing the joint probability distribution p1(C) i C j ) and empirical probability distribution The difference between them is used to optimize the embedding representation vector v, so that the embedding vectors of two classes that are frequently called are as similar as possible; then, based on the calculated loss, the representation vectors are automatically trained and updated through backpropagation.
[0027] Once training has converged, the representation vectors of all classes are concatenated in order, denoted as V, where V∈R. N×D V is an N*D dimension real vector, which serves as the feature vector representing the target single application.
[0028] In step (4), the operation of the gated graph neural network is defined as follows:
[0029] V (k+1) =GGNN(A,V (k) ,W,U)
[0030]
[0031] in
[0032] In the formula, V (k) The input graph is the feature vector, W and U are parameters learned during the optimization process, ⊙ represents the element-wise multiplication operation, and σ is the sigmoid function. Let A be the adjacency matrix after Laplace normalization, and φ be the nonlinear activation function.
[0033] According to the definition above, we obtain A respectively. C A I A B A D The vector representations of the four relationships after passing through a gated graph neural network: Where l represents the number of layers in the gated graph neural network for each relation.
[0034] The specific process of aggregating the result vectors of the four relations using a semantic-level attention mechanism is as follows:
[0035] First, the attention weights corresponding to each result are obtained based on their importance, as shown below:
[0036] e ij =a T ([(KV i +b)‖(KV j +b)])
[0037]
[0038]
[0039] Where K is the weight matrix, b is the noise vector, a is the semantic-level attention mechanism, and ω ij Let V be the attention weight between the i-th and j-th vectors; by using the learned weights as coefficients, the resulting embedding vectors are fused together to obtain the final embedding V. Final The details are as follows:
[0040]
[0041] Multilayer perceptrons (MLPs) achieve nonlinear mapping of input data through a series of linear transformations and nonlinear activation functions, transforming V... Final Converted to graph reconstruction, adjacency matrix A Re .
[0042] The training process for the depth map reconstruction model is as follows:
[0043] Obtain the results of the split based on the optimal degree of business concentration, denoted as best_bcp; the split based on the lowest communication cost, denoted as best_icp; the split based on the optimal degree of cohesion, denoted as best_coh; and the microservice split based on the optimal degree of coupling, denoted as best_cou.
[0044] Convert the above microservice decomposition results into a graph, and then convert the corresponding graph into an adjacency matrix, denoted as A. best_bcp A best_icp A best_coh A best_cou Based on this, the adjacency matrix A of the output reconstructed graph is... Re Cross-supervision is performed to calculate the loss; after the loss is calculated, backpropagation is performed based on the loss to update the parameters in the neural network until the loss converges, and the trained model is obtained.
[0045] In step (5), the functional boundaries of the target monolithic application are identified and defined, and the specific process of decomposing it into multiple microservices is as follows:
[0046] First, each node in the graph is initialized as an independent partition. Then, partitions are merged through iterative optimization until the optimal modularity is reached. The modularity is defined as:
[0047]
[0048] In the formula, g i Representative class C i The partition to which it belongs, g j Representing C j For the partition to which it belongs, δ(u,v) equals 1 when u = v, and equals 0 otherwise;
[0049] In each iteration, we attempt to update the partition label of the current node to the partition label of its neighboring nodes in order to calculate the modularity gain of the current node after merging with its neighboring nodes. Then, we select the node with the largest modularity gain to merge.
[0050] In this way, closely related classes in the target monolithic application will gradually be grouped into the same partition, while loosely related class nodes will form independent partitions, thus forming the optimal microservice splitting method.
[0051] Compared with the prior art, the present invention has the following beneficial effects:
[0052] 1. This invention solves the problem of manually defining the number of partitions (i.e. the number of microservices) when using graph neural networks for microservice decomposition, thereby improving the quality of microservice decomposition results and the degree of automation in the microservice decomposition process.
[0053] 2. When optimizing the model, a method is proposed to convert the microservice decomposition schemes corresponding to the optimal values of different concerns into a matrix, and to perform cross-supervision on the model accordingly. This method enables the model to better focus on different concerns in the microservice decomposition process and obtain a more comprehensive microservice decomposition result. Attached Figure Description
[0054] Figure 1 This is a flowchart of a microservice decomposition method based on depth graph reconstruction according to an embodiment of the present invention;
[0055] Figure 2 This is a schematic diagram of the diagram reconstruction process in an embodiment of the present invention;
[0056] Figure 3 This is a schematic diagram of the microservice decomposition results in an embodiment of the present invention.
[0057] Figure 4 This is a schematic diagram illustrating the results of microservice decomposition using the COGCN method in an embodiment of the present invention.
[0058] Figure 5 This is a schematic diagram illustrating the microservice decomposition results of the GDC-DVF method in an embodiment of the present invention. Detailed Implementation
[0059] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be noted that the embodiments described below are intended to facilitate the understanding of the present invention and do not constitute any limitation thereof.
[0060] like Figure 1 As shown, a microservice decomposition method based on depth graph reconstruction includes the following steps:
[0061] The first step is to treat the classes in a monolithic application as nodes in a graph and use an adjacency matrix to represent the relationships between the classes in the graph.
[0062] Treating classes in a monolithic application as nodes in a graph, denoted as C = {C1, C2, C3, ..., C}. N}, where N represents the number of classes in the monolithic application C, C i This represents the i-th class.
[0063] Using adjacency matrices to represent relationships in a graph, construct adjacency matrices for the following four types of relationships: A C A I A B A D .
[0064] 1. Calling relationships between classes (A) C A C Used to describe the calling relationships between classes in a target monolithic application, when C i and C j When there is a calling relationship between A and B, let A C [i][j]=A C [j][i] = 1, otherwise A C [i][j]=A C [j][i] = 0.
[0065] 2. Inheritance relationships between classes (A) I A I Used to describe the inheritance relationships between classes in a target monolithic application, when C i and C j When an inheritance relationship exists, let A I [i][j]=A I [j][i] = 1, otherwise A I [i][j]=A I [j][i] = 0.
[0066] 3. The correspondence between classes and business logic (A) B When C i and C j When they belong to the same business, let A B [i][j]=A B [j][i] = 1, otherwise A B [i][j]=A B [j][i] = 0.
[0067] 4. The correspondence between classes and external resources (A) D When C i and C jAccessing the same external resource (such as a database, file, etc.) causes A to... D [i][j]=A D [j][i] = 1, otherwise A D [i][j]=A D [j][i] = 0.
[0068] Among them, A C A I A B A D All belong to {0,1} N*N , which is an N*N matrix with values of 0 or 1.
[0069] The second step is to obtain the representation vector of the single application.
[0070] In this phase, classes in a monolithic application are embedded into representation vectors. The main idea is to make classes that are frequently called by each other as close as possible in the vector space.
[0071] First, an embedding representation vector is randomly generated for each class using a neural network, i.e., {v1, v2, v3, ..., v...}. N}, where v i For the i-th class C i The embedding vector representation of v, where v i ∈R D , representing v i Let v be a D-dimensional real vector. D needs to be defined in advance, typically 84. N is the total number of classes to be extracted in the target monolithic application. When optimizing v, for any two classes C in the target monolithic application... i and C j First, calculate C. i and C j The joint probability distribution, i.e.:
[0072]
[0073] The above equation defines a joint probability distribution p1(C) in an N*N space by calculating the similarity of the embedded vectors. i C j Then, the empirical probability distribution in the N*N space is calculated, i.e.:
[0074]
[0075] Among them W ij Let C be the weight between node i and node j in the weighted graph. i Calling class C j The number of iterations during iterative training is determined by minimizing the joint probability distribution p1(C). iC j ) and empirical probability distribution The difference between them is used to optimize the embedding representation vector v, that is, to minimize the value calculated by the following formula:
[0076]
[0077] The above method ensures that the embedding vectors of two frequently accessed classes are as similar as possible. Then, based on the calculated loss, the representation vectors are automatically trained and updated via backpropagation. Once training converges, the representation vectors of all classes are concatenated in order, denoted as V, where V∈R. N×D V is an N*D dimension real vector, which serves as the feature vector representing the target single application.
[0078] The third step is to define the single-entity application graph G = (V, AC, A) I A B A D ).
[0079] The fourth step is to construct and train a depth map reconstruction model.
[0080] The graph reconstruction process is as follows: Figure 2 As shown, a gated graph neural network (GGNN) is first introduced to learn various relationships in graph G. The GGNN uses a gating mechanism to control information transmission between nodes. By learning the gating weights, the GGNN can effectively handle long-range dependencies between nodes in the graph, capture global information about the nodes, and retain important contextual information during information transmission. The operation of the GGNN is defined as follows:
[0081] V (k+1) =GGNN(A,V (k) ,W,U)
[0082]
[0083] in
[0084] In the above formula, V (k) Let W and U be the feature vectors of the input graph, respectively. Both W and U are parameters that can be learned during the optimization process. ⊙ represents element-wise multiplication. σ is the sigmoid function; it is used to reduce numerical instability and gradient explosion during computation. This is the adjacency matrix A after Laplace normalization. φ is a non-linear activation function.
[0085] Based on the definition above, we obtain the vector representations of the four relationships after passing through the gated graph neural network:
[0086] Call relationship:
[0087] Inheritance:
[0088] Business correspondence:
[0089] External resource mapping:
[0090] Where l represents the number of layers in the gated graph neural network for each relation; typically, l is set to 2, and V (l) This is the result vector obtained after passing through the l-th layer of the GGNN. Initially,
[0091] A semantic-level attention mechanism is used to aggregate the result vectors of the four relations obtained after passing through the gated graph neural network, to obtain the final vector V that integrates and learns multiple relations. Final In this process, the attention weight for each outcome must first be determined based on its importance, as shown below:
[0092] e ij =a T ([(KV i +b)‖(KV j +b)])
[0093]
[0094]
[0095] Where K is the weight matrix, b is the noise vector, a is the semantic-level attention mechanism, and ω ij Let V be the attention weight between the i-th and j-th vectors. By using the learned weights as coefficients, the resulting embedding vectors can be fused together to obtain the final embedding V. Final The details are as follows:
[0096]
[0097] Multilayer perceptrons (MLPs) can achieve nonlinear mapping of input data through a series of linear transformations and nonlinear activation functions. Through the MLP, V... Final Converted to graph reconstruction, adjacency matrix A Re As shown below:
[0098] A Re =MLP(V Final )
[0099] Where A Re ∈RN×N A Re The values of [i][j] represent the weights of the edges connecting class i and class j after the graph G is reconstructed.
[0100] During optimization, the following results are obtained: 1. The result of splitting based on optimal business concentration, denoted as best_bcp; 2. The result of splitting based on minimum communication cost, denoted as best_icp; 3. The result of splitting based on optimal cohesion, denoted as best_coh; 4. The microservice splitting result based on optimal coupling, denoted as best_cou. In practical implementation, other microservice splitting results with different focuses can also be added to meet different needs, and the above microservice splitting results are converted into a graph. The main idea of the conversion method is as follows: If class i and class j are split into the same microservice in a certain result, then they are connected pairwise in the corresponding graph. The corresponding graph is then converted into an adjacency matrix.
[0101] The adjacency matrix results obtained above are denoted as A. best_bcp A best_icp A best_cou A best_coh Based on this, the adjacency matrix A of the output reconstructed graph is... Re Cross-supervision is performed to calculate the loss, and the loss calculation method is as follows:
[0102]
[0103] Loss=α*MSE(A best_bcp A Re )+β*MSE(A best_icp A Re )
[0104] +γ*MSE(A best_coh A Re )+η*MSE(A best_cou A Re )
[0105] Here, α, β, γ, and η are pre-defined hyperparameters used to adjust the degree of attention given to different concerns during microservice decomposition. By default, α = β = γ = η = 1. When calculating the loss, different initialization values or the introduction of more target schemes can be used for cross-supervision to address the different needs encountered during microservice extraction.
[0106] After calculating the loss, backpropagation is performed based on the loss to update the parameters in the neural network until the loss converges, thus obtaining a trained model.
[0107] Step 5: Microservice decomposition.
[0108] After obtaining the trained model, collect the adjacency matrix A of the reconstructed graph output by the model. Re Based on this, the functional boundaries of the target monolithic application are identified and defined.
[0109] First, each node in the graph is initialized as an independent partition. Then, partitions are merged through iterative optimization until the optimal modularity is reached. The modularity is defined as:
[0110]
[0111] In the above formula g i Representative class C i For the partition to which it belongs, δ(u,v) equals 1 when u = v, and equals 0 otherwise.
[0112] In each iteration, the algorithm attempts to update the community label of the current node with the partition labels of its neighboring nodes to calculate the modularity gain after merging the current node with its neighboring nodes. Then, it selects the node with the largest modularity gain for merging. In this way, closely related classes in the target monolithic application are gradually grouped into the same partition, while loosely related classes may form independent partitions, thus forming the optimal microservice splitting method without needing to predefine the number of partitions.
[0113] Taking the open-source monolithic application acmeair as an example, acmeair contains 28 classes. The method of this invention is used to decompose acmeair, and the resulting diagram is shown below. Figure 3 As shown.
[0114] Since COGCN and GDC-DVF manually set the number of partitions (i.e., the number of microservices), when using the existing COGCN and GDC-DVF for microservice splitting, the number of partitions is set to 4. A diagram illustrating the results obtained with COGCN is shown below. Figure 4 As shown in the diagram. A schematic diagram of the results obtained by GDV-DCF is shown below. Figure 5 As shown.
[0115] from Figure 3 , Figure 4 , Figure 5 As can be seen, this invention not only avoids manually setting the number of partitions, but also effectively avoids extreme partitioning, where multiple microservices contain only one class, such as... Figure 5The GDC-DVF microservice decomposition scheme shown in the diagram contains only one class in both the second and third microservices. Compared to the other two methods, this invention also effectively reduces the communication cost between microservices, increases the cohesion within microservices, and reduces the coupling between microservices.
[0116] The embodiments described above provide a detailed explanation of the technical solutions and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, additions, and equivalent substitutions made within the scope of the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A microservice decomposition method based on depth graph reconstruction, characterized in that, Includes the following steps: (1) Treat the classes in a singleton application as nodes in a graph, denoted as C = {C1, C2, C3, ..., C}. N }, where N represents the number of classes in the monolithic application C, and C i This represents the i-th class. Using four adjacency matrices A C A I A B A D This represents the relationship between classes in the diagram, where A C Indicates the calling relationship between classes, A I Indicates the inheritance relationship between classes, A B This represents the correspondence between classes and business logic, A. D This indicates the correspondence between a class and external resources; (2) Embed the classes in the monolithic application into representation vectors so that classes that are frequently called by each other are close in the vector space; and concatenate the representation vectors of all classes in order to form the feature vector V representing the target monolithic application. (3) Define the graph of the single application as: G = (V, A) C A I A B A D ); (4) Construct and train a depth map reconstruction model, the structure of which is as follows: A gated graph neural network is introduced to learn multiple different relations in graph G, obtaining four types of relations A. C A I A B A D The result vector representation after passing through the gated graph neural network; a semantic-level attention mechanism is used to aggregate the result vectors of the four relations to obtain the final vector V that integrates and learns multiple relations. Final ; and through a multilayer perceptron (MLP) to convert V Final Converted to the graph reconstruction adjacency matrix A Re ; (5) For the single application to be split, collect the adjacency matrix A of the reconstructed graph output by the depth graph reconstruction model. Re Based on this, the functional boundaries of the target monolithic application are identified and defined, and multiple microservices are obtained by splitting it.
2. The microservice decomposition method based on depth graph reconstruction according to claim 1, characterized in that, In step (1), four adjacency matrices A are used. C A I A B A D The diagram shows the specific relationships between classes. include: A C This represents the calling relationship between classes in the target monolithic application, when the i-th class C i and the j-th class C j When there is a calling relationship between A and B, let A C [i][j]=A C [j][i] = 1, otherwise A C [i][j]=A C [j][i] = 0; A I This represents the inheritance relationship between classes in a target monolithic application, when C... i and C j When an inheritance relationship exists, let A I [i][j]=A I [j][i] = 1, otherwise A I [i][j]=A I [j][i] = 0; A B This represents the correspondence between classes and business logic. When C... i and C j When they belong to the same business, let A B [i][j]=A B [j][i] = 1, otherwise A B [i][j]=A B [j][i] = 0; A D This represents the correspondence between a class and external resources. When C... i and C j Accessing the same external resource caused A D [i][j]=A D [j][i] = 1, otherwise A D [i][j]=A D [j][i] = 0.
3. The microservice decomposition method based on depth graph reconstruction according to claim 2, characterized in that, A C A I A B A D All belong to {0,1} N*N , which is an N*N matrix with values of 0 or 1.
4. The microservice decomposition method based on depth graph reconstruction according to claim 1, characterized in that, The specific process of step (2) is as follows: First, an embedding representation vector is randomly generated for each class using a neural network, i.e., {v1, v2, v3, ..., v...}. N }, where v i For the i-th class C i The embedding vector representation, v i ∈R D , representing v i It is a D-dimensional real vector; When optimizing v, for any two classes C in the target monolithic application... i and C j First, calculate C. i and C j The joint probability distribution p1(C) in space N*N i C j Then, the empirical probability distribution in the N*N space is calculated. By minimizing the joint probability distribution p1(C) i C j ) and empirical probability distribution The difference between them is used to optimize the embedding representation vector v, so that the embedding vectors of two classes that are frequently called by each other are as similar as possible; Then, based on the calculated loss, the representation vector is automatically trained and updated through backpropagation; Once training has converged, the representation vectors of all classes are concatenated in order, denoted as V, where V∈R. N×D V is an N*D dimension real vector, which serves as the feature vector representing the target single application.
5. The microservice decomposition method based on depth graph reconstruction according to claim 4, characterized in that, In step (4), the operation of the gated graph neural network is defined as follows: V (k+1) =GGNN(A,V (k) ,W,U) in In the formula, V (k) The input graph is the feature vector, W and U are parameters learned during the optimization process, ⊙ represents the element-wise multiplication operation, and σ is the sigmoid function. φ is the result of Laplace normalization of the adjacency matrix A, and φ is a non-linear activation function; According to the definition above, we obtain A respectively. C A I A B A D The vector representations of the four relationships after passing through a gated graph neural network: Where l represents the number of layers in the gated graph neural network for each relation.
6. The microservice decomposition method based on depth graph reconstruction according to claim 5, characterized in that, In step (4), the specific process of aggregating the result vectors of the four relations using a semantic-level attention mechanism is as follows: First, the attention weights corresponding to each result are obtained based on their importance, as shown below: E ij =a T ([(KV i +b)‖(KV j +b)]) Where K is the weight matrix, b is the noise vector, a is the semantic-level attention mechanism, and ω ij Let V be the attention weight between the i-th and j-th vectors; by using the learned weights as coefficients, the resulting embedding vectors are fused together to obtain the final embedding V. Final The details are as follows:
7. The microservice decomposition method based on depth graph reconstruction according to claim 6, characterized in that, In step (4), the Multilayer Perceptron (MLP) performs a series of linear transformations and nonlinear activation functions to achieve a nonlinear mapping of the input data, transforming V... Final Converted to the graph reconstruction adjacency matrix A Re .
8. The microservice decomposition method based on depth graph reconstruction according to claim 7, characterized in that, In step (4), the training process of the depth map reconstruction model is as follows: Obtain the results of the split based on the optimal degree of business concentration, denoted as best_bcp; the split based on the lowest communication cost, denoted as best_icp; the split based on the optimal degree of cohesion, denoted as best_coh; and the microservice split based on the optimal degree of coupling, denoted as best_cou. Convert the above microservice decomposition results into a graph, and then convert the corresponding graph into an adjacency matrix, denoted as A. best_bcp A best _icp A best_coh A best_cou Based on this, the adjacency matrix A of the output reconstructed graph is... Re Cross-supervision is performed to calculate the loss; after the loss is calculated, backpropagation is performed based on the loss to update the parameters in the neural network until the loss converges, and the trained model is obtained.
9. The microservice decomposition method based on depth graph reconstruction according to claim 7, characterized in that, In step (5), the functional boundaries of the target monolithic application are identified and defined, and the specific process of decomposing it into multiple microservices is as follows: First, each node in the graph is initialized as an independent partition. Then, partitions are merged through iterative optimization until the optimal modularity is reached. The modularity is defined as: In the formula, g i Representative class C i The partition to which it belongs, g j Representative class C j For the partition to which it belongs, δ(u,v) equals 1 when u = v, and equals 0 otherwise; In each iteration, we attempt to update the partition label of the current node to the partition label of its neighboring nodes in order to calculate the modularity gain of the current node after merging with its neighboring nodes. Then, we select the node with the largest modularity gain to merge. In this way, closely related classes in the target monolithic application will gradually be grouped into the same partition, while loosely related class nodes will form independent partitions, thus forming the optimal microservice splitting method.
Citation Information
Patent Citations
System and computer-implemented method for upgrading and / or updating at least one service of a plurality of services
EP4303723A1