Resource allocation method and system
By constructing a parallel solution to the target optimization model, the optimal resource allocation strategy is generated, which solves the problem of unfair resource allocation in large microservice systems, optimizes the average response time of the application, and improves the system's resource allocation efficiency and stability.
Patent Information
- Application Number
- PCT/CN2024/083219
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-04
- Filing Date
- 2024-03-22
- Publication Date
- 2025-08-07
AI Technical Summary
The prior art is difficult to effectively optimize the average response time of each application in large microservice systems, resulting in unfair resource allocation and some application hunger may arise.
The resource allocation method based on user request information is adopted, and the target optimization model is constructed, and the alternate direction multiplication method is used to solve each sub-optimization model in parallel to generate the optimal resource allocation strategy, including the construction of the original calculation function, differentiated constraints and augmented Lagrangian function, and optimize the resource allocation difference.
The average response time of each application in large microservice systems is effectively optimized, the difference in resource allocation is ensured, and the system's resource allocation efficiency and stability are improved.
Smart Images

Figure CN2024083219_07082025_PF_FP_ABST
Abstract
Description
Resource allocation method and system Technical Field
[0001] The present invention relates to the field of resource allocation, and in particular to a resource allocation technology for a large microservice ecosystem. Background Art
[0002] In recent years, the application of microservice systems has become widespread. Microservice systems, also known as microservice architectures, are an architectural approach for building applications that decomposes complex system functionality into discrete services. Each service runs in an independent process and communicates with each other through well-defined interfaces (such as REST), thereby reducing system coupling and improving system stability and flexibility. The highly distributed and dynamic nature of large-scale microservice systems has led to a rapid expansion in the number of service nodes, increasingly complex dependencies between services, and the numerous resources involved, such as CPUs, GPUs, and memory. How to properly allocate these resources has become a critical issue in ensuring the availability, stability, and efficiency of microservice ecosystems, requiring effective resource allocation algorithms to achieve this.
[0003] The current resource allocation algorithm mainly schedules according to weight, priority, etc., which makes it difficult to minimize the average completion time of each application.
[0004] Summary of the Invention
[0005] In view of the shortcomings of the prior art, the present invention provides a resource allocation technology for optimizing the average response time of each application in a large microservice ecosystem.
[0006] In order to solve the above technical problems, the present invention is solved by the following technical solutions:
[0007] A resource allocation method, in a microservice system, allocates resources to each application based on user request information, including the following steps:
[0008] Obtaining a target optimization model, wherein the target optimization model includes a plurality of sub-optimization models corresponding to resources one by one;
[0009] The optimization goal of the sub-optimization model is to minimize the sum of the average response times of all applications on the corresponding resources;
[0010] The variables of the sub-optimization model include decision variables and environmental variables;
[0011] The decision variables include the total allocation and sub-allocation of the corresponding resources, the total allocation refers to the allocation of the corresponding resources in the microservice system, and the sub-allocation refers to the allocation of the corresponding types in each application;
[0012] The environment variables include the user request set and internal communication overhead corresponding to each application;
[0013] Get the environment parameters corresponding to the current microservice system;
[0014] Based on the environmental parameters, each sub-optimization model is solved in parallel according to the alternating direction multiplier method to obtain the optimal solution corresponding to each decision variable and generate a corresponding resource allocation strategy.
[0015] As an implementable embodiment, the method for constructing the target optimization model includes:
[0016] Constructing an original calculation function, wherein the original calculation function is used to calculate an average response time of a target application based on the environmental parameters;
[0017] A differentiated constraint condition is constructed based on the group norm to obtain a first constraint. The differentiated constraint condition means that, for each type of resource, the corresponding resource in each application is less than or equal to the upper threshold of the resource;
[0018] The matrix-vector multiplication form of the sub-allocation corresponding to the target application is used as the second constraint;
[0019] Based on the original calculation function, the first constraint, and the second constraint, construct a problem of minimizing the sum of average response times of all applications to obtain a target optimization problem;
[0020] The target optimization problem is split into sub-problems corresponding to the resources one by one, and the augmented Lagrangian function corresponding to each sub-problem is used as the corresponding sub-optimization model.
[0021] As an implementable approach:
[0022] The original calculation function is:
[0023] in:
[0024] is the average response time corresponding to the nth application;
[0025] is the average waiting time in the queue;
[0026] is the average service time;
[0027] λ n is the average rate at which user requests arrive at the nth application;
[0028] L n is the average number of user requests in the queue corresponding to the nth application;
[0029] Γn is the set of user requests corresponding to the nth application;
[0030] Indicates the sub-allocation of each resource in the nth application;
[0031] Denotes the set of arriving user requests Γ n , given resources, the average processing speed of the nth application;
[0032] Indicates the internal communication overhead of the nth application.
[0033] As an implementable approach:
[0034] The target optimization problem is:
[0035] in:
[0036] y k is the total allocation of the kth resource;
[0037] is the sub-allocation of the kth resource in the nth application, yes abbreviation of ;
[0038] S n is a diagonal matrix;
[0039] μ k is the upper threshold corresponding to the k-th resource;
[0040] It is the collection of microservices in the nth application;
[0041] m is the mth microservice in the nth application.
[0042] As an implementable approach:
[0043] The sub-problem corresponding to the k-th resource is:
[0044] in:
[0045] f nk The function is the processing speed of user request r by the nth application after being allocated the kth resource;
[0046] αk is the contribution weight of the processing speed corresponding to the k-th resource to the final service rate;
[0047] K is the total number of resource types.
[0048] As an implementable approach:
[0049] The sub-optimization model is an augmented Lagrangian function in dual form;
[0050] The expression of the sub-optimization model corresponding to the k-th resource is:
[0051] in:
[0052] y k is the total allocation of the kth resource;
[0053] is the sub-allocation of the kth resource in the nth application;
[0054] {u n} n is the dual variable;
[0055] η is the penalty coefficient;
[0056] α k is the contribution weight of the processing speed corresponding to the k-th resource to the final service rate;
[0057] Γ n is the set of user requests corresponding to the nth application;
[0058] f nk The function is the processing speed of user request r by the nth application after being allocated the kth resource;
[0059] K is the total number of resource types;
[0060] represents the internal communication overhead of the nth application;
[0061] S n is a diagonal matrix;
[0062] μ k is the upper threshold corresponding to the k-th resource;
[0063] It is the collection of microservices in the nth application;
[0064] m is the mth microservice in the nth application.
[0065] A resource allocation system allocates resources to applications in a microservice system based on user request information, including:
[0066] A model acquisition module is used to acquire a target optimization model, wherein the target optimization model includes a plurality of sub-optimization models corresponding to resources one by one;
[0067] The optimization goal of the sub-optimization model is to minimize the sum of the average response times of all applications on the corresponding resources;
[0068] The variables of the sub-optimization model include decision variables and environmental variables;
[0069] The decision variables include the total allocation and sub-allocation of the corresponding resources, the total allocation refers to the allocation of the corresponding resources in the microservice system, and the sub-allocation refers to the allocation of the corresponding types in each application;
[0070] The environment variables include the user request set and internal communication overhead corresponding to each application;
[0071] The data acquisition module is used to obtain the environmental parameters corresponding to the current microservice system;
[0072] The optimization module is used to solve each sub-optimization model in parallel according to the alternating direction multiplier method based on the environmental parameters, obtain the optimal solution corresponding to each decision variable, and generate a corresponding resource allocation strategy.
[0073] As an implementable embodiment, the model acquisition module includes a model construction module, and the model construction module is configured to:
[0074] Constructing an original calculation function, wherein the original calculation function is used to calculate an average response time of a target application based on the environmental parameters;
[0075] A differentiated constraint condition is constructed based on the group norm to obtain a first constraint. The differentiated constraint condition means that, for each type of resource, the corresponding resource in each application is less than or equal to the upper threshold of the resource;
[0076] The matrix-vector multiplication form of the sub-allocation corresponding to the target application is used as the second constraint;
[0077] Based on the original calculation function, the first constraint, and the second constraint, construct a problem of minimizing the sum of average response times of all applications to obtain a target optimization problem;
[0078] The target optimization problem is split into sub-problems corresponding to the resources one by one, and the augmented Lagrangian function corresponding to each sub-problem is used as the corresponding sub-optimization model.
[0079] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of any one of the above-mentioned resource allocation methods.
[0080] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above-mentioned resource allocation methods when executing the program.
[0081] The present invention has significant technical effects due to the adoption of the above technical solutions:
[0082] The present invention obtains the optimal allocation result corresponding to each resource by solving each sub-optimization model in parallel, thereby optimizing the average response time of each application.
[0083] The present invention uses group norm to constrain resource allocation differentiation, and finally obtains the optimal solution for response time under the constraint conditions based on the ADMM algorithm. For complex and dynamic large-scale microservice systems, it can minimize the average response time of microservices while ensuring a certain degree of resource allocation differentiation, effectively improving the resource allocation effect of large-scale microservice systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] 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 drawings without paying any creative work.
[0085] FIG1 is a schematic diagram of a call graph of an application;
[0086] FIG2 is a schematic diagram of a flow chart of a resource allocation method according to the present invention;
[0087] FIG3 is a flow chart of the method for constructing the target optimization model in Example 1. DETAILED DESCRIPTION
[0088] The present invention will be further described in detail below with reference to the examples. The following examples are intended to explain the present invention but the present invention is not limited to the following examples.
[0089] illustrate:
[0090] 1.1) Microservices and Applications:
[0091] Allocate resources for a large computing cluster consisting of M microservices and N applications.
[0092] Each application consists of multiple interdependent microservices. The calls of microservices in each application can be abstracted into a call graph. Represents the call graph of the nth application, where Represents the set of microservices corresponding to the nth application, each directed edge (m1, m2)∈ε n Represents the calling relationship between upstream microservice m1 and downstream microservice m2.
[0093] The call graph of a microservices-based application is topologically similar to a tree, as shown in Figure 1. It consists of an entry microservice and several internal stateful or stateless microservices. User requests sent through HTTP are first captured by the entry microservice, and then other microservices are called to process the user requests.
[0094] 1.2) Resource allocation representation:
[0095] In the above large computing cluster, there are K types of resources that need to be allocated among microservices, such as CPU, memory, GPU, etc.
[0096] In this manual, y k =[y k1 ,...,y kM ] T ∈R M To represent the total distribution of the k-th resource, the total distribution refers to the distribution of the corresponding resource in the microservice system, that is, the distribution of the k-th resource in all microservices.
[0097] In this manual, To represent the allocation of the kth resource in the nth application, it will be abbreviated as The expression is as follows:
[0098] In this specification, y is used to represent the allocation of resources in the microservice system. Indicates the allocation of resources in the nth application. The corresponding expression is as follows:
[0099] 1.3) Application response time modeling:
[0100] The goal of the resource allocation method proposed in this invention is to minimize the sum of the average response times of all applications. First, the average response time of each application is modeled. A microservice-based application is modeled as a queue. The average response time is calculated as follows:
[0101] From the above, we can see that the average response time can be divided into two parts:
[0102] Average waiting time in queue Among them, λ n is the average rate at which user requests arrive at the nth application, L n is the average number of user requests in the queue corresponding to the nth application;
[0103] Average service time Calculated from the average service rate; the tie service rate consists of two parts; Denotes the set of arriving user requests Γ n , given resources, the average processing speed of the nth application; Indicates internal communication overhead.
[0104] The expression is:
[0105] in:
[0106] f nk The function is the processing speed of user request r by the nth application after being allocated the kth resource;
[0107] α k Indicates the contribution weight of the processing speed of the k-th resource to the final service rate;
[0108] G n (r) indicates that the call graph is related to the application request r. This is because the internal call status of the microservice will vary depending on the status of the user request r. Analysis of Alibaba Trace shows that nearly 60% of applications use two call topologies, and more than 10% of applications use nine call topologies.
[0109] Considering that our focus is on resource allocation, the topology of the call graph No impact, for simplicity, G n The r in (t) is removed.
[0110] is the kth resource allocation situation The marginal effect of acceleration decreases as the allocated resources increase. In actual microservice-based systems, the average processing speed is usually achieved by scaling container instances when resources are increased.
[0111] The communication overhead within a microservice is proportional to the internal call scale, i.e. |ε nThe number of allocated resources does not directly affect the communication overhead. This is because when a microservice has multiple instances, the upstream microservice's calls to it will be routed to one of the instances according to a load balancing strategy.
[0112] Therefore, the internal communication overhead The expression is:
[0113] Where: β n is the preset overhead coefficient, ε n (r) is the call relationship set corresponding to the user request r.
[0114] Example 1: A resource allocation method, in a microservice system, allocates resources to each application based on user request information, with reference to FIG2 , including the following steps:
[0115] S100, obtaining a target optimization model, wherein the target optimization model includes a plurality of sub-optimization models corresponding to resources one by one;
[0116] The optimization goal of the sub-optimization model is to minimize the sum of the average response times of all applications on the corresponding resources;
[0117] The variables of the sub-optimization model include decision variables and environmental variables;
[0118] The decision variables include the total allocation and sub-allocation of the corresponding resources;
[0119] The total allocation situation refers to the allocation situation of the corresponding resources in the microservice system;
[0120] The sub-distribution situation refers to the distribution of the corresponding category in each application;
[0121] The environment variables include the user request set and internal communication overhead corresponding to each application;
[0122] S200. Obtain the environment parameters corresponding to the current microservice system;
[0123] S300 , based on the environmental parameters, solving each sub-optimization model in parallel according to the alternating direction multiplier method, obtaining the optimal solution corresponding to each decision variable, and generating a corresponding resource allocation strategy.
[0124] This embodiment solves each sub-optimization model in parallel to obtain the optimal allocation result corresponding to each resource, thereby optimizing the average response time of each application.
[0125] 3 , the method for constructing the target optimization model in step S100 includes:
[0126] S110, constructing an original calculation function;
[0127] The original calculation function is used to calculate the average response time of the target application based on the environmental parameters;
[0128] In this embodiment, the above 1.3 The function is a primitive calculation function, so it will not be described here in detail.
[0129] S120, constructing a differentiated constraint condition based on the group norm to obtain a first constraint;
[0130] Differentiation constraints mean that for each type of resource, the corresponding resource in each application is less than or equal to the upper threshold of the resource;
[0131] For a given set of applications [N], introduce y k The group norm L on (∞,1) , which is defined as follows:
[0132] The first constraint is:
[0133] Among them, μ k is the upper threshold corresponding to the k-th resource;
[0134] Through the design of the first constraint, each application can flexibly increase the k-th type of resources to μ k Without changing the norm ball;
[0135] Through μ k The design can not only achieve structural diversity to ensure a certain degree of resource allocation differentiation, but also meet the resource capacity constraints without the need to set additional resource capacity constraints.
[0136] S120: Using the matrix-vector multiplication form of the sub-allocation corresponding to the target application as the second constraint;
[0137] The second constraint is:
[0138] Among them, S n is a diagonal matrix with the following form:
[0139] In the above formula:
[0140] It is the collection of microservices in the nth application;
[0141] m is the mth microservice in the nth application.
[0142] The second constraint is a matrix-vector multiplication of resource allocation, and does not add any new constraint scenarios.
[0143] S130: Based on the original calculation function, the first constraint, and the second constraint, construct a problem for minimizing the sum of average response times of all applications to obtain a target optimization problem;
[0144] The target optimization problem is:
[0145] S140: Split the target optimization problem into sub-problems corresponding to the resources one by one, and use the augmented Lagrangian function corresponding to each sub-problem as a corresponding sub-optimization model.
[0146] S141. The sub-problem corresponding to the k-th resource is:
[0147] in:
[0148] f nk The function is the processing speed of user request r by the nth application after being allocated the kth resource;
[0149] α k is the contribution weight of the processing speed corresponding to the k-th resource to the final service rate;
[0150] K is the total number of resource types.
[0151] The function is an exponential function. When the predicate p is true, The value is 1.
[0152] S142, converting the subproblem into a dual augmented Lagrangian function to obtain a corresponding suboptimization model;
[0153] In this embodiment, the expression of the sub-optimization model corresponding to the k-th resource is:
[0154] in:
[0155] {u n} n is the dual variable;
[0156] η is the penalty coefficient.
[0157] Based on the total allocation of the kth resource y in the above sub-optimization model k and the sub-allocation of the kth resource in the nth application is a decision variable. In this embodiment, the ADMM (Alternating Directions Method of Multiplier) method is used to alternately update each decision variable;
[0158] In this embodiment, the Python thread mechanism is used to concurrently update the decision variables of each application.
[0159] During the t+1th iteration, the following steps are performed:
[0160] S310, update the total allocation of the k-th resource y k ;
[0161] The update formula is:
[0162] because Not involving y k , so the above formula can be optimized as:
[0163] Calculate the gradient of the above expression and set it to 0 to get the updated y k value.
[0164] S320: Update the sub-allocation of each application corresponding to the k-th resource
[0165] Where n′∈[N]\{n};
[0166] After expanding the above expression, we get:
[0167] Since there are nonlinear constraints in the above expression, we linearize it and obtain:
[0168] in:
[0169] is the radius μ k The projection of the L1 sphere;
[0170] ρ n Is a constant used to adjust and The degree of proximity
[0171] Calculate the gradient of the above expression and set it to 0, and finally perform the projection operation to get the updated value.
[0172] S330, update the intermediate variables of each application in parallel, that is, update the dual variables u corresponding to each application in paralleln :
[0173] In this embodiment, the decision variables are iteratively updated based on step S310 and step S330 until a preset iteration completion condition is met, and the iteratively updated decision variables are output as the optimal solution to obtain a corresponding resource allocation strategy;
[0174] Those skilled in the art may set the iteration completion condition according to actual needs. In this embodiment, the iteration is completed when the number of iterations reaches a preset iteration number threshold.
[0175] Existing technologies fail to account for the diversified resource allocation of all microservices when allocating resources, potentially leading to resource starvation for some applications due to unfair resource scheduling. This embodiment uses a group norm to constrain resource allocation differentiation and, based on the ADMM algorithm, obtains the optimal response time under these constraints. For complex and dynamic large-scale microservice systems, this approach can minimize the average microservice response time while ensuring a certain degree of resource allocation diversity, effectively improving the resource allocation effectiveness of large-scale microservice systems.
[0176] Example 2: A resource allocation system, in a microservice system, allocates resources to each application based on user request information, including:
[0177] A model acquisition module is used to acquire a target optimization model, wherein the target optimization model includes a plurality of sub-optimization models corresponding to resources one by one;
[0178] The optimization goal of the sub-optimization model is to minimize the sum of the average response times of all applications on the corresponding resources;
[0179] The variables of the sub-optimization model include decision variables and environmental variables;
[0180] The decision variables include the total allocation and sub-allocation of the corresponding resources, the total allocation refers to the allocation of the corresponding resources in the microservice system, and the sub-allocation refers to the allocation of the corresponding types in each application;
[0181] The environment variables include the user request set and internal communication overhead corresponding to each application;
[0182] The data acquisition module is used to obtain the environmental parameters corresponding to the current microservice system;
[0183] The optimization module is used to solve each sub-optimization model in parallel according to the alternating direction multiplier method based on the environmental parameters, obtain the optimal solution corresponding to each decision variable, and generate a corresponding resource allocation strategy.
[0184] Furthermore, the model acquisition module includes a model construction module, and the model construction module is configured to:
[0185] Constructing an original calculation function, wherein the original calculation function is used to calculate an average response time of a target application based on the environmental parameters;
[0186] A differentiated constraint condition is constructed based on the group norm to obtain a first constraint. The differentiated constraint condition means that, for each type of resource, the corresponding resource in each application is less than or equal to the upper threshold of the resource;
[0187] The matrix-vector multiplication form of the sub-allocation corresponding to the target application is used as the second constraint;
[0188] Based on the original calculation function, the first constraint, and the second constraint, construct a problem of minimizing the sum of average response times of all applications to obtain a target optimization problem;
[0189] The target optimization problem is split into sub-problems corresponding to the resources one by one, and the augmented Lagrangian function corresponding to each sub-problem is used as the corresponding sub-optimization model.
[0190] Embodiment 3: A computer-readable storage medium stores a computer program, which implements the steps of the resource allocation method described in embodiment 1 when executed by a processor.
[0191] Embodiment 4: An electronic device comprises 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 resource allocation method described in embodiment 1 when executing the program.
[0192] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0193] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0194] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, apparatus, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0195] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the present invention. It should be understood that each process flow and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for implementing the functions specified in one or more processes in the flowcharts and / or one or more blocks in the block diagrams.
[0196] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0197] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0198] It should be noted that:
[0199] References in this specification to "one embodiment" or "an embodiment" mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Therefore, appearances of the phrases "one embodiment" or "an embodiment" in various places throughout this specification do not necessarily refer to the same embodiment.
[0200] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0201] Furthermore, it should be noted that the specific embodiments described in this specification may vary in the shapes and names of their components. Any equivalent or simple variations based on the structure, features, and principles described in the patented concept of this invention are included within the scope of protection of this patent. Persons skilled in the art may make various modifications, additions, or substitutions to the described specific embodiments, and these modifications, as long as they do not deviate from the structure of the invention or exceed the scope defined by the claims, shall fall within the scope of protection of this invention.
Claims
1. A resource allocation method, characterized in that: In a microservice system, resource allocation for each application based on user request information includes the following steps: Obtaining a target optimization model, wherein the target optimization model includes a plurality of sub-optimization models corresponding to resources one by one; The optimization goal of the sub-optimization model is to minimize the sum of the average response times of all applications on the corresponding resources; The variables of the sub-optimization model include decision variables and environmental variables; The decision variables include the total allocation and sub-allocation of the corresponding resources, the total allocation refers to the allocation of the corresponding resources in the microservice system, and the sub-allocation refers to the allocation of the corresponding types in each application; The environment variables include the user request set and internal communication overhead corresponding to each application; Get the environment parameters corresponding to the current microservice system; Based on the environmental parameters, each sub-optimization model is solved in parallel according to the alternating direction multiplier method to obtain the optimal solution corresponding to each decision variable and generate a corresponding resource allocation strategy.
2. The resource allocation method according to claim 1, characterized in that: The method for constructing the target optimization model includes: Constructing an original calculation function, wherein the original calculation function is used to calculate an average response time of a target application based on the environmental parameters; A differentiated constraint condition is constructed based on the group norm to obtain a first constraint. The differentiated constraint condition means that, for each type of resource, the corresponding resource in each application is less than or equal to the upper threshold of the resource; The matrix-vector multiplication form of the sub-allocation corresponding to the target application is used as the second constraint; Based on the original calculation function, the first constraint, and the second constraint, construct a problem of minimizing the sum of average response times of all applications to obtain a target optimization problem; The target optimization problem is split into sub-problems corresponding to the resources one by one, and the augmented Lagrangian function corresponding to each sub-problem is used as the corresponding sub-optimization model.
3. The resource allocation method according to claim 2, characterized in that: The original calculation function is: in: is the average response time corresponding to the nth application; is the average waiting time in the queue; is the average service time; λ n is the average rate at which user requests arrive at the nth application; L n is the average number of user requests in the queue corresponding to the nth application; Γ n is the set of user requests corresponding to the nth application; Indicates the sub-allocation of each resource in the nth application; Denotes the set of arriving user requests Γ n , given resources, the average processing speed of the nth application; Indicates the internal communication overhead of the nth application.
4. The resource allocation method according to claim 3, characterized in that: The target optimization problem is: in: y k is the total allocation of the kth resource; is the sub-allocation of the kth resource in the nth application, yes abbreviation of; S n is a diagonal matrix; μ k is the upper threshold corresponding to the k-th resource; v n It is the collection of microservices in the nth application; m is the mth microservice in the nth application.
5. The resource allocation method according to claim 4, characterized in that: The sub-problem corresponding to the k-th resource is: in: f nk The function is the processing speed of user request r by the nth application after being allocated the kth resource; α k is the contribution weight of the processing speed corresponding to the k-th resource to the final service rate; K is the total number of resource types.
6. The resource allocation method according to any one of claims 1 to 5, characterized in that: The sub-optimization model is an augmented Lagrangian function in dual form; The expression of the sub-optimization model corresponding to the k-th resource is: in: y k is the total allocation of the kth resource; is the sub-allocation of the kth resource in the nth application; {u n } n is the dual variable; η is the penalty coefficient; α k is the contribution weight of the processing speed corresponding to the k-th resource to the final service rate; Γ n is the set of user requests corresponding to the nth application; f nk The function is the processing speed of user request r by the nth application after being allocated the kth resource; K is the total number of resource types; represents the internal communication overhead of the nth application; S n is a diagonal matrix; μ k is the upper threshold corresponding to the k-th resource; v n It is the collection of microservices in the nth application; m is the mth microservice in the nth application.
7. A resource allocation system, characterized in that: In a microservice system, resources are allocated to each application based on user request information, including: A model acquisition module is used to acquire a target optimization model, wherein the target optimization model includes a plurality of sub-optimization models corresponding to resources one by one; The optimization goal of the sub-optimization model is to minimize the sum of the average response times of all applications on the corresponding resources; The variables of the sub-optimization model include decision variables and environmental variables; The decision variables include the total allocation and sub-allocation of the corresponding resources, the total allocation refers to the allocation of the corresponding resources in the microservice system, and the sub-allocation refers to the allocation of the corresponding types in each application; The environment variables include the user request set and internal communication overhead corresponding to each application; The data acquisition module is used to obtain the environmental parameters corresponding to the current microservice system; The optimization module is used to solve each sub-optimization model in parallel according to the alternating direction multiplier method based on the environmental parameters, obtain the optimal solution corresponding to each decision variable, and generate a corresponding resource allocation strategy.
8. The resource allocation system according to claim 7, characterized in that: The model acquisition module includes a model construction module, and the model construction module is configured to: Constructing an original calculation function, wherein the original calculation function is used to calculate an average response time of a target application based on the environmental parameters; A differentiated constraint condition is constructed based on the group norm to obtain a first constraint. The differentiated constraint condition means that, for each type of resource, the corresponding resource in each application is less than or equal to the upper threshold of the resource; The matrix-vector multiplication form of the sub-allocation corresponding to the target application is used as the second constraint; Based on the original calculation function, the first constraint, and the second constraint, construct a problem of minimizing the sum of average response times of all applications to obtain a target optimization problem; The target optimization problem is split into sub-problems corresponding to the resources one by one, and the augmented Lagrangian function corresponding to each sub-problem is used as the corresponding sub-optimization model.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the resource allocation method according to any one of claims 1 to 6 are implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the resource allocation method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Joint resource allocation method and regional orchestrator
CN112437449A
Distribution task processing method and device, distributed computing system and storage medium
CN114581223A
Intelligent manufacturing scene micro-service deployment scheme and resource redistribution method
CN115118748A
Service caching and resource optimization method and system based on ADMM, medium and equipment
CN115696445A
Methods for Multi-Access Edge Computing Network Slicing in 5G Networks
US20220022044A1