Cloud computing microservice partitioning method and system based on business demand data flow graph

By using a method based on the business requirements data flow diagram, microservices are automatically divided, which solves the problem of unreasonable microservice division in the existing technology and achieves high-quality, cohesive microservice division, which is suitable for cloud environments.

CN114385576BActive Publication Date: 2024-08-27TONGJI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111568979.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2024-08-27
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

The existing technology lacks an automated microservice division method that does not require system historical information, resulting in unreasonable microservice division and affecting the performance of the containerized microservice system.

Method used

Adopt a method based on the business requirements data flow graph, by obtaining the data flow graph, merging the underlying data flow graph, eliminating storage nodes, changing to undirected edges for breadth-first traversal, searching for loop paths, calculating similarity and length, and performing path fusion. With segmentation, divide microservices.

Benefits of technology

It achieves high-quality microservice division, ensures business cohesion, avoids microservices with excessive granularity, reduces duplication of functions, and is suitable for cloud environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114385576B
    Figure CN114385576B
Patent Text Reader

Abstract

The present invention relates to a cloud computing microservice partitioning method and system based on a business demand data flow graph, the method comprising: obtaining a data flow graph, merging the underlying data flow graphs corresponding to the data flow graph to form an overall fully connected data flow graph, eliminating storage nodes in the fully connected data flow graph; changing all directed edges in the fully connected data flow graph to undirected edges, and then performing a breadth-first traversal of the graph to obtain a number of connected subgraph sets; adding the eliminated storage nodes and directed edges to each connected subgraph set, and then searching for loop paths in each connected subgraph set to obtain a data path set; partitioning microservices according to the data path set to obtain a candidate microservice set for the partitioning of microservices. Compared with the prior art, the present invention ensures the business cohesion of the partitioned microservices, and at the same time, does not have microservices with excessive granularity, and can minimize the repeated implementation of functions in microservices, and the partitioning quality is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of microservice partitioning technology, and in particular to a cloud computing microservice partitioning method and system based on a business demand data flow graph. Background Art

[0002] Cloud computing services represent the trend of the current IT industry to develop rapidly towards scale, intensification and specialization. They can further reduce IT service costs and improve the effective utilization of IT resources. Therefore, they are recognized as the third wave of IT revolution and have huge market prospects and social value. The key technology of cloud computing is containerized microservice architecture, which has the advantages of easy development and maintenance, fast startup of single microservices, flexible deployment, convenient testing, unlimited technology stack, easy on-demand scaling, and high system fault tolerance. Therefore, more and more cloud computing systems are migrating to containerized microservice architecture. When developing with containerized microservice architecture, it is necessary to first divide the software services reasonably. By controlling the granularity of the services, finding the reasonable boundaries of each service and reducing the communication volume between services, the containerized microservice system can play its advantages in practical applications. The performance of a microservice architecture system with unreasonable division is even worse than that of a system directly implemented with a monolithic architecture. Looking at the existing microservice division methods, the industry generally uses manual experience-based division, or combines domain-driven design to divide microservices, linking the division of microservices with demand analysis; the academic community generally uses static code analysis or historical data analysis under a monolithic application structure. The former determines the division of microservices by analyzing factors such as module code length and calling relationships between modules, while the latter divides by analyzing factors such as inter-module communication volume and module update records under a monolithic architecture. In summary, the industry currently lacks a microservice division method that can be automated and does not require system historical information. Summary of the invention

[0003] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and to provide a general, effective and high-quality cloud computing microservice partitioning method and system based on business demand data flow graph.

[0004] The purpose of the present invention can be achieved by the following technical solutions:

[0005] A cloud computing microservice partitioning method based on a business demand data flow graph comprises the following steps:

[0006] Obtain a data flow graph, merge the underlying data flow graph corresponding to the data flow graph to form an overall fully connected data flow graph, and eliminate storage nodes in the fully connected data flow graph;

[0007] Change all directed edges in the fully connected data flow graph to undirected edges, and then perform a breadth-first traversal of the graph to obtain several connected subgraph sets;

