Service orchestration method, device, microservice gateway device and storage medium

By building orchestration view and using deep search algorithm to analyze the dependencies of microservices, the problem that microservice gateways cannot integrate multiple microservices is solved, and efficient service orchestration and performance improvements are achieved.

CN116760904BActive Publication Date: 2025-08-26CHINA MERCHANTS BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310638673.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-31
Publication Date
2025-08-26
Estimated Expiration
2043-05-31

AI Technical Summary

Technical Problem

In the prior art, microservice gateways cannot effectively integrate multiple microservices, resulting in high communication and development costs and difficulty in ensuring the performance and stability of services.

Method used

By building an orchestration view based on user operations, using deep search algorithms to analyze the dependencies of microservices, obtain a hierarchical execution relationship, and configure parameter mapping relationships to realize service orchestration.

Benefits of technology

It improves the implementation efficiency of service orchestration, ensures the correct execution of business logic, improves the performance and stability of microservice gateways, and reduces development costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116760904B_ABST
    Figure CN116760904B_ABST
Patent Text Reader

Abstract

The present invention discloses a service orchestration method, apparatus, microservice gateway device and storage medium, and relates to the field of Internet product technology. The method includes: constructing an orchestration visual graph based on user operations, the orchestration visual graph including a directed acyclic graph in which multiple vertices represent multiple microservices respectively, and an arc connecting two vertices represents the dependency relationship between two microservices; searching the orchestration visual graph using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices, the hierarchical execution relationship including at least two microservice layers and the execution order of each microservice layer; configuring a parameter mapping relationship between the microservice layers where any two microservices with a dependency relationship are located; and obtaining a service orchestration result based on the execution order and the parameter mapping relationship. The present invention solves the problem that traditional microservice gateways cannot integrate multiple microservices, takes into account the high performance requirements of the gateway, and achieves the effect of improving the implementation efficiency of service orchestration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet product technology, and in particular to a service orchestration method, apparatus, microservice gateway device, and storage medium. Background Art

[0002] With the continuous development of internet services, the business functions of internet systems and internet products are becoming increasingly complex. Microservice product architecture and the establishment of microservice gateways have become an inevitable trend in system development. As the upstream of system traffic, microservice gateways not only handle the distribution of all external business traffic, but also need to meet the ever-expanding demand for resource integration.

[0003] Related technologies often require functional integration of multiple single services. This secondary development task not only consumes a large amount of communication and development costs, but also makes it difficult to guarantee service performance and stability. Therefore, there is currently no feasible solution for integrating multiple microservices on microservice gateway devices. Summary of the Invention

[0004] The main purpose of the present invention is to provide a service orchestration method, apparatus, microservice gateway device and storage medium, aiming to solve the technical problem in the prior art that the microservice gateway cannot integrate multiple microservices.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] In a first aspect, the present invention provides a service orchestration method, which is applied to a microservice gateway device, and the method includes:

[0007] Build an orchestration visualization graph based on user operations. The orchestration visualization graph includes a directed acyclic graph in which multiple vertices represent multiple microservices, and an arc connecting two vertices represents the dependency relationship between two microservices.

[0008] Search the orchestration visualization graph using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices. The hierarchical execution relationship includes at least two microservice layers and the execution order of each microservice layer.

[0009] Configure the parameter mapping relationship between any two microservices with dependencies in the microservice layer;

[0010] The service orchestration result is obtained based on the execution order and parameter mapping relationship.

[0011] Optionally, in the above service orchestration method, after the step of constructing an orchestration visualization diagram based on user operations, the method further includes:

[0012] Convert the orchestration visualization graph into a data structure. The data structure includes a one-dimensional array and an adjacency matrix. The one-dimensional array represents the microservice information stored in the vertex, and the adjacency matrix represents the dependency information stored in the arc.

[0013] By searching the orchestration visualization graph using a deep search algorithm, we can obtain the hierarchical execution relationships of multiple microservices, including:

[0014] The data structure is searched through a deep search algorithm to obtain the hierarchical execution relationship of multiple microservices.

[0015] Optionally, in the above service orchestration method, searching the orchestration visualization graph using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices includes:

[0016] Use the deep search algorithm to search the arrangement visibility graph and obtain all the paths corresponding to the arrangement visibility graph;

[0017] Determine the first-level information of multiple microservices based on all paths corresponding to the orchestration visualization graph;

[0018] According to the first-level information, the level of each microservice is determined, and the hierarchical execution relationship of multiple microservices is obtained.

[0019] Optionally, in the above service orchestration method, after the step of determining the first-level information of the plurality of microservices based on all paths corresponding to the orchestration visualization graph, the method further comprises:

[0020] For a target microservice having multiple first-level information, determining a maximum value among the multiple first-level information as the second-level information of the target microservice;

[0021] Based on the first-level information, the level of each microservice is determined, and the hierarchical execution relationship of multiple microservices is obtained, including:

[0022] According to the first-level information and the second-level information, the levels of a microservice having the first-level information and a target microservice having the second-level information are determined, and a hierarchical execution relationship of the multiple microservices is obtained.

[0023] Optionally, in the above service orchestration method, configuring a parameter mapping relationship between the microservice layers where any two microservices having a dependency relationship are located includes:

[0024] Determine the first microservice layer and the second microservice layer where the first microservice and the second microservice having a dependency relationship are located respectively;

[0025] Determine a parameter transfer scheme between the first microservice layer and the second microservice layer based on the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer;

[0026] Configure an input parameter search algorithm for all microservices in the second microservice layer. The input parameter search algorithm is used to match the target input parameters required by each microservice in the second microservice layer in the output message of the first microservice layer.

