A method and system for joint optimization of microservice call graph deployment and request routing
By jointly optimizing the deployment and request routing of the microservice call graph, the problem that the separate optimization of microservice deployment and request routing in the existing technology cannot achieve global optimization, achieving lower latency and higher request success rate.
Patent Information
- Application Number
- CN202311100198.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-28
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2043-08-28
AI Technical Summary
Existing microservice deployment and request routing are often studied as two isolated issues, resulting in the inability to achieve global optimal performance optimization and the service latency is still high.
Through a joint optimization method for microservice call graph deployment and request routing, the computing resources required by each microservice in the user request are obtained, and the computing resources required by each microservice in the user request are sorted and allocated to the deployed server nodes. The request arrival rate is combined for clustering and partitioning, and the microservice request is iteratively allocated to realize direct or split allocation, obtaining the microservice request forwarding probability and request routing.
The joint optimization of microservice deployment and request routing is realized, saving computing resource costs, reducing end-to-end request latency, and maximizing the guaranteed request success rate.
Smart Images

Figure CN117097806B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of microservice technology, and in particular relates to a method and system for jointly optimizing microservice call graph deployment and request routing. Background Art
[0002] In recent years, microservice technology has been widely used in various real-time cloud applications due to its advantages of loose coupling and independent deployment, as well as its high maintainability, scalability and ease of development. In cloud data centers, latency-sensitive applications receive a large number of user requests per second, which are sent to multiple queues and then served by multiple microservice images. User requests are processed by a set of microservices that recursively call and frequently communicate with each other, forming a microservice call graph. It is a common practice to use queuing networks to model and analyze multiple queues and images of call graphs. How to efficiently deploy multiple queues and images to effectively reduce queue delays, processing delays, and communication delays is an obstacle in the process of business performance optimization.
[0003] Due to the high complexity of service call relationships and the full interaction between service image deployment and request routing, service orchestration has brought huge challenges. On the one hand, the effectiveness of service deployment is highly dependent on fine-grained microservice processing and a large number of requests routed between service images. On the other hand, request routing requires the deployment of service images as a precedent and is heavily dependent on image-level routing policies for service-level targets.
[0004] At present, microservice deployment and request routing are often studied as two isolated issues. This approach can reduce the difficulty of development and maintenance, and achieve local optimization of service deployment and request routing. However, it ignores the inherent data dependencies between services and cannot achieve global performance optimization, resulting in high service latency. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and system for jointly optimizing microservice call graph deployment and request routing, which is used to solve the problem that the existing method of separately optimizing microservice deployment and request routing cannot achieve global optimization and the service delay is still high.
[0006] In a first aspect of an embodiment of the present invention, a method for jointly optimizing microservice call graph deployment and request routing is provided, comprising:
[0007] Obtain the computing resources required for each microservice in the user request, sort all microservices in the undeployed microservice set according to the size of the required computing resources, and allocate the microservices requested by the user to the deployed microservice nodes in order based on the constraints of the remaining capacity of each server node to obtain a microservice deployment set;
[0008] Use a request arrival rate set and a tuple of equal size to represent the clustering and partitioning of each microservice request flow, and perform clustering and partitioning operations on tuples of different microservices;
[0009] The request flow set obtained by clustering is sorted in descending order according to the sum of the request arrival rates of each partition, and the server nodes where the microservices have been deployed are iteratively traversed. The microservice requests in each cluster partition are assigned to the server nodes. According to the computing resources owned by the server nodes, the microservice requests are directly allocated or split and allocated to multiple server nodes to obtain the microservice request forwarding probability and request routing.
[0010] In a second aspect of an embodiment of the present invention, a microservice call graph deployment and request routing joint optimization system is provided, including:
[0011] The microservice deployment module is used to obtain the computing resources required by each microservice in the user request, sort all microservices in the undeployed microservice set according to the size of the required computing resources, and allocate the microservices requested by the user to the deployed microservice nodes in order based on the constraints of the remaining capacity of each server node to obtain a microservice deployment set;
[0012] The request routing module is used to represent the request arrival rate set and a tuple of equal size as the clustering and partitioning of each microservice request flow, and to cluster and partition the tuples of different microservices; the request flow set obtained by clustering is sorted in descending order according to the sum of the request arrival rates of each partition, and the server nodes where the microservices have been deployed are iteratively traversed, and the microservice requests in each cluster partition are allocated to the server nodes. According to the computing resources owned by the server nodes, the microservice requests are directly allocated or split and allocated to multiple server nodes to obtain the microservice request forwarding probability and request routing.
[0013] In a third aspect of an embodiment of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect of the embodiment of the present invention when executing the computer program.
[0014] In a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method provided in the first aspect of the embodiment of the present invention are implemented.
[0015] In the embodiment of the present invention, by adopting the method of joint optimization of microservice deployment and request routing, not only can the computing resource cost be saved and the end-to-end request delay be reduced, but also the request success rate can be maximized. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 drawings without creative work.
[0017] Figure 1 A schematic diagram of a process for a microservice call graph deployment and request routing joint optimization method provided for an embodiment of the present invention;
[0018] Figure 2 A schematic diagram of a queuing network for images and request flows deployed in a data center provided by one embodiment of the present invention;
[0019] Figure 3 A schematic diagram of a hotel reservation microservice cloud application program provided for one embodiment of the present invention;
[0020] Figure 4 A schematic diagram of the structure of a microservice call graph deployment and request routing joint optimization system provided by an embodiment of the present invention;
[0021] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, 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 embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] It should be understood that the term "including" and other similar expressions in the specification or claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions, such as a process, method, system, or device including a series of steps or units is not limited to the listed steps or units. In addition, "first" and "second" are used to distinguish different objects, not to describe a specific order.
[0024] See also Figure 1 , a schematic diagram of a process of a microservice call graph deployment and request routing joint optimization method provided by an embodiment of the present invention includes:
[0025] S101, obtaining the computing resources required for each microservice in the user request, sorting all microservices in the undeployed microservice set according to the size of the required computing resources, and allocating the microservices requested by the user to the deployed microservice nodes in order based on the constraints of the remaining capacity of each server node, to obtain a microservice deployment set;
[0026] The computing resources required for microservices are calculated according to formula (1):
[0027]
[0028] In the formula, Representing microservices Process the request stream within the maximum delay The computing resources required to process user requests increase with increases with the increase of By minimum change To confirm, Represents the request flow A collection of all microservices;
[0029] The minimum change The constraint inequality is:
[0030]
[0031] In the formula, express Microservices in Queuing Systems The average queuing delay is Representing microservices The maximum delay rate in the corresponding request flow, Represents the request flow The maximum delay limit is Indicates the processor The communication delay between them.
[0032] Get each microservice Computing resource requirements Afterwards, according to The size of all microservices In descending order, in the set of undeployed microservices The largest ones are placed first. Once the microservices are deployed , then update the collection immediately .
[0033] Specifically, based on the constraints of the remaining capacity of each server node, server nodes that meet the constraint requirements are found from the deployed server nodes, and the server nodes that meet the requirements are added to the set of server nodes that can be used by the microservice;
[0034] If there is no server node that meets the requirements among the deployed server nodes, and the number of undeployed server nodes is not empty, select the server node that meets the requirements from the undeployed server nodes. Service nodes with good conditions and low average communication delay are used to deploy microservices;
[0035] If there is still no server node that meets the requirements among the deployed server nodes, and the number of undeployed server nodes is not empty, select a server node that meets the requirements from the undeployed server nodes. The server nodes with constraint inequalities are used to deploy microservices;
[0036] in, Indicates the remaining capacity of the server node computing resources, The constraint inequality is , represents the resource splitting factor, For the obtained microservices The computing resources required.
[0037] Use two sets to distinguish the properties of all processors, Used to represent the server nodes where microservices are deployed. Indicates a server node that has not been deployed. Extracting microservices ,according to The constraint inequality from Find a server node that meets the requirements , add it to the microservice The set of server nodes that can be used among; if There is no server node that meets the requirements and is a non-empty set, then from Choose to meet Service nodes with low average communication delay are used to deploy microservices ;like is still an empty set, then Satisfied The server node of the constraint inequality is added to Among.
[0038] Further, a server node is selected from the set of server nodes available for the microservice, and it is checked whether the remaining computing resources of the node are less than the resources required by the microservice. If so, all images required by the microservice are deployed to the selected server node. Otherwise, the service images required by the microservice are split, and the microservice is deployed to a server node with a larger remaining capacity.
[0039] Repeatedly deploy microservices to server nodes until there are no available server nodes;
[0040] When the remaining capacity of the computing resources of each server node is less than the computing resources required by the microservice, the microservice is added to the queue to be allocated as a new microservice node and waits for deployment.
[0041] from Select a server node and check whether the remaining computing resources are not less than , if less than Microservices All the required images are deployed on the server node, otherwise the microservice The required service images are split and deployed to larger , and move the server node from arrive .
[0042] Then, the process is repeated until no available server nodes are assigned. , that is, the impact of microservices If it cannot be fully allocated, the microservice Add as a new microservice node to Awaiting deployment.
[0043] The code implementation process is as follows:
[0044] Step 1: Initialize the array of used server nodes , idle server nodes , a list of microservices that were not selected for deployment , the residual capacity of computing resources of each server node , server nodes with sufficient resources to place ;
[0045] Step 2: For all microservices, the total computing resource requirements of the microservices Sort in descending order;
[0046] Step 3: When If not empty, get The first element in Empty; traverse the array Each node in , if satisfied , then the node Join In the collection;
[0047] Step 4: If If it is empty, iterate through the array Each element in (server node) , if satisfied or , then the node Join In the set; if none of them are satisfied, re-execute step 1;
[0048] Step 5: In the set, all server nodes are Sort in ascending order;
[0049] Step 6: For Each server node in Perform traversal, if satisfied , then place the microservice On the server node ,and and , Microservices from Remove from the list if From The processor Move to , then jump out of the loop;
[0050] Step 7: If , then place the microservice On the server node ,and and ,like From The processor Move to and from Remove, Update , = ;
[0051] Step 8: If , Microservices Add to the list of microservices that are not selected for deployment , and the total number of computing resource requirements needs to be updated to the latest ;
[0052] Step 9: Update the set of computing resource remaining capacity , returns a two-dimensional array collection of each microservice deployment result, that is, the logo microservice In the service node Binary variable for deployment status on and .
[0053] S102, using a request arrival rate set and a tuple of equal size to represent the clustering and partitioning of each microservice request flow, and performing clustering and partitioning operations on the tuples of different microservices;
[0054] The clustering and partitioning of each microservice request flow is represented by a set of request arrival rates and a tuple of equal size, where the size of the tuple is equal to the number of processors on which the specific microservice is deployed.
[0055] Merge the two tuples with the largest first element in the request arrival rate set, subtract the minimum value in the tuple from the merged tuple, and obtain the request flow set.
[0056] When clustering and partitioning, for the two tuples with the largest first element in the arrival rate set and , combining them into To replace the old position, perform standard normalization operation on the merged tuple before replacement, that is, subtract the minimum value in the tuple, and finally obtain the partition result of the request flow through clustering and partitioning operations. , for example, for an arrival rate of The request flow can be represented as three clusters , Indicates the arrival rate of the microservice request flow.
[0057] S103. Sort the request flow set obtained by clustering in descending order according to the sum of the request arrival rates of each partition, iteratively traverse the server nodes where the microservices have been deployed, and assign the microservice requests in each cluster partition to the server nodes. According to the computing resources of the server nodes, the microservice requests are directly assigned or split and assigned to multiple server nodes to obtain the microservice request forwarding probability and request routing.
[0058] Among them, the computing resources allocated to the microservices in the microservice deployment set on each server node are obtained;
[0059] Compare the size of the microservice requests in the cluster partition with the computing resources allocated on each server node. If the computing resources allocated on the server node are greater than or equal to the microservice requests, the microservice requests are directly allocated. Otherwise, the microservice requests are split and allocated to multiple server nodes.
[0060] Specifically, the request flow set obtained by clustering , sorted in descending order by the sum of the request arrival rates of each partition;
[0061] Traverse the server nodes where the microservices have been deployed, and distribute the microservice requests in each cluster partition to any microservice node with sufficient required computing resource capacity; otherwise, split the traffic of the microservice requests to multiple server nodes;
[0062] Repeat the allocation process to complete the request routing mapping process and obtain the forwarding probability between microservices And the request routing results of microservices .
[0063] For the request flow set obtained by clustering , sorted in descending order by the sum of the arrival rates of the requests for each partition, and then iteratively traversed the server nodes of the deployed microservices, and the microservice requests in each cluster partition were Assigned to any node with sufficient computing resource capacity, Representing microservices Otherwise, the traffic of microservice requests is split to multiple server nodes. Repeat the above process to complete the request routing mapping process.
[0064] use matrix To save each user request flow Traverse each microservice When the request is routed to one or more service nodes Finally, combined and Get each service request The forwarding probability between microservices and the request routing results of microservices .
[0065] The code implementation process is as follows:
[0066] Step 1: Initialize two stack queues and ;
[0067] Step 2: In the partition set (two-dimensional matrix) According to the first element Sorts all elements of the collection in descending order, where , Indicates a service request Request arrival rate;
[0068] Step 3: When When the number of elements in a set is greater than 1, find the first two elements in the set and , and then add the values at each position in the two sequence sets in reverse order to get a new tuple ;
[0069] Step 4: Add the two original tuples to In Sort all values in descending order; Normalize and add the subtracted normalized value to middle;
[0070] Step 5: In the original In the set, the normalized Replace these two elements and ;
[0071] Step 6: Based on the obtained (difference set), and Use the backtracking method to build a binary tree partition, each branch corresponds to the request flow Different subsets of Partitions of the request stream ;
[0072] Step 7: The sum of the accumulated values in each tuple Sort in descending order;
[0073] Step 8: Place microservices All Sort in descending order to get the available resource set { };
[0074] Step 9: If , take out the first request stream partition in the collection ;for Elements in , if satisfied , so that Record At the node The resources allocated above are ,renew And allocate the next request flow;
[0075] Step 10: If , so that Record At the node The resources allocated above are ,renew , ;
[0076] Step 11: Request routing results for each service request , And the resources allocated to the corresponding request flow on the corresponding server node ,calculate .
[0077] It can be understood that in this embodiment, the queueing network theory is applied to the service request model, and the proposed greedy microservice deployment algorithm (GMDA) based on resource partitioning and request matching and partition mapping algorithm (PMPR) are suitable for the case of a data center with multiple request flows. According to the open Jackson queueing theory, considering the interactive relationship between service request flows, all user requests are modeled as follows Figure 2 The queuing network shown allows the request flow to follow a probabilistic forwarding strategy, which can effectively avoid network congestion and is conducive to processing a large number of concurrent user requests.
[0078] Figure 2 There are four request flows in , , and , each of which has related attributes , , and , different microservices are called by different user requests, where A~E represent microservice images. will be placed in the processor Microservice images on Passed to microservice image When There are two request routing paths and . According to the forwarding probability between microservices , the two request arrival rates are and In addition, the processor Microservice images on There are three request flows , , Sharing, based on the fact that different request flows may share some service image features, we use Burke’s theorem and the linear visibility of Poisson flow to merge the request flows into Figure 2 The queuing network shown is used to jointly optimize the deployment of microservice call graphs and request routing, thereby routing these requests to images and allocating computing resources to microservice nodes.
[0079] In some embodiments, for example, Figure 3 As shown, taking the hotel reservation microservice cloud application as an example,
[0080] The hotel reservation microservice cloud application consists of six microservices, which form a linear microservice call chain, thus forming a special call graph. Modeled as a request flow , For collection A specific microservice in Serve the user request set, Represents a request stream set, Represents the equivalent entry processor that the first microservice in the request flow arrives at, represents the request arrival rate after the Poisson process. For two consecutive nodes in the service call chain, there is data dependency, and the nodes The data input is its ancestor node The output of the node The data output is its descendant nodes As input, the user request flow of the service chain must be processed by all microservices in sequence.
[0081] For each microservice in the hotel booking process, multiple images will exist on different processors that handle service requests independently of each other. Successfully served request flow , you need to traverse in a specific order One or more microservice images in the deployment, otherwise, the request flow will fail. When deploying microservice images, the data dependencies between microservice nodes are large. Deploying the corresponding images on the appropriate processing core can significantly reduce the communication delay between different processors. Using binary variables To represent microservices Whether deployed on the processor (1 if yes, 0 otherwise). Since microservice images can be instantiated on multiple processors, the symbol Indicates which processor Should handle service requests Request flow Microservices in .
[0082] When the request stream reaches the processor When the processor Not in the collection , Microservices Maybe in the processor Otherwise, if it is determined that this processor is used, the number of microservice images Available enough, Representing microservices In the processor The number of cores allocated in , therefore needs to determine which image will process the matching user request. It is a decision variable for request routing, indicating that the request is sent from the processor deployed on Microservices Routing to the processor deployed Microservices The probability of arrive flow part. , Satisfies the following formula:
[0083]
[0084]
[0085] Through the greedy microservice deployment (GMDA) algorithm and request matching and partition mapping (PMPR) algorithm proposed in this embodiment, we can get , and ,in Indicates that the processing is a service request Request flow Microservice nodes in The processor then determines the deployment location of each microservice and the routing path of the service request, thereby saving computing resource costs, minimizing end-to-end latency, and maximizing the success rate of microservice requests.
[0086] It can also be understood that this embodiment expresses the microservice deployment and request routing problem as an NP-hard mixed integer nonlinear programming (MINLP) problem, and adopts an open Markov (Jackson) queuing network to model and analyze the response delay, and creatively proposes a two-stage heuristic algorithm for joint deployment and routing:
[0087] In the first stage, for multi-image microservice deployment, a greedy microservice deployment algorithm (GMDA) based on resource partitioning is proposed to achieve fine-grained image deployment, which can reduce queuing delay, processing delay and communication delay, and minimize the processor usage cost while ensuring that the response time limit is not exceeded.
[0088] In the second stage, for the request routing problem, based on the ideas of clustering and mapping, a request matching and partition mapping (PMPR) algorithm is designed to determine the forwarding probability of the request flow, which can improve the success rate of the request flow.
[0089] In this embodiment, the local optimization method for microservice deployment and request routing is abandoned, and the global optimization can be achieved by adopting joint optimization, which can save costs, reduce response delays, maximize request success rate, and improve user experience.
[0090] It should be understood that the serial numbers of the steps in the above embodiments do not imply a sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0091] Figure 4 A schematic diagram of the structure of a microservice call graph deployment and request routing joint optimization system provided by an embodiment of the present invention, the system comprising:
[0092] The microservice deployment module 410 is used to obtain the computing resources required by each microservice in the user request, sort all microservices in the undeployed microservice set according to the size of the required computing resources, and allocate the microservices requested by the user to the deployed microservice nodes in order based on the constraints of the remaining capacity of each server node to obtain a microservice deployment set;
[0093] The computing resources required for microservices are calculated according to formula (1):
[0094]
[0095] In the formula, Representing microservices Process the request stream within the maximum delay The computing resources required to process user requests increase with increases with the increase of By minimum change To confirm, Represents the request flow A collection of all microservices;
[0096] The minimum change The constraint inequality is:
[0097]
[0098] In the formula, express Microservices in Queuing Systems The average queuing delay is Representing microservices The maximum delay rate in the corresponding request flow, Represents the request flow The maximum delay limit is Indicates the processor The communication delay between them.
[0099] Specifically, based on the constraints of the remaining capacity of each server node, server nodes that meet the constraint requirements are found from the deployed server nodes, and the server nodes that meet the requirements are added to the set of server nodes that can be used by the microservice;
[0100] If there is no server node that meets the requirements among the deployed server nodes, and the number of undeployed server nodes is not empty, select the server node that meets the requirements from the undeployed server nodes. Service nodes with good conditions and low average communication delay are used to deploy microservices;
[0101] If there is still no server node that meets the requirements among the deployed server nodes, and the number of undeployed server nodes is not empty, select a server node that meets the requirements from the undeployed server nodes. The server nodes with constraint inequalities are used to deploy microservices;
[0102] in, Indicates the remaining capacity of the server node computing resources, The constraint inequality is , represents the resource splitting factor, For the obtained microservices The computing resources required.
[0103] Further, a server node is selected from the set of server nodes available for the microservice, and it is checked whether the remaining computing resources of the node are less than the resources required by the microservice. If so, all images required by the microservice are deployed to the selected server node. Otherwise, the service images required by the microservice are split, and the microservice is deployed to a server node with a larger remaining capacity.
[0104] Repeatedly deploy microservices to server nodes until there are no available server nodes;
[0105] When the remaining capacity of the computing resources of each server node is less than the computing resources required by the microservice, the microservice is added to the queue to be allocated as a new microservice node and waits for deployment.
[0106] The request routing module 420 is used to represent the request arrival rate set and a tuple of equal size as the clustering and partitioning of each microservice request flow, and cluster and partition the tuples of different microservices; sort the request flow set obtained by clustering in descending order according to the sum of the request arrival rates of each partition, iteratively traverse the server nodes where the microservices have been deployed, and assign the microservice requests in each cluster partition to the server nodes. According to the computing resources owned by the server nodes, the microservice requests are directly assigned or split and assigned to multiple server nodes to obtain the microservice request forwarding probability and request routing.
[0107] The clustering and partitioning of each microservice request flow is represented by a set of request arrival rates and a tuple of equal size, where the size of the tuple is equal to the number of processors on which the specific microservice is deployed.
[0108] Merge the two tuples with the largest first element in the request arrival rate set, subtract the minimum value in the tuple from the merged tuple, and obtain the request flow set.
[0109] Specifically, the request flow set obtained by clustering , sorted in descending order by the sum of the request arrival rates of each partition;
[0110] Traverse the server nodes where the microservices have been deployed, and distribute the microservice requests in each cluster partition to any microservice node with sufficient required computing resource capacity; otherwise, split the traffic of the microservice requests to multiple server nodes;
[0111] Repeat the allocation process to complete the request routing mapping process and obtain the forwarding probability between microservices And the request routing results of microservices .
[0112] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0113] Figure 5 1 is a schematic diagram of a structure of an electronic device provided by an embodiment of the present invention. The electronic device is used for microservice deployment and request routing joint optimization. Figure 5 As shown, the electronic device 5 of this embodiment includes: a memory 510, a processor 520 and a system bus 530, wherein the memory 510 includes an executable program 5101 stored thereon, and those skilled in the art can understand that Figure 5The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0114] Combine the following Figure 5 A detailed introduction to the various components of electronic equipment:
[0115] The memory 510 can be used to store software programs and modules. The processor 520 executes various functional applications and data processing of the electronic device by running the software programs and modules stored in the memory 510. The memory 510 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as cache data), etc. In addition, the memory 510 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0116] The memory 510 includes an executable program 5101 of a network request method, and the executable program 5101 can be divided into one or more modules / units, which are stored in the memory 510 and executed by the processor 520 to achieve joint optimization of microservice deployment and request routing, etc. The one or more modules / units can be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 5101 in the electronic device 5. For example, the computer program 5101 can be divided into functional modules such as a microservice deployment module and a request routing module.
[0117] The processor 520 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 510, and calling data stored in the memory 510, it performs various functions of the electronic device and processes data, thereby monitoring the overall status of the electronic device. Optionally, the processor 320 may include one or more processing units; preferably, the processor 520 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 520.
[0118] The system bus 530 is used to connect the various functional components inside the computer, and can transmit data information, address information, and control information. Its types can be, for example, PCI bus, ISA bus, CAN bus, etc. The instructions of the processor 520 are transmitted to the memory 510 through the bus, and the memory 510 feeds back data to the processor 520. The system bus 530 is responsible for the data and instruction exchange between the processor 520 and the memory 510. Of course, the system bus 530 can also be connected to other devices, such as network interfaces, display devices, etc.
[0119] In the embodiment of the present invention, the executable program executed by the processor 520 included in the electronic device includes:
[0120] Obtain the computing resources required for each microservice in the user request, sort all microservices in the undeployed microservice set according to the size of the required computing resources, and allocate the microservices requested by the user to the deployed microservice nodes in order based on the constraints of the remaining capacity of each server node to obtain a microservice deployment set;
[0121] Use a request arrival rate set and a tuple of equal size to represent the clustering and partitioning of each microservice request flow, and perform clustering and partitioning operations on tuples of different microservices;
[0122] The request flow set obtained by clustering is sorted in descending order according to the sum of the request arrival rates of each partition, and the server nodes where the microservices have been deployed are iteratively traversed. The microservice requests in each cluster partition are assigned to the server nodes. According to the computing resources owned by the server nodes, the microservice requests are directly allocated or split and allocated to multiple server nodes to obtain the microservice request forwarding probability and request routing.
[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0124] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0125] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for joint optimization of microservice call graph deployment and request routing, characterized in that: include: Obtain the computing resources required for each microservice in the user request, sort all microservices in the undeployed microservice set according to the size of the required computing resources, and allocate the microservices requested by the user to the deployed microservice nodes in order based on the constraints of the remaining capacity of each server node to obtain a microservice deployment set; The step of obtaining the computing resources required for each microservice in the user request includes: Calculate the computing resources required for microservices according to formula (1): (1) In the formula, represents the computing resources required by microservice m, Representing microservices Process the request stream within the maximum delay The computing resources required to process user requests increase with increases with the increase of Through the minimum change To confirm, Represents the request flow A collection of all microservices; The minimum change The constraint inequality is: ; In the formula, express Microservices in Queuing Systems The average queuing delay is Representing microservices The maximum delay rate in the corresponding request flow, Represents the request flow The maximum delay limit is Indicates the processor Communication delay between Use a request arrival rate set and a tuple of equal size to represent the clustering and partitioning of each microservice request flow, and perform clustering and partitioning operations on tuples of different microservices; The request flow set obtained by clustering is sorted in descending order according to the sum of the request arrival rates of each partition, and the server nodes where the microservices have been deployed are iteratively traversed. The microservice requests in each cluster partition are assigned to the server nodes. According to the computing resources owned by the server nodes, the microservice requests are directly allocated or split and allocated to multiple server nodes to obtain the microservice request forwarding probability and request routing.
2. The method according to claim 1, characterized in that: The method of sequentially allocating the microservices requested by the user to the deployed microservice nodes based on the constraints of the remaining capacity of each server node includes: Based on the constraints of the remaining capacity of each server node, find the server nodes that meet the constraint requirements from the deployed server nodes, and add the server nodes that meet the requirements to the set of server nodes that can be used by the microservice; If there is no server node that meets the requirements among the deployed server nodes, and the number of undeployed server nodes is not empty, select the server node that meets the requirements from the undeployed server nodes. Service nodes with good conditions and low average communication delay are used to deploy microservices; If there is still no server node that meets the requirements among the deployed server nodes, and the number of undeployed server nodes is not empty, select a server node that meets the requirements from the undeployed server nodes. The server nodes with constraint inequalities are used to deploy microservices; in, Indicates the remaining capacity of the server node computing resources. The constraint inequality is , represents the resource splitting factor, For the obtained microservices The computing resources required.
3. The method according to claim 1, characterized in that The method of sequentially allocating the microservices requested by the user to the deployed microservice nodes based on the constraints of the remaining capacity of each server node includes: Select a server node from the set of server nodes available for the microservice, and check whether the remaining computing resources of the node are less than the resources required by the microservice. If so, deploy all the images required by the microservice to the selected server node. Otherwise, split the service images required by the microservice and deploy the microservice to the server node with larger remaining capacity. Repeatedly deploy microservices to server nodes until there are no available server nodes; When the remaining capacity of the computing resources of each server node is less than the computing resources required by the microservice, the microservice is added to the queue to be allocated as a new microservice node and waits for deployment.
4. The method according to claim 1, characterized in that: The clustering and partitioning of each microservice request flow is represented by a request arrival rate set and a tuple of equal size, and the clustering and partitioning operations are performed on the tuples of different microservices, including: The clustering and partitioning of each microservice request flow is represented by a set of request arrival rates and a tuple of equal size, where the size of the tuple is equal to the number of processors on which the particular microservice is deployed; Merge the two tuples with the largest first element in the request arrival rate set, subtract the minimum value in the tuple from the merged tuple, and obtain the request flow set.
5. The method according to claim 1, characterized in that The allocating of the microservice requests in each cluster partition to the server nodes, and directly allocating or splitting the microservice requests to multiple server nodes according to the computing resources of the server nodes, includes: Get the computing resources allocated to each server node by the microservices in the microservice deployment set; Compare the size of the microservice requests in the cluster partition with the computing resources allocated on each server node. If the computing resources allocated on the server node are greater than or equal to the microservice requests, the microservice requests are directly allocated. Otherwise, the microservice requests are split and allocated to multiple server nodes.
6. The method according to claim 1, characterized in that The request flow set obtained by clustering is sorted in descending order according to the sum of the arrival rates of the requests in each partition, the server nodes where the microservices have been deployed are iteratively traversed, the microservice requests in each cluster partition are allocated to the server nodes, and the microservice requests are directly allocated or split and allocated to multiple server nodes according to the computing resources owned by the server nodes, including: The request flow set obtained by clustering , sorted in descending order by the sum of the request arrival rates of each partition; Traverse the server nodes where the microservices have been deployed, and distribute the microservice requests in each cluster partition to any microservice node with sufficient required computing resource capacity; otherwise, split the traffic of the microservice requests to multiple server nodes; Repeat the allocation process to complete the request routing mapping process and obtain the forwarding probability between microservices And the request routing results of microservices .
7. A microservice call graph deployment and request routing joint optimization system, characterized in that: include: The microservice deployment module is used to obtain the computing resources required by each microservice in the user request, sort all microservices in the undeployed microservice set according to the size of the required computing resources, and allocate the microservices requested by the user to the deployed microservice nodes in order based on the constraints of the remaining capacity of each server node to obtain a microservice deployment set; The step of obtaining the computing resources required for each microservice in the user request includes: Calculate the computing resources required for microservices according to formula (1): (1) In the formula, represents the computing resources required by microservice m, Representing microservices Process the request stream within the maximum delay The computing resources required to process user requests increase with increases with the increase of Through the minimum change To confirm, Represents the request flow A collection of all microservices; The minimum change The constraint inequality is: ; In the formula, express Microservices in Queuing Systems The average queuing delay is Representing microservices The maximum delay rate in the corresponding request flow, Represents the request flow The maximum delay limit is Indicates the processor Communication delay between The request routing module is used to represent the request arrival rate set and a tuple of equal size as the clustering and partitioning of each microservice request flow, and to cluster and partition the tuples of different microservices; the request flow set obtained by clustering is sorted in descending order according to the sum of the request arrival rates of each partition, and the server nodes where the microservices have been deployed are iteratively traversed, and the microservice requests in each cluster partition are allocated to the server nodes. According to the computing resources owned by the server nodes, the microservice requests are directly allocated or split and allocated to multiple server nodes to obtain the microservice request forwarding probability and request routing.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of a microservice call graph deployment and request routing joint optimization method as described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed, the steps of a microservice call graph deployment and request routing joint optimization method as described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Micro-service deployment method and device and storage medium
CN116567059A
Dynamic Discovery and Management of Microservices for Multi-Cluster Computing Platforms
US20180069806A1