[0008] Add the eliminated storage nodes and directed edges to each connected subgraph set, and then search for loop paths in each connected subgraph set to obtain a data path set;

[0009] Microservices are divided according to the data path set to obtain a candidate microservice set for dividing microservices.

[0010] Furthermore, the method also includes: calculating the similarity between two loop paths, and if the similarity reaches a preset similarity threshold, performing path fusion on the two loop paths, thereby dividing the microservices.

[0011] Furthermore, the method also includes: determining the length of the loop path, and if the length is greater than a preset length threshold, segmenting the loop path, thereby dividing the microservices.

[0012] Furthermore, the search for the loop path is specifically as follows:

[0013] For a loop path between two nodes, the loop path is directly added to the data path set and the search process continues;

[0014] For a path with more than three nodes forming a ring, the entire ring portion is added as a data path to the data path set, and the search process ends.

[0015] Furthermore, in the process of dividing microservices according to the data path set, the data communication level and data flow length level of each path in the data path set are used as the weight of the edge to achieve the division of microservices.

[0016] The present invention also provides a cloud computing microservice partitioning system based on a business demand data flow graph, comprising:

[0017] A fully connected data flow graph acquisition module is configured to acquire a data flow graph, merge the underlying data flow graphs corresponding to the data flow graph to form an overall fully connected data flow graph, and eliminate storage nodes in the fully connected data flow graph;

[0018] A connected subgraph search module is configured to change all directed edges in the fully connected data flow graph into undirected edges, and then perform a breadth-first traversal of the graph to obtain a plurality of connected subgraph sets;

[0019] The data path search module is configured to add the eliminated storage nodes and directed edges to each connected subgraph set, and then search for a loop path in each connected subgraph set to obtain a data path set;

[0020] The microservice partitioning module is configured to partition the microservices according to the data path set to obtain a candidate microservice set for partitioning the microservices.

[0021] Furthermore, the microservice division module is also configured to: calculate the similarity between two loop paths, and if the similarity reaches a preset similarity threshold, merge the two loop paths to divide the microservices.

[0022] Furthermore, the microservice division module is also configured to: determine the length of the loop path, and if the length is greater than a preset length threshold, segment the loop path, thereby dividing the microservices.

[0023] Furthermore, the search for the loop path is specifically as follows:

[0024] For a loop path between two nodes, the loop path is directly added to the data path set and the search process continues;

[0025] For a path with more than three nodes forming a ring, the entire ring portion is added as a data path to the data path set, and the search process ends.

[0026] Furthermore, in the process of dividing microservices according to the data path set, the data communication level and data flow length level of each path in the data path set are used as the weight of the edge to achieve the division of microservices.

[0027] Compared with the prior art, the present invention has the following advantages:

[0028] (1) The present invention uses a data flow graph as input, selects the underlying data flow graph for merging, and obtains microservices with appropriate granularity; when performing microservice division, it is necessary to merge the underlying data flow graph. After the merger, since the data path between two external entities passing through the storage node can be regarded as two data paths, that is, each processing flow will not contain the storage node, the storage node is temporarily deleted; at the same time, in the data flow graph, the data flow has directionality. When considering the relationship between two functional nodes, microservice division focuses more on the connection between functional nodes. Therefore, the direction between nodes is temporarily ignored to achieve the acquisition of the connected subgraph set; subsequently, the storage node and the directed edge are added to obtain the data path set for the division of microservices;

[0029] The method of the present invention can fully consider the functional characteristics and business boundaries of the system, ensure the business cohesion of the microservices of the division result, and at the same time, prevent the occurrence of microservices with too large granularity, and can minimize the repeated implementation of functions in microservices, so that the division quality is high.

[0030] (2) The present invention uses the data flow graph as input, eliminating the limitation of the technology stack and being universal and effective.

[0031] (3) The present invention innovatively proposes to use the business requirement data flow diagram as the basis for microservice division and focuses on the data flow path between external entities as a microservice. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A microservice partitioning process diagram based on a data flow graph provided in an embodiment of the present invention;