[0027] The parameter passing scheme and the input parameter search algorithm are determined as a parameter mapping relationship between the first microservice layer and the second microservice layer.

[0028] Optionally, in the above service orchestration method, determining a parameter transfer scheme between the first microservice layer and the second microservice layer based on parameter types of all microservices in the first microservice layer and parameter types of all microservices in the second microservice layer includes:

[0029] Using a pre-stored parameter type classification table, determine the parameter transfer scheme between the first microservice layer and the second microservice layer based on the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer; wherein the parameter type classification table includes parameter types and corresponding supported parameter transfer types.

[0030] Optionally, in the above service orchestration method, after the step of obtaining the service orchestration result according to the execution order and the parameter mapping relationship, the method further includes:

[0031] The service orchestration results are stored in a local cache, a remote server, and / or a remote database respectively.

[0032] In a second aspect, the present invention provides a service orchestration device, comprising:

[0033] A visualization configuration module is used to build an orchestration visualization graph based on user operations. The orchestration visualization graph includes a directed acyclic graph in which multiple vertices represent multiple microservices, and an arc connecting two vertices represents the dependency relationship between two microservices.

[0034] An execution order determination module is used to search the orchestration visualization graph using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices. The hierarchical execution relationship includes at least two microservice layers and the execution order of each microservice layer.

[0035] The mapping relationship configuration module is used to configure the parameter mapping relationship between any two microservice layers with dependency relationships;

[0036] The result output module is used to obtain the service orchestration results based on the execution order and parameter mapping relationship.

[0037] In a third aspect, the present invention provides a microservice gateway device, which includes a processor and a memory. The memory stores a service orchestration program. When the service orchestration program is executed by the processor, the service orchestration method as described above is implemented.

[0038] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by one or more processors, the service orchestration method as described above is implemented.

[0039] The above one or more technical solutions provided by the present invention may have the following advantages or at least achieve the following technical effects:

[0040] The present invention proposes a service orchestration method, device, microservice gateway device and storage medium. The method constructs an orchestration visual graph based on user operations, searches the orchestration visual graph through a deep search algorithm, obtains a hierarchical execution relationship of multiple microservices, and then configures a parameter mapping relationship between the microservice layers where any two microservices with a dependent relationship in the hierarchical execution relationship are located. Finally, the service orchestration result is obtained according to the execution order and parameter mapping relationship of each microservice layer in the hierarchical execution relationship, thereby achieving the purpose of visual orchestration and customized orchestration. The present invention constructs a directed acyclic graph in which multiple vertices represent multiple microservices respectively and an arc connecting two vertices represents the dependency relationship between two microservices, analyzes the execution order and hierarchy of microservices, ensures the correct execution of business logic, and customizes the configuration parameter mapping relationship between different hierarchies. It can take into account system performance, improve the implementation efficiency of service orchestration, and thus improve device performance. Therefore, the present invention solves the problem that traditional microservice gateways cannot integrate multiple microservices, while taking into account the high performance requirements of microservice gateways. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these provided drawings without paying any creative work.

[0042] Figure 1 This is a flow chart of the first embodiment of the service orchestration method of the present invention;

[0043] Figure 2 This is a schematic diagram of the hardware structure of the microservice gateway device involved in the present invention;

[0044] Figure 3 This is a visual diagram of the service arrangement method in the second embodiment of the present invention;

[0045] Figure 4 A schematic diagram of the hierarchical execution relationship in the second embodiment of the service orchestration method of the present invention;

[0046] Figure 5 This is a schematic diagram of the functional modules of the first embodiment of the service orchestration device of the present invention.

[0047] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION

[0048] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative work shall fall within the scope of protection of the present invention.

[0049] It should be noted that, in the present invention, the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprise..." does not preclude the presence of other identical elements in the process, method, article, or system comprising that element. Furthermore, the meaning of "and / or" appearing throughout this text includes three parallel solutions. For example, "A and / or B" includes solution A, solution B, or solutions where both A and B are satisfied. In the present invention, if there are descriptions involving "first," "second," etc., such descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined as "first" or "second" may explicitly or implicitly include at least one of such features. In the present invention, the use of suffixes such as "module", "component" or "unit" to represent elements is only for the purpose of facilitating the description of the present invention and has no specific meaning in itself. Therefore, "module", "component" or "unit" can be used interchangeably. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. In addition, the technical solutions of the various embodiments can be combined with each other, but this is based on the ability of those of ordinary skill in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0050] Analysis of related technologies reveals that some internet products often require functional integration of multiple single services. This secondary development task not only consumes significant communication and development costs, but also makes it difficult to guarantee service performance and stability. Consequently, there is currently no viable solution for integrating multiple microservices on microservice gateway devices.

[0051] Although some service orchestration methods executed on servers have emerged, if the service orchestration methods applied to servers are directly applied to microservice gateways, since the solutions applied to servers tend to ignore system performance while orchestrating services, directly applying them to microservice gateways for service orchestration will easily affect the performance of the service gateway.

[0052] Furthermore, frequent business changes lead to constant rollouts, increasing business risks. Multiple service modifications and changes also increase maintenance costs due to system coupling and code redundancy. Therefore, current service orchestration methods still have the problem of high costs.

[0053] In view of the technical problem in the prior art that a microservice gateway cannot integrate multiple microservices, the present invention provides a service orchestration method, apparatus, microservice gateway device and storage medium.

[0054] The service orchestration method, apparatus, microservice gateway device, and storage medium provided by the present invention are described in detail below with reference to the accompanying drawings through specific embodiments and implementation methods.

[0055] Example 1

[0056] Reference Figure 1 A flow chart of the present invention is provided, which proposes a first embodiment of the service orchestration method of the present invention, and the service orchestration method is applied to a microservice gateway device.