[0033] Figure 2 This is a bottom-level data flow diagram of an ERP system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0035] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0036] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0037] Example 1

[0038] Software development generally goes through multiple stages such as problem definition, requirements analysis, software design, software testing, operation and maintenance, and the division of microservices is in the software analysis and design stage. Software analysis and design are crucial to meeting the functional and performance requirements of software, and data flow diagrams are the most commonly used method for software requirements analysis and the basis of process-oriented programming. In particular, data flow diagrams focus on functional logic, which is the same as the focus of microservice architecture. In the microservice architecture, the calls between multiple microservices corresponding to a business logic also form a directed graph. Each microservice, as a node of the directed graph, involves a part of the business logic. Therefore, the division of microservices is also based on logical functions as the main factor, so data flow diagrams are very suitable as the basis for microservice division.

[0039] Therefore, this embodiment proposes a cloud computing microservice partitioning method based on a business demand data flow graph, which analyzes the data flow paths between connected external entities on the data flow graph, comprehensively considers the types of nodes on the data flow paths and the communication volume of the edges, and merges and divides these data flow paths to ensure the business cohesion of microservices while avoiding the emergence of microservices with too large granularity and minimize the repeated implementation of business functions in microservices. Ultimately, it is hoped to provide software designers with fine-grained, highly business-cohesive microservices suitable for cloud environments.

[0040] The cloud computing microservice partitioning method based on the business demand data flow diagram includes the following steps:

[0041] Obtain a data flow graph, merge the underlying data flow graph corresponding to the data flow graph to form an overall fully connected data flow graph, and eliminate storage nodes in the fully connected data flow graph;

[0042] Change all directed edges in the fully connected data flow graph to undirected edges, and then perform a breadth-first traversal of the graph to obtain several connected subgraph sets;

[0043] Add the eliminated storage nodes and directed edges to each connected subgraph set, and then search for loop paths in each connected subgraph set to obtain a data path set;

[0044] Microservices are divided according to the data path set to obtain a candidate microservice set for dividing microservices.

[0045] The search for a loop path is as follows:

[0046] For a loop path between two nodes, the loop path is directly added to the data path set and the search process continues;

[0047] For a path with more than three nodes forming a ring, the entire ring portion is added as a data path to the data path set, and the search process ends.

[0048] Treat all processing nodes of each data path in the data path set as a microservice.

[0049] As a preferred implementation, the method further includes: calculating the similarity between two loop paths, and if the similarity reaches a preset similarity threshold, merging the two loop paths to divide the microservices.

[0050] As a preferred implementation, the method further includes: determining the length of the loop path, and if the length is greater than a preset length threshold, segmenting the loop path, thereby dividing the microservices.

[0051] As a preferred implementation, in the process of dividing microservices according to a data path set, the data communication level and data flow length level of each path in the data path set are used as edge weights to achieve the division of microservices.

[0052] The method is described in detail below.

[0053] The division of microservices requires determining the appropriate division granularity. If each processing unit in the top-level data flow graph is used as a microservice, the microservice architecture degenerates into a monolithic architecture; if each processing unit in the bottom-level data flow graph is used as a microservice, the granularity of the microservice is too small, the call chain is too long and the relationship is complex, the system communication overhead is large and the response is slow; if each processing unit in the middle-level data flow graph is used as a microservice, the characteristic requirements of the microservice are not considered when constructing the data flow graph, which will cause the mapped microservice granularity to be sometimes too large and sometimes too small.

[0054] Therefore, only by merging the underlying processing units can we obtain microservices with appropriate granularity. In actual business, the software service system is an information input and output system, and the input and output ends are described as external entities in the data flow diagram. For a complete business, two external entities, input and output, are generally involved. If multiple external entities are involved, the business can be divided into multiple businesses by adding appropriate storage nodes. Therefore, the data path between the two external entities is analyzed to form a microservice, which can make the microservice meet business cohesion.

[0055] The method of the present invention aims to meet the cohesion of microservices and reduce the amount of data communication between microservices. The former is ensured by finding the data flow path between external entities and the fusion and segmentation of the data flow path, and the latter is achieved by conditional judgment during fusion and segmentation. The complete division process is as follows Figure 1 As shown:

[0056] 1) Preprocess the business demand data flow graph, merge the underlying data flow graph according to the characteristics of the data flow graph, eliminate the storage nodes, and analyze the connectivity to obtain multiple connected subgraphs;

[0057] 2) Find the data flow path between any two external entities in each connected subgraph;

[0058] 3) All data flow paths in each connected subgraph are uniformly segmented or merged;

[0059] 4) Split or merge the processed data flow paths in all connected subgraphs;

[0060] 5) Consider the processing nodes that interact with the storage nodes in the data flow graph separately, analyze them independently, and then output the data flow path. All processing nodes on a path are regarded as a microservice.

[0061] The division process of this embodiment is specifically as follows:

[0062] For a data flow graph G, its underlying data flow graph G x May contain several subgraphs According to the characteristics of the data flow graph, it is divided by the top-level and middle-level data flow graphs, so that these subgraphs are not connected. Since the microservice architecture system has the characteristic of vertical boundaries, and this characteristic is not considered when constructing the data flow graph, a microservice may span multiple subgraphs in the underlying data flow graph. Therefore, when performing microservice division, it is necessary to merge the underlying data flow graphs. After the merger, since the data path between two external entities passing through the storage node can be regarded as two data paths, that is, each processing flow will not contain a storage node. At the same time, the data flow in the data flow graph is directional. When considering the relationship between two functional nodes, microservice division pays more attention to the connection between functional nodes. Therefore, it is necessary to obtain the fully connected data flow graph G after the merger. x ′, change all directed edges into undirected edges, and temporarily delete G x ′ and its adjacent edges, and then traverse the graph in breadth-first order to obtain a set of connected subgraphs. Finally, according to G x ′, add the previously deleted storage nodes back to each connected subgraph, and convert the undirected edges back to directed edges.

[0063] When obtaining the data paths between two external entities in the business demand data flow graph, the depth-first traversal method can be used. For the problem of directed edge loops, since the division of microservices needs to follow the principle of business cohesion, and the probability that the nodes in the loop are in the same business is high, if there is a loop between two nodes, the path is directly added and the depth search continues; if there are three or more nodes in the loop, the loop part is added as a data path to W. xy In order to process it in the subsequent processing flow fusion and segmentation, and stop the deep search, finally get the data path set W xy .

[0064] Since the data path set W xy There are a lot of similar elements in the code. If all the elements are used as microservices, the code reuse rate will be too low, which is not conducive to efficient development. xy Some elements in W are too long. If they are directly used as a microservice, the granularity of this microservice will be large. xy The elements in the , are merged or split to reduce the number of similar and long processing flows, and the candidate microservice set W is obtained. xy'. In summary, this patent designs a microservice partitioning algorithm (BFMP) based on a normal processing flow. The corresponding algorithm pseudo code is as follows:

[0065] Input: Business requirement data flow diagram G x (Where V cho is the set of branch nodes, V o is the set of external entity nodes, V s is a storage node, A is the edge set in the graph, is the set of reverse edges of the edges in the graph, V cho is the set of branch nodes, V sc To store interactive nodes);

[0066] Output: the divided microservice set W;

[0067]

[0068] 2. Develop software tools

[0069] The above BFMP algorithm is used as a detailed design scheme, and a software tool is developed through C# programming and Visual Studio 2017 development environment. For the input of the business demand data flow diagram, a graphic editing tool is used to enter the input document. The graphical input interface provides external entity nodes, branch nodes, storage interaction nodes, storage nodes, and data flow annotations, allowing users to independently draw the data flow diagram of business needs and mark the data flow on the data flow. After the BFMP software tool is executed, the microservice division results automatically obtained are saved in an Excel file.