[0057] A microservices gateway device is a terminal device or network device that enables network connectivity. Acting as the backbone between clients and servers, it receives client requests and server responses, and performs tasks such as authentication, monitoring, load balancing, caching, request fragmentation and management, and static response processing.

[0058] like Figure 2 FIG2 is a schematic diagram of the hardware structure of a microservice gateway device. The microservice gateway device may include: a processor 1001, such as a CPU (Central Processing Unit), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005.

[0059] Specifically, the communication bus 1002 is used to realize the connection and communication between these components; the user interface 1003 is used to connect to the client and communicate data with the client. The user interface 1003 may include an output unit and an input unit; the network interface 1004 is used to connect to the server and communicate data with the server. The network interface 1004 may include an input / output interface; the memory 1005 is used to store various types of data, which may include, for example, instructions for any application or method in the microservice gateway device, as well as application-related data. The memory 1005 may be a built-in memory; optionally, the memory 1005 may also be a storage device independent of the processor 1001, and further reference is made to FIG. Figure 2 The memory 1005 may include an operating system, a network communication module, a user interface module, and a service orchestration program; the processor 1001 is configured to call the service orchestration program stored in the memory 1005 and perform the following operations:

[0060] Build an orchestration visualization graph based on user operations. The orchestration visualization graph includes a directed acyclic graph in which multiple vertices represent multiple microservices, and an arc connecting two vertices represents the dependency relationship between two microservices.

[0061] Search the orchestration visualization graph using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices. The hierarchical execution relationship includes at least two microservice layers and the execution order of each microservice layer.

[0062] Configure the parameter mapping relationship between any two microservices with dependencies in the microservice layer;

[0063] The service orchestration result is obtained based on the execution order and parameter mapping relationship.

[0064] Based on the above microservice gateway device, the following is combined Figure 1 The flow chart shown in the figure describes in detail the service arrangement method of this embodiment. The method may include the following steps:

[0065] Step S100: constructing an orchestration visual graph based on the user's operation. The orchestration visual graph includes a directed acyclic graph in which multiple vertices represent multiple microservices respectively, and an arc connecting two vertices represents a dependency relationship between two microservices.

[0066] Specifically, microservices is a software architecture used to effectively decompose applications and enable agile development and deployment. It divides a single application into a set of smaller services that coordinate and collaborate with each other to deliver ultimate value to users. Dependencies between multiple microservices mean that the data required by one microservice depends on the data obtained by another, or that one microservice must start after another has completed.

[0067] In specific applications, all data involved in the service orchestration process can be stored in the microservice gateway device. When the orchestrated service is executed on the microservice gateway device, the microservice can be called by sending requests to the microservice and receiving response feedback from the microservice.

[0068] Specifically, the orchestration visualization graph is constructed based on user operations. This can be achieved through user interaction with the input and output interfaces of the microservice gateway device, such as manual drawing. Multiple vertices represent corresponding microservices, and arcs between vertices represent the dependencies between microservices. The directed acyclic graph constructed from all vertices and corresponding arcs is the orchestration visualization graph. Using a directed acyclic graph, the orchestration visualization graph facilitates intuitive viewing of microservices and their dependencies.

[0069] In this embodiment, the dependency relationship between multiple microservices can be a parameter dependency relationship between two or more services. For example, the input parameters of service C depend on the parameters obtained by service A, service B, and service D, while the input parameters of service B depend on the parameters obtained by service A, and the input parameters of service D also depend on the parameters obtained by service A. In this case, dependency relationships exist between service A and service B, service A and service C, service A and service D, service B and service C, and service D and service C. A directed acyclic graph consisting of four vertices and five arcs can be obtained. The direction of the arc can be determined based on the dependency relationship of the previous service on which the current service depends, that is, an arrow pointing from the previous service to the current service is obtained as a directed arc between the two services.

[0070] Step S300: Search the orchestration visual graph using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices. The hierarchical execution relationship includes at least two microservice layers and the execution order of each microservice layer.

[0071] Specifically, the dependencies between microservices are complex, and determining the order in which each microservice is executed is a key point. In order to improve the efficiency of orchestration service execution and support concurrent execution of services without dependencies, microservices are layered here. Specifically, the microservice gateway device uses a deep search algorithm to search the path of the orchestration visual graph. The resulting path can have multiple microservices. Among these microservices, the microservice at the front needs to be executed first, and the microservice at the end is executed last. To ensure that the dependent microservices have been executed when subsequent microservices are executed, a microservice located in different paths can be used to take the maximum depth of the vertex corresponding to the microservice as the layer of the microservice.

[0072] In this embodiment, taking the above-mentioned services A, B, C, and D and their dependencies as an example, service A is executed first, and services B and D are all dependent on service A. Therefore, services B and D are executed second in priority, and service C is dependent on services A, B, and D. To ensure the smooth execution of service C, it must be executed after services A, B, and D are all completed. Therefore, service C cannot be executed at the same time as services B and D and must be executed last, that is, as the third in priority. Therefore, this embodiment can obtain three layers of microservices, with the first layer of microservices being executed first, followed by the second layer, and finally the third layer, thereby obtaining a hierarchical execution relationship. This hierarchical execution relationship is a data structure that can be represented in the form of a graph structure. This graph structure is a fictitious graph that does not actually exist in the microservice gateway device, but exists in the microservice gateway device in the form of a data structure. In order to facilitate the distinction between the execution order levels and to illustrate the services in each layer, the hierarchical execution relationship is represented in the form of a graph structure. In the corresponding schematic diagram of this embodiment, the first layer contains service A, the second layer contains service B and D, and the third layer contains service C.

[0073] Step S500: Configure a parameter mapping relationship between the microservice layers where any two microservices with a dependency relationship are located.

[0074] Specifically, based on the hierarchical execution relationships corresponding to the multiple microservice layers, their execution order is determined. The corresponding execution logic is that after all microservices in the first layer have completed execution, they are packaged and sent to the second layer, which then begins execution. After execution is completed, the resulting data is packaged and sent to the third layer, which then begins execution. In this way, data is generated and sent to subsequent adjacent or non-adjacent microservice layers according to the execution order of each microservice layer. For example, in this embodiment, service A in the first layer will send data not only to the second layer, but also to the third layer, because service C in the third layer requires the data obtained by service A in the first layer.

[0075] In combination with the above features, users can configure any two microservice layers on the microservice gateway device, specifically the parameter mapping relationship between the microservice layers where two or more microservices with a dependency relationship are located. For example, in this embodiment, the parameter mapping relationship between the first layer and the second layer, between the second layer and the third layer, and between the first layer and the second layer can be configured. It can be understood that in actual applications, it is necessary to establish a parameter mapping relationship for the microservice layers where all microservices with a dependency relationship are located, so as to avoid the data transmission between microservices being disconnected during the execution of the orchestration service, the data being unable to be forwarded normally to the corresponding microservice, or the microservice being unable to operate on the received data, etc., thereby ensuring the normal operation of the orchestration service.

[0076] Step S700: Obtain a service orchestration result according to the execution order and parameter mapping relationship.

[0077] Specifically, the microservices gateway device generates a service orchestration file based on the execution order of each microservice layer in the hierarchical execution relationship and the parameter mapping relationship between related microservice layers. This file serves as the service orchestration result. This means that the service orchestration solution is used to orchestrate and integrate the microservices downstream of the microservices gateway device into new capabilities, resulting in an orchestrated service with new capabilities. When the microservices gateway device needs to execute the orchestrated service in actual applications, it can directly call this result to implement it. Through orchestration, the resulting orchestrated service with multiple new capabilities can handle more and more complex business scenarios in daily life.

[0078] The service orchestration method provided in this embodiment constructs an orchestration visual graph based on user operations, searches the orchestration visual graph through a deep search algorithm, obtains a hierarchical execution relationship of multiple microservices, and then configures a parameter mapping relationship between the microservice layers where any two microservices with a dependency relationship in the hierarchical execution relationship are located. Finally, according to the execution order and parameter mapping relationship of each microservice layer in the hierarchical execution relationship, a service orchestration result is obtained, thereby achieving the purpose of visual orchestration and customized orchestration. The present invention constructs a directed acyclic graph in which multiple vertices represent multiple microservices respectively and an arc connecting two vertices represents the dependency relationship between two microservices, analyzes the execution order and hierarchy of microservices, ensures the correct execution of business logic, and customizes the configuration parameter mapping relationship between different hierarchies. It can take into account system performance, improve the implementation efficiency of service orchestration, and thus improve device performance. When this method is applied to a microservice gateway device, it can effectively improve the performance of the service gateway.

[0079] Example 2

[0080] Based on the same inventive concept, a second embodiment of the service orchestration method of the present invention is proposed. This service orchestration method can also be applied to a microservice gateway device. The service orchestration method of this embodiment is described in detail below. The method may include the following steps:

[0081] Step S100: constructing an orchestration visual graph based on the user's operation. The orchestration visual graph includes a directed acyclic graph in which multiple vertices represent multiple microservices respectively, and an arc connecting two vertices represents a dependency relationship between two microservices.

[0082] Specifically, the method can be executed on a microservice gateway device, or on a background server connected to the microservice gateway device, or distributed on multiple devices. For example, the microservices are orchestrated and managed on the background server, and the microservice gateway device is responsible for authentication and forwarding. For example, an independent orchestration service executor is responsible for the execution of the orchestration service and data processing. When the client needs to call the service gateway, it can send a request to the microservice gateway device. The microservice gateway device identifies the request type. If it is a simple service request, it can be directly forwarded to the downstream microservice. If it is an orchestration request, it can be forwarded to the background server or orchestration service executor. The background server can perform service orchestration, set request messages, configure various related parameters such as timeout period, timeout number, parameter dependency and corresponding message screening, etc. The orchestration service executor can respond to the request and return a response to the client through the service gateway. The orchestration service executor can also request each microservice in turn according to the workflow or call the service orchestration file or configuration information stored in the memory, package the responses of all microservices, and return the response to the client through the service gateway.

[0083] Optionally, upon receiving an orchestration request from a user via a user device, the microservice gateway device may invoke a composition component and return display information to the user device, allowing the user to perform the operations in step S100 on the user device to construct an orchestration visual graph. The orchestration visual graph may be constructed by the user manually configuring multiple microservices and their dependencies on the user device, for example, using a user device such as a touch screen display or operation buttons connected to the microservice gateway device.

[0084] In this embodiment, the six microservices, Service A, Service B, Service C, Service D, Service E, and Service F, are taken as an example. The dependency relationships among these six microservices are as follows: Service B depends on Service A, Service C depends on Service A, Service D depends on Service A, Service C depends on Service B, Service C depends on Service D, Service E depends on Service D, and Service F depends on Service C. Based on this known information, the user can build an orchestration visualization on the microservice gateway device or a user device connected to the microservice gateway device, and can display this orchestration visualization to the orchestrator through the microservice gateway device or the user device, enabling the user to visually orchestrate the services.

[0085] In this embodiment, for the above six microservices and their dependencies, users can obtain the following information after performing specific operations: Figure 3In the orchestration visualization diagram shown above, vertices represent microservices, with six vertices representing each microservice. Arcs represent the dependencies between microservices, and all arcs are directed. Optionally, vertices can store corresponding microservice information, such as request messages, timeouts, and retry attempts, while arcs can store information such as parameter dependencies between microservices.