[0070] 3. Application examples

[0071] For the production and warehouse management services of the cloud ERP system, the business demand data flow diagram is as follows Figure 2 As shown (wherein the light gray nodes are storage interaction nodes, the dark gray nodes are branch nodes, the edge Fre value is the data flow frequency level, and the A value is the data flow length level), using the method of the present invention, the microservice division result finally obtained in this example is: ([P9, P10], [P1, P2, P3], [P4, P6, P7, P8], [P5], [P11], [P12]), that is, the process completion record and the task completion record together constitute a microservice; item attribute maintenance, item code maintenance, and warehouse code maintenance together constitute a microservice; production processing, material application, material outbound management, and inventory material query together constitute a microservice; material procurement requirements, warehousing data updates, and material processing are each independent microservices. From Figure 2It can be found that all data processing nodes have been divided into different microservices, which shows that the division result is correct. At the same time, the division result has high business cohesion and less repeated implementation of functional nodes, indicating that the microservice result divided by the method of the present invention is of high quality.

[0072] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.

Claims

1. A cloud computing microservice partitioning method based on a business demand data flow graph, characterized in that: The following steps are involved: Obtain a data flow graph, merge the underlying data flow graph corresponding to the data flow graph to form an overall fully connected data flow graph, and eliminate storage nodes in the fully connected data flow graph; Change all directed edges in the fully connected data flow graph to undirected edges, and then perform a breadth-first traversal of the graph to obtain several connected subgraph sets; Add the eliminated storage nodes and directed edges to each connected subgraph set, and then search for loop paths in each connected subgraph set to obtain a data path set; Divide microservices according to the data path set to obtain a candidate microservice set for dividing microservices; The method further includes: calculating the similarity between two loop paths, and if the similarity reaches a preset similarity threshold, merging the two loop paths to divide the microservices; The method further includes: determining the length of the loop path, and if the length is greater than a preset length threshold, segmenting the loop path, thereby dividing the microservices; In the process of dividing microservices according to the data path set, the data communication level and data flow length level of each path in the data path set are used as the weight of the edge to achieve the division of microservices.

2. According to claim 1, a cloud computing microservice partitioning method based on a business demand data flow graph is characterized in that: The search for the loop path is specifically as follows: For a loop path between two nodes, the loop path is directly added to the data path set and the search process continues; For a path with more than three nodes forming a ring, the entire ring portion is added as a data path to the data path set, and the search process ends.

3. A cloud computing microservice partitioning system based on business demand data flow graph, characterized in that: include: A fully connected data flow graph acquisition module is configured to acquire a data flow graph, merge the underlying data flow graphs corresponding to the data flow graph to form an overall fully connected data flow graph, and eliminate storage nodes in the fully connected data flow graph; A connected subgraph search module is configured to change all directed edges in the fully connected data flow graph into undirected edges, and then perform a breadth-first traversal of the graph to obtain a plurality of connected subgraph sets; The data path search module is configured to add the eliminated storage nodes and directed edges to each connected subgraph set, and then search for a loop path in each connected subgraph set to obtain a data path set; The microservice partitioning module is configured to partition the microservices according to the data path set to obtain a candidate microservice set for partitioning the microservices; The microservice division module is further configured to: calculate the similarity between two loop paths, and if the similarity reaches a preset similarity threshold, merge the two loop paths to divide the microservices; The microservice division module is further configured to: determine the length of the loop path, and if the length is greater than a preset length threshold, divide the loop path to divide the microservice; In the process of dividing microservices according to the data path set, the data communication level and data flow length level of each path in the data path set are used as the weight of the edge to achieve the division of microservices.

4. A cloud computing microservice partitioning system based on a business demand data flow graph according to claim 3, characterized in that: The search for the loop path is specifically as follows: For a loop path between two nodes, the loop path is directly added to the data path set and the search process continues; For a path with more than three nodes forming a ring, the entire ring portion is added as a data path to the data path set, and the search process ends.