[0086] Step S200: Convert the orchestration visual graph into a data structure, where the data structure includes a one-dimensional array and an adjacency matrix. The one-dimensional array represents the microservice information stored in the vertices, and the adjacency matrix represents the dependency information stored in the arcs.

[0087] Specifically, based on visualization, the arrangement visual graph can also be converted into a data structure to facilitate subsequent search operations using the data structure, thereby improving the efficiency of the search operation. The adjacency matrix can be defined as an n×n square matrix to represent the n vertices and corresponding relationships in the arrangement visual graph. The expression of the adjacency matrix can be:

[0088]

[0089] Among them, i represents the number of matrix rows, j represents the number of matrix columns, Z represents the relationship set of points, (v i ,v j ) represents the point v in the matrix i and dot v j The relationship between them.

[0090] In this embodiment, for Figure 3 The orchestration visualization graph shown can be represented as a graph G = (V, E), where V represents the set of vertices and E represents the set of arcs. A one-dimensional array is used to store vertex information, i.e., microservice information, and an adjacency matrix is ​​used to store arc information, i.e., the parameter dependencies between microservices. Combining the six microservices set above, this embodiment can produce a 6×6 square matrix:

[0091]

[0092] After obtaining the data structure containing the adjacency matrix, it can be used for subsequent depth search.

[0093] Step S300: Search the orchestration visual graph using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices. The hierarchical execution relationship includes at least two microservice layers and the execution order of each microservice layer.

[0094] The hierarchical execution relationship is manifested in the layering of multiple microservices, and microservices belonging to the same layer can be executed concurrently.

[0095] Specifically, step S300 may include:

[0096] Step S310: Search the arrangement visual graph using a depth search algorithm to obtain all paths corresponding to the arrangement visual graph;

[0097] Step S330: Determine the first-level information of the plurality of microservices based on all paths corresponding to the orchestration visualization graph;

[0098] Step S350: Determine the level of each microservice based on the first-level information, and obtain a hierarchical execution relationship of the multiple microservices.

[0099] During specific implementation, a deep search algorithm is used to search the orchestration visibility graph to obtain all paths corresponding to the orchestration visibility graph. For example, in this embodiment, ABCF, ACF, ADCF, and ADE can be obtained. Then, based on all the paths, the hierarchical information of each microservice is determined, that is, the first-level information of multiple microservices is obtained. For example, in this embodiment, the hierarchical information of service A can be determined to be the first layer, the hierarchical information of service B can be determined to be the second layer, and so on, corresponding to the first-level information of six microservices. Then, based on the hierarchical information of each microservice, the level of each microservice is determined. For example, based on the hierarchical information of service A, service A is determined to be in the first layer, and based on the hierarchical information of service B, service B is determined to be in the second layer, corresponding to the level of the six microservices. After obtaining the levels of all microservices, the hierarchical execution relationship corresponding to multiple microservices can be obtained. In order to facilitate the clarification of the hierarchical effect, the hierarchical execution relationship can be represented by a graph structure. For example, in this embodiment, it can be represented as follows Figure 4 Schematic diagram of the hierarchical execution relationship shown.

[0100] In one embodiment, after step S330, the method may further include:

[0101] Step S341: For a target microservice having multiple first-level information, determine the maximum value among the multiple first-level information as the second-level information of the target microservice;

[0102] Correspondingly, step S350 may include:

[0103] Step S351: Determine the hierarchical levels of a microservice with first-level information and a target microservice with second-level information based on the first-level information and the second-level information, and obtain a hierarchical execution relationship of the multiple microservices.

[0104] Because microservices may be at different levels in different paths, when determining the first-level information of each microservice based on all paths corresponding to the orchestration visualization graph in step S330, some microservices may have multiple first-level information. For example, for service C in this embodiment, there are multiple paths from A to C, namely ABCF, ACF, and ADCF. It can be seen that service C belongs to both the second and third layers, and the corresponding determined first-level information includes both the second and third layer results. In order to ensure the normal operation of all services, especially to ensure that all microservices that a certain microservice depends on have been executed, the maximum level of the microservice can be used as its final level. Specifically, the maximum value of its multiple first-level information is used as the new level information, and the level information is used to determine its final level. For example, in this embodiment, service C is used as the target microservice with two first-level information, and its third-level level information is determined as its new level information, i.e., the second-level information. Then, the level of service C can be determined to be the third level. Combined with other microservices with one level information, i.e., the first-level information, the hierarchical execution relationship corresponding to multiple microservices can be obtained. For example, in this embodiment, the following can be obtained: Figure 4 The hierarchical execution relationship shown.

[0105] In another embodiment, step S300 may include:

[0106] Step S301: Search the data structure using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices.

[0107] Specifically, after obtaining the data structure in step S200, the data structure can be searched using a deep search algorithm, converting the graph search into a data search, which can increase the device processing speed. After obtaining the hierarchy and execution order of each microservice, the hierarchical execution relationship of multiple microservices can be obtained. Figure 4 As shown, no further details are given here.

[0108] Step S500: Configure a parameter mapping relationship between the microservice layers where any two microservices with a dependency relationship are located.

[0109] During the orchestration execution process, due to the diversity of parameter passing types, how to accurately pass parameters between microservice layers with different execution orders, and specifically between different microservices, is a major challenge. This embodiment uses two microservice layers as an example to illustrate.

[0110] Specifically, step S500 may include:

[0111] Step S510: Determine the first microservice layer and the second microservice layer where the first microservice and the second microservice having a dependency relationship are located.

[0112] First, for any two first and second microservices that have a dependency relationship, they must be in different layers. Correspondingly, we can determine the first microservice layer where the first microservice is located and the second microservice layer where the second microservice is located. For example, in this embodiment, for service C that depends on service B, we can use service B as the first microservice and service C as the second microservice. We can determine the second layer where service B is located and the third layer where service C is located. Figure 4 The second layer serves as the first microservice layer, and the third layer serves as the second microservice layer.

[0113] Step S520: Determine a parameter transfer scheme between the first microservice layer and the second microservice layer according to the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer.

[0114] Each microservice has its own fixed input parameter types and output parameter types. To ensure that the second microservice that depends on the first microservice can normally receive usable data, a data conversion scheme can be set between the first and second microservices. However, since the transmission of multiple different data between different microservice layers can be directly sent through request message data packets in Json format, for example, the data conversion scheme between the first and second microservice layers, i.e., the parameter transfer scheme, can be directly defined. To ensure the integrity of the parameter transfer scheme, the parameter transfer scheme between the first and second microservice layers can be determined based on the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer.

[0115] Specifically, step S520 may include:

[0116] Step S521: Using a pre-stored parameter type classification table, determine the parameter transfer scheme between the first microservice layer and the second microservice layer according to the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer; wherein the parameter type classification table includes parameter types and corresponding supported parameter transfer types.

[0117] In this embodiment, the parameter types of microservices include String, Map, ArrayList, and ArrayMap. Based on the parameter classification table of these parameter types, the parameter transfer scheme between the first microservice layer and the second microservice layer can be determined. In this embodiment, the parameter type classification table is shown in Table 1 below:

[0118] Table 1

[0119]

[0120]

[0121] As can be seen in Table 1, the parameter type classification table includes parameter types, corresponding value formats, and corresponding supported parameter transfer types. This embodiment can determine the supported parameter transfer types based on the specific parameter types of each microservice, thereby defining a parameter transfer scheme between two microservice layers. For example, for Service B, identified as the first microservice, and Service C, identified as the second microservice, assuming that Service B's parameter type is String and Service C's parameter type is ArrayList, based on Table 1, the corresponding supported parameter transfer type is String→ArrayList. When Service C receives data sent by Service B, a parameter transfer scheme needs to be defined between Service B and Service C to convert Service B's String type data into Service C's ArrayList. That is, in this embodiment, the parameter transfer scheme between the second layer (the first microservice layer) and the third layer (the second microservice layer) must at least include String→ArrayList. It is understood that in this embodiment, since the second layer and the third layer have other services, and there are other dependencies between the second and third layers, the parameter transfer scheme between the second and third layers can also include other supported parameter transfer types.

[0122] Repeating the above steps will yield parameter transfer schemes for all layers of two microservices with dependencies. After integration, the parameter transfer schemes for the corresponding layers can be determined. For example, in this embodiment, parameter transfer schemes can be determined between the first and second layers, between the second and third layers, and between the third and fourth layers. Furthermore, since service C depends on service A, a corresponding parameter transfer scheme between the third and first layers is also determined.

[0123] Step S530: configuring an input parameter search algorithm for all microservices in the second microservice layer. The input parameter search algorithm is used for each microservice in the second microservice layer to match the target input parameters required for its own work in the output message of the first microservice layer.

[0124] Because the second microservice depends on the first microservice, it theoretically needs to complete execution after the first microservice completes. Since all microservices within each microservice layer execute simultaneously, the second microservice layer, where the second microservice resides, will begin execution after all microservices in the first microservice layer, where the first microservice resides, have completed execution and received data packets sent by the first microservice layer. In other words, the second microservice layer executes after the first microservice layer. At this point, the output of the first microservice layer needs to serve as the input for the second microservice layer. However, not all microservices in the second microservice layer receive all the data output by the first microservice layer. In practice, only the data required for the second microservice's operation in the data packets output by the first microservice layer is received. Therefore, the second microservice needs to search for the data required for its operation within the message data output by the first microservice layer as its input parameters. Accordingly, an input parameter search algorithm can be configured for all microservices in the second microservice layer so that, during subsequent execution, microservices in the second microservice layer can match their target input parameters within the messages output by the first microservice layer.

[0125] Step S540: Determine the parameter transfer scheme and the input parameter search algorithm as a parameter mapping relationship between the first microservice layer and the second microservice layer.

[0126] After obtaining the parameter transmission scheme between all relevant microservice layers and the input parameter search algorithm for all microservices in the second microservice layer, the input parameter search algorithm can be configured for the microservices in each microservice layer that need to receive the output message of the previous layer and need to find their own input parameters, so as to determine the parameter mapping relationship between the corresponding relevant microservice layers.

[0127] Step S700: Obtain a service orchestration result according to the execution order and parameter mapping relationship.

[0128] Step S800: storing the service orchestration result in a local cache, a remote server and / or a remote database respectively.

[0129] A multi-level storage design is adopted to store the service orchestration results in the local cache, remote server and / or remote database respectively, so that hierarchical search can be performed during subsequent execution, effectively improving the performance of the service gateway. Remote servers such as Redis and remote databases such as MySQL databases. Increasing the local cache can reduce the access pressure on the remote server. In actual applications, when the execution request of the orchestration service reaches the microservice gateway device, the microservice gateway device can first read the configuration information from the local cache; if there is no relevant configuration information in the local cache, it can read from Redis and store the read configuration information in the local cache, set the validity period, so that it can be called directly from the local cache in the future; if there is no relevant configuration information in Redis, it can read from the MySQL database and store the read configuration information in both the local cache and Redis, so that it can be called from both the local cache and Redis in the future.

[0130] For more implementation details of the specific implementation of the above method steps, please refer to the description of the specific implementation in Example 1. For the sake of brevity of the description, they will not be repeated here.

[0131] The service orchestration method provided in this embodiment analyzes the execution order and hierarchy of orchestrated services based on a directed acyclic graph, ensures the correct execution of business logic, and adaptively adjusts concurrent and serial execution strategies between different levels. At the same time, visual orchestration can be achieved, and the orchestrator can customize business and data integration without worrying about implementation, which greatly improves implementation efficiency. Compared with existing orchestration methods, this embodiment effectively improves the performance of the service gateway by optimizing the parameter type matching strategy and adopting a distributed and multi-level storage design. At the same time, it can achieve convenient online deployment of orchestrated services without the need for application restart and configuration modification, saving considerable costs.

[0132] Example 3

[0133] Based on the same invention concept, Figure 5 , a first embodiment of the service orchestration device of the present invention is proposed, which can be a virtual device applied to a microservice gateway device.

[0134] The following combination Figure 5 The functional module diagram shown in FIG. 1 is a detailed description of the service orchestration device provided in this embodiment. The device may include:

[0135] A visualization configuration module is used to build an orchestration visualization graph based on user operations. The orchestration visualization graph includes a directed acyclic graph in which multiple vertices represent multiple microservices, and an arc connecting two vertices represents the dependency relationship between two microservices.

[0136] An execution order determination module is configured to search the orchestration visual graph using a deep search algorithm to obtain a hierarchical execution relationship of multiple microservices, where the hierarchical execution relationship includes at least two microservice layers and the execution order of each of the microservice layers;

[0137] The mapping relationship configuration module is used to configure the parameter mapping relationship between any two microservice layers with dependency relationships;

[0138] The result output module is used to obtain the service orchestration results based on the execution order and parameter mapping relationship.

[0139] Furthermore, the device may further include:

[0140] The structure conversion module is used to convert the orchestration visual graph into a data structure. The data structure includes a one-dimensional array and an adjacency matrix. The one-dimensional array represents the microservice information stored in the vertex, and the adjacency matrix represents the dependency information stored in the arc.

[0141] Correspondingly, the execution order determination module is used to search the data structure through a deep search algorithm to obtain the hierarchical execution relationship of multiple microservices.

[0142] Furthermore, the execution order determination module may include:

[0143] A path search unit, configured to search the arrangement visibility graph using a depth search algorithm to obtain all paths corresponding to the arrangement visibility graph;

[0144] A level determination unit, configured to determine first-level information of a plurality of microservices based on all paths corresponding to the orchestration visual graph;

[0145] The execution graph unit is used to determine the level of each microservice based on the first-level information and obtain the hierarchical execution relationship of multiple microservices.

[0146] Furthermore, the level determination unit is further configured to determine, for a target microservice having multiple first-level information, a maximum value among the multiple first-level information as the second-level information of the target microservice;

[0147] The execution graph unit is further used to determine the levels of a microservice with first-level information and a target microservice with second-level information based on the first-level information and the second-level information, and obtain a hierarchical execution relationship of multiple microservices.

[0148] Furthermore, the mapping relationship configuration module may include:

[0149] A microservice layer selection unit, configured to determine the first microservice layer and the second microservice layer where the first microservice and the second microservice having a dependency relationship are located respectively;

[0150] A parameter transfer scheme unit, configured to determine a parameter transfer scheme between the first microservice layer and the second microservice layer according to parameter types of all microservices in the first microservice layer and parameter types of all microservices in the second microservice layer;

[0151] A parameter search configuration unit is used to configure an input parameter search algorithm for all microservices in the second microservice layer. The input parameter search algorithm is used for each microservice in the second microservice layer to match the target input parameters required for its own work in the output message of the first microservice layer;

[0152] The mapping relationship determining unit is configured to determine the parameter transfer scheme and the input parameter search algorithm as a parameter mapping relationship between the first microservice layer and the second microservice layer.

[0153] Furthermore, the parameter passing scheme unit is also used to use a pre-stored parameter type classification table to determine the parameter passing scheme between the first microservice layer and the second microservice layer according to the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer; wherein the parameter type classification table includes parameter types and corresponding supported parameter passing types.

[0154] Furthermore, the device may further include:

[0155] The storage unit is used to store the service orchestration results in a local cache, a remote server and / or a remote database.

[0156] It should be noted that the functions that can be implemented by each module in the service orchestration device provided in this embodiment and the corresponding technical effects achieved can refer to the description of the specific implementation methods in each embodiment of the service orchestration method of the present invention. For the sake of brevity of the description, they will not be repeated here.

[0157] Example 4

[0158] Based on the same invention concept, Figure 2 Schematic diagram of the hardware structure, this embodiment provides a microservice gateway device, the microservice gateway device may include a processor and a memory, the memory stores a service orchestration program, when the service orchestration program is executed by the processor, implements all or part of the steps of each embodiment of the service orchestration method of the present invention.

[0159] Specifically, a microservice gateway device refers to a terminal device or network device that can achieve network connection.

[0160] It can be understood that the microservice gateway device may also include a communication bus, a user interface, and a network interface. Among them, the communication bus is used to realize the connection and communication between these components; the user interface is used to connect to the client and communicate data with the client. The user interface may include output units such as display screens, speakers, etc., and input units such as keyboards, microphones, etc.; the network interface is used to connect to the server and communicate data with the server. The network interface may include input / output interfaces, such as standard wired interfaces and wireless interfaces such as Wi-Fi interfaces; the memory is used to store various types of data, which may include instructions of any application or method in the microservice gateway device, as well as application-related data. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), random access memory (RAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), etc. Memory, referred to as PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk, etc.; optionally, the memory can also be a storage device independent of the processor; the processor is used to call the service orchestration program stored in the memory and execute the service orchestration method as described above. The processor can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, which is used to execute all or part of the steps of each embodiment of the service orchestration method as described above.

[0161] Need to explain, Figure 2The hardware structure shown in the figure does not constitute a limitation on the microservice gateway device of the present invention, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0162] Example 5

[0163] Based on the same inventive concept, this embodiment provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic memory, a magnetic disk, an optical disk, a server, etc. A computer program is stored on the storage medium. The computer program can be executed by one or more processors. When the computer program is executed by the processor, it can implement all or part of the steps of each embodiment of the service orchestration method of the present invention.

[0164] It should be noted that the serial numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. The above embodiments are merely optional embodiments of the present invention and do not limit the patent scope of the present invention. All equivalent structures or equivalent process transformations made by utilizing the contents of the present description and drawings under the inventive concept of the present invention, or directly or indirectly applied in other related technical fields, are included in the patent protection scope of the present invention.

Claims

1. A service orchestration method, characterized in that: Applied to a microservice gateway device, the method includes: Building an orchestration visual graph based on the user's operation, the orchestration visual graph includes a directed acyclic graph in which multiple vertices represent multiple microservices respectively, and an arc connecting two vertices represents a dependency relationship between two microservices; Searching the orchestration visual graph using a deep search algorithm to obtain a hierarchical execution relationship of the multiple microservices, wherein the hierarchical execution relationship includes at least two microservice layers and an execution order of each of the microservice layers; Configure the parameter mapping relationship between any two microservices with dependencies in the microservice layer; A service orchestration result is obtained according to the execution order and the parameter mapping relationship.

2. The service orchestration method according to claim 1, wherein: After the step of constructing the arrangement visual graph based on the user's operation, the method further includes: Converting the orchestration visual graph into a data structure, the data structure comprising a one-dimensional array and an adjacency matrix, the one-dimensional array representing the microservice information stored by the vertices, and the adjacency matrix representing the dependency information stored by the arcs; Searching the orchestration visual graph using a deep search algorithm to obtain a hierarchical execution relationship of the multiple microservices includes: The data structure is searched using a deep search algorithm to obtain a hierarchical execution relationship between the multiple microservices.

3. The service orchestration method according to claim 1, wherein: Searching the orchestration visual graph using a deep search algorithm to obtain a hierarchical execution relationship of the multiple microservices includes: Searching the arrangement visual graph using a depth search algorithm to obtain all paths corresponding to the arrangement visual graph; Determining first-level information of the plurality of microservices according to all paths corresponding to the orchestration visual graph; The level of each microservice is determined according to the first hierarchical information, and a hierarchical execution relationship of the multiple microservices is obtained.

4. The service arrangement method according to claim 3, wherein: After the step of determining the first-level information of the plurality of microservices based on all paths corresponding to the orchestration visual graph, the method further includes: For a target microservice having multiple first-level information, determining a maximum value among the multiple first-level information as the second-level information of the target microservice; The step of determining the level of each microservice according to the first level information and obtaining the hierarchical execution relationship of the multiple microservices includes: According to the first hierarchical information and the second hierarchical information, hierarchies of a microservice having first hierarchical information and a target microservice having second hierarchical information are determined, and a hierarchical execution relationship of the multiple microservices is obtained.

5. The service arrangement method according to claim 1, wherein: The configuration of the parameter mapping relationship between the microservice layers where any two microservices with a dependency relationship are located includes: Determine the first microservice layer and the second microservice layer where the first microservice and the second microservice having a dependency relationship are located respectively; Determine a parameter transfer scheme between the first microservice layer and the second microservice layer according to the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer; Configuring an input parameter search algorithm for all microservices in the second microservice layer, wherein the input parameter search algorithm is used for each microservice in the second microservice layer to match the target input parameters required for its own work in the output message of the first microservice layer; The parameter transfer scheme and the input parameter search algorithm are determined as a parameter mapping relationship between the first microservice layer and the second microservice layer.

6. The service orchestration method according to claim 5, wherein: The determining, according to the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer, a parameter transfer scheme between the first microservice layer and the second microservice layer includes: Using a pre-stored parameter type classification table, according to the parameter types of all microservices in the first microservice layer and the parameter types of all microservices in the second microservice layer, determine the parameter transfer scheme between the first microservice layer and the second microservice layer; wherein the parameter type classification table includes parameter types and corresponding supported parameter transfer types.

7. The service orchestration method according to any one of claims 1 to 6, wherein: After the step of obtaining a service orchestration result according to the execution order and the parameter mapping relationship, the method further includes: The service orchestration result is stored in a local cache, a remote server and / or a remote database respectively.

8. A service orchestration device, characterized in that: The device comprises: A visualization configuration module is used to construct an orchestration visualization graph based on user operations, wherein the orchestration visualization graph includes a directed acyclic graph in which multiple vertices represent multiple microservices respectively, and an arc connecting two vertices represents a dependency relationship between two microservices; an execution order determination module, configured to search the orchestration visual graph using a deep search algorithm to obtain a hierarchical execution relationship of the plurality of microservices, wherein the hierarchical execution relationship includes at least two microservice layers and an execution order of each of the microservice layers; The mapping relationship configuration module is used to configure the parameter mapping relationship between any two microservice layers with dependency relationships; The result output module is used to obtain the service arrangement result according to the execution order and the parameter mapping relationship.

9. A microservice gateway device, characterized in that: The microservice gateway device includes a processor and a memory, wherein a service orchestration program is stored in the memory. When the service orchestration program is executed by the processor, the service orchestration method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that The storage medium stores a computer program, which, when executed by one or more processors, implements the service orchestration method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for drawing dependency topological graph

    CN111831548A

  • SDN-based Internet-of-Things micro-service automatic arrangement method

    CN112671865A