Resource allocation method and system

By constructing a target optimization model and a sub-optimization model, and using the alternating direction multiplier method for parallel solution, the problem of unfair resource allocation in large-scale microservice systems is solved, the average response time is optimized, and the fairness and efficiency of resource allocation are achieved.

CN118051331BActive Publication Date: 2025-12-05HAINAN RES INST OF ZHEJIANG UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410156847.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-04
Publication Date
2025-12-05
Estimated Expiration
2044-02-04

AI Technical Summary

Technical Problem

Existing resource allocation algorithms struggle to minimize the average response time of each application in large-scale microservice systems, leading to unfair resource scheduling and potential starvation for some applications.

Method used

A resource allocation method based on user request information is adopted. By constructing a target optimization model and a sub-optimization model, and using the alternating direction multiplier method for parallel solution, a resource allocation strategy is generated. Considering the differences in resource allocation and internal communication overhead, the average response time is optimized.

Benefits of technology

It effectively optimizes the average response time of each application in a large-scale microservice system, ensures the fairness and efficiency of resource allocation, and reduces application starvation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118051331B_ABST
    Figure CN118051331B_ABST
Patent Text Reader

Abstract

The application discloses a resource allocation method and system, in a micro-service system, based on user request information, each application is allocated resources, wherein the method comprises the following steps: obtaining a target optimization model, the target optimization model comprises a plurality of one-to-one corresponding resource sub-optimization models; the optimization target of the sub-optimization model is that the sum of the average response time of all applications on the corresponding resource is minimized; the variables of the sub-optimization model include decision variables and environmental variables; obtaining the environmental parameters corresponding to the current micro-service system; based on the environmental parameters, each sub-optimization model is solved in parallel according to the alternating direction multiplier method, the optimal solution corresponding to each decision variable is obtained, and the corresponding resource allocation strategy is generated. The application obtains the optimal allocation result corresponding to each resource by solving each sub-optimization model in parallel, and optimizes the average response time of each application.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of resource allocation, in particular to a resource allocation technology for large-scale micro-service ecosystem. BACKGROUND

[0002] In recent years, the application of micro-service system has been widespread. Micro-service system, also known as micro-service architecture, is an architecture scheme for building applications, which divides complex system functions into discrete services, each service runs in an independent process, and communicates with each other through a well-defined interface (such as REST), thereby reducing the coupling of the system and improving the stability and flexibility of the system. The highly distributed and dynamic characteristics of large-scale micro-service system make the number of service nodes rapidly expand, the dependency relationship between services become increasingly complex, and a large number of resources are involved, such as CPU, GPU, memory, etc. How to reasonably allocate resources has become an important problem to ensure the availability, stability and efficiency of the micro-service ecosystem, and effective resource allocation algorithms are needed to achieve this.

[0003] Current resource allocation algorithms mainly schedule according to weight, priority, etc., which is difficult to ensure that the minimum average completion time of each application is minimized. SUMMARY

[0004] The present application provides a resource allocation technology for optimizing the average response time of each application in a large-scale micro-service ecosystem.

[0005] In order to solve the above technical problems, the present application solves the problems through the following technical solutions:

[0006] A resource allocation method, in a micro-service system, based on user request information, allocates resources to each application, including the following steps:

[0007] Obtain a target optimization model, the target optimization model includes a plurality of sub-optimization models corresponding to resources one by one;

[0008] The optimization goal of the sub-optimization model is to minimize the sum of the average response time of all applications on the corresponding resource;

[0009] The variables of the sub-optimization model include decision variables and environmental variables;

[0010] The decision variables include the total allocation and sub-allocation of the corresponding resource, the total allocation refers to the allocation of the corresponding resource in the micro-service system, and the sub-allocation refers to the allocation of the corresponding type in each application;

[0011] The environmental variables include the user request set corresponding to each application and the internal communication overhead;

[0012] obtain an environment parameter corresponding to the current micro-service system;

[0013] Based on the environment parameter, the sub-optimization models are solved in parallel according to the alternating direction multiplier method, to obtain the optimal solution corresponding to each decision variable, and a corresponding resource allocation strategy is generated.

[0014] As an implementable manner, the method for constructing the target optimization model comprises:

[0015] An original calculation function is constructed, which is used to calculate the average response time of the target application based on the environment parameter;

[0016] A differentiated constraint condition is constructed based on a group norm to obtain a first constraint, and 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 limit threshold of the resource;

[0017] The matrix vector multiplication form of the sub-allocation situation corresponding to the target application is taken as a second constraint;

[0018] Based on the original calculation function, the first constraint and the second constraint, a sum minimization problem of the average response time of all applications is constructed to obtain a target optimization problem;

[0019] The target optimization problem is split into sub-problems corresponding to the resources one by one, and the augmented Lagrange function corresponding to each sub-problem is taken as a corresponding sub-optimization model.

[0020] As an implementable manner:

[0021] The original calculation function is:

[0022]

[0023] Wherein:

[0024] is the average response time corresponding to the nth application;

[0025] is the average queue waiting time;

[0026] is the average service time;

[0027] λ n is the average rate of user requests arriving at the nth application;

[0028] L n is the average number of user requests in the queue corresponding to the nth application;

[0029] Γ nis the set of user requests corresponding to the nthapplication;

[0030] denotes the sub-allocation of each resource in the nthapplication;

[0031] denotes the set of user requests arriving at the nthapplication n , given the resource, the average processing speed of the nthapplication;

[0032] denotes the internal communication overhead of the nthapplication.

[0033] As an implementable way:

[0034] The target optimization problem is:

[0035]

[0036]

[0037]

[0038]

[0039] wherein:

[0040] y k is the total allocation of the kthresource;

[0041] is the sub-allocation of the kthresource in the nthapplication, is a short form of

[0042] S n is a diagonal matrix;

[0043] μ k is an upper threshold value corresponding to the kthresource;

[0044] is the set of microservices in the nthapplication;

[0045] m is the mthmicroservice in the nthapplication.

[0046] As an implementable way:

[0047] The sub-problem corresponding to the kthresource is:

[0048]

[0049]

[0050]

[0051]

[0052] wherein:

[0053] f nk is the processing speed of the nthapplication for the user request r after the allocation of the kthresource;

[0054] α k is the contribution weight of the processing speed of the kthresource to the final service rate;

[0055] K is the total number of resource types.

[0056] As an implementable manner:

[0057] the sub-optimization model is an augmented Lagrangian function in dual form;

[0058] the expression of the sub-optimization model corresponding to the kthresource is:

[0059]

[0060]

[0061]

[0062]

[0063] wherein:

[0064] y k is the total allocation of the kthresource;

[0065] is the sub-allocation of the kthresource in the nthapplication;

[0066] {u n} n is a dual variable;

[0067] η is a penalty coefficient;

[0068] α k is the contribution weight of the processing speed of the kthresource to the final service rate;

[0069] T n is the user request set corresponding to the nthapplication;

[0070] f nk is the processing speed of the nthapplication for the user request r after the allocation of the kthresource;

[0071] K is the total number of resource types;

[0072] represents the internal communication overhead of the nthapplication;

[0073] S n is a diagonal matrix;

[0074] μ k is the upper threshold value corresponding to the kthresource;

[0075] is the set of microservices in the nthapplication;

[0076] m is the mthmicroservice in the nthapplication.

[0077] A resource allocation system, in a microservice system, based on user request information, each application is allocated resources, comprising:

[0078] The model acquisition module is configured to acquire a target optimization model, the target optimization model comprising a plurality of sub-optimization models corresponding to resources one by one;

[0079] The optimization objective of the sub-optimization model is to minimize the sum of the average response time of all applications on the corresponding resource;

[0080] The variables of the sub-optimization model include decision variables and environmental variables;

[0081] The decision variables include the total allocation and sub-allocation of the corresponding resource, the total allocation refers to the allocation of the corresponding resource in the microservice system, and the sub-allocation refers to the allocation of the corresponding type in each application;

[0082] The environmental variables include the user request set corresponding to each application and the internal communication overhead;

[0083] The data acquisition module is configured to acquire the environmental parameters corresponding to the current microservice system;

[0084] The optimization module is configured to parallelize each sub-optimization model based on the environmental parameters according to the alternating direction multiplier method, obtain the optimal solution corresponding to each decision variable, and generate a corresponding resource allocation strategy.

[0085] As an implementation manner, the model acquisition module comprises a model construction module, and the model construction module is configured to:

[0086] Construct an original calculation function, the original calculation function being used to calculate the average response time of the target application based on the environmental parameters;

[0087] A first constraint is obtained based on a group norm to construct a differentiated constraint condition, and the differentiated constraint condition indicates that, for each type of resource, a corresponding resource in each application is less than or equal to an upper threshold of the resource;

[0088] A matrix vector multiplication form of a sub-allocation situation corresponding to the target application is taken as a second constraint;

[0089] Based on the original calculation function, the first constraint and the second constraint, a sum minimization problem of average response times of all applications is constructed to obtain a target optimization problem;

[0090] The target optimization problem is split into sub-problems corresponding to the resources one by one, and an augmented Lagrange function corresponding to each sub-problem is taken as a corresponding sub-optimization model.

[0091] A computer readable storage medium has a computer program stored thereon, and the program, when executed by a processor, implements the steps of the resource allocation method of any one of the above.

[0092] An electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the steps of the resource allocation method of any one of the above when executing the program.

[0093] The present application has the following technical effects:

[0094] The present application obtains an optimal allocation result corresponding to each resource by parallelizing solving each sub-optimization model, and optimizes the average response time of each application.

[0095] The present application uses group norm to constrain resource allocation differentiation, and finally obtains an optimal solution of response time under the constraint condition based on ADMM algorithm. For a complex and dynamic large micro-service system, the average response time of micro-service can be minimized on the basis of ensuring a certain resource allocation differentiation, and the effect of resource allocation of the large micro-service system is effectively improved. BRIEF DESCRIPTION OF DRAWINGS

[0096] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0097] Figure 1 is a schematic diagram of a call graph of an application;

[0098] Figure 2is a flowchart of a resource allocation method of the present application;

[0099] Figure 3 is a flowchart of a method for constructing a target optimization model in Example 1. DETAILED DESCRIPTION

[0100] The present application will be further described in conjunction with examples, which are illustrative of the present application but the present application is not limited to the following examples.

[0101] Description:

[0102] 1.1) Microservices and Applications:

[0103] Resource allocation is performed on a large computing cluster consisting of M microservices and N applications.

[0104] Each application consists of multiple microservices that depend on each other, and the invocation of microservices in each application can be abstracted as a call graph, denoted as , where denotes the set of microservices corresponding to the nth application, and each directed edge (m1, m2) ∈ ε n denotes the invocation relationship between the upstream microservice m1 and the downstream microservice m2.

[0105] The call graph of a microservice-based application is similar in topology to a tree, as Figure 1 shown, where the set of microservices v n consisting of an entry microservice and several internal stateful or stateless microservices, a user request sent through http is first captured by the entry microservice, and then other microservices are invoked to process the user request.

[0106] 1.2) Resource allocation representation:

[0107] There are K types of resources in the above large computing cluster that need to be allocated in microservices, such as CPU, memory, GPU, etc.

[0108] In this specification, y k = [y k1 ,..., y kM ] T ∈ R M is used to represent the total allocation of the kth resource, and the total allocation refers to the allocation of the corresponding resource in the microservice system, i.e., the allocation of the kth resource in all microservices.

[0109] In this specification, y is used to represent the allocation of the kth resource in the nth application, which will be abbreviated as y The expression of is as follows:

[0110]

[0111] In the present specification, y represents the allocation of each resource in the micro-service system, represents the allocation of each resource in the nth application, and the corresponding expression is as follows:

[0112]

[0113]

[0114] 1.3) Application response time modeling:

[0115] The target of the resource allocation method proposed in the present application is to minimize the sum of the average response time of each application. First, the average response time of each application is modeled, and a micro-service-based application is modeled as a queue, and the calculation formula of the average response time is as follows:

[0116]

[0117] As can be seen from the above, the average response time can be divided into two parts:

[0118] Queue average waiting time Where λ n is the average rate of user requests arriving at the nth application, and L n is the average number of user requests in the queue corresponding to the nth application;

[0119] Average service time is calculated from the average service rate; the average service rate is composed of two parts; represents the average processing speed of the nth application for the set of arriving user requests Γ n , given the resources of . represents the internal communication overhead.

[0120] The expression of is as follows:

[0121]

[0122] Where:

[0123] f nk is the processing speed of the nth application for the user request r after being allocated the kth resource;

[0124] α k represents the contribution weight of the processing speed of the kth resource to the final service rate;

[0125] G n (r) indicates that the call graph is related to the application request r, because the internal call situation of the microservice will be different according to the state of the user request r; about 60% of the applications in the Alibaba Trace analysis use 2 kinds of call topology implementation, and more than 10% of the applications have 9 kinds of call topology;

[0126] Considering that our focus is on resource allocation problems, since the topology structure of the call graph has no impact on , for the sake of simplicity, r in G n (r) is removed in the following.

[0127] is the zero-start concave function of the kth resource allocation situation , and the accelerated marginal effect will decrease with the increase of the allocated resources. In actual microservice-based systems, the average processing speed is usually realized by expanding the container instance when increasing the resources.

[0128] The communication overhead in the microservice is proportional to the size of the internal call, that is, |ε n |; and the number of allocated resources does not directly affect the communication overhead, because when a microservice has multiple instances, the upstream microservice will route it to one of the instances according to a certain load balancing strategy.

[0129] Therefore, the expression of the internal communication overhead is:

[0130]

[0131] where: β n is a preset overhead coefficient, and ε n (r) is the call relationship set corresponding to the user request r.

[0132] Embodiment 1, a resource allocation method, in a microservice system, based on user request information, resource allocation is performed for each application, referring to Figure 2 , comprising the following steps:

[0133] S100, obtaining a target optimization model, the target optimization model includes a plurality of sub-optimization models corresponding to resources one by one;

[0134] 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;

[0135] The variables of the sub-optimization model include decision variables and environmental variables;

[0136] The decision variables include the total allocation and the sub-allocation of the corresponding resources;

[0137] The total allocation refers to the allocation of corresponding resources in the micro-service system;

[0138] The sub-allocation refers to the allocation of corresponding categories in each application;

[0139] The environmental variables include a set of user requests corresponding to each application and internal communication overhead;

[0140] S200, obtaining the environmental parameters corresponding to the current micro-service system;

[0141] S300, based on the environmental parameters, performing parallel solving on each sub-optimization model according to the alternating direction multiplier method, obtaining the optimal solution corresponding to each decision variable, and generating a corresponding resource allocation strategy.

[0142] The embodiment obtains the optimal allocation result corresponding to each resource by performing parallel solving on each sub-optimization model, and optimizes the average response time of each application.

[0143] Reference Figure 3 The method for constructing the target optimization model in step S100 includes:

[0144] S110, constructing an original calculation function;

[0145] The original calculation function is used to calculate the average response time of the target application based on the environmental parameters;

[0146] In this embodiment, the function described in 1.3 above is used as the original calculation function, and therefore the function will not be described again here.

[0147] S120, constructing a differentiated constraint condition based on a group norm to obtain a first constraint;

[0148] The differentiated constraint condition refers to that for each type of resource, the corresponding resource in each application program is less than or equal to the upper limit threshold of the resource;

[0149] For a given application set [N], a group norm (group norm) L k on y (∞,1) is introduced, which is defined as follows:

[0150]

[0151] The first constraint is:

[0152]

[0153] Where μ k is the upper limit threshold corresponding to the kth resource.​

[0154] Through the design of the first constraint, each application can flexibly increase the kth type of resource to μ k Without changing the norm ball;

[0155] Through the design of μ k , not only can structural diversity be achieved to ensure certain resource allocation differences, but also the resource capacity limit can be met, without the need to additionally set resource capacity constraints.

[0156] S120, the matrix-vector multiplication form of the sub-allocation situation corresponding to the target application is taken as the second constraint;

[0157] The second constraint is:

[0158]

[0159] Wherein, S n is a diagonal matrix, and has the following form:

[0160]

[0161] In the above formula:

[0162] is the set of microservices in the nth application;

[0163] m is the mth microservice in the nth application.

[0164] The second constraint is the matrix-vector multiplication form of the resource allocation situation, and does not increase new constraint scenarios.

[0165] S130, based on the original calculation function, the first constraint and the second constraint, a sum minimization problem of average response times of all applications is constructed to obtain a target optimization problem;

[0166] The target optimization problem is:

[0167]

[0168]

[0169] S140, the target optimization problem is split into sub-problems corresponding to the resources one by one, and the augmented Lagrange function corresponding to each sub-problem is taken as the corresponding sub-optimization model.

[0170] S141, the sub-problem corresponding to the kth resource is:

[0171]

[0172]

[0173]

[0174]

[0175] in:

[0176] f nk The function represents the processing speed of the nth application for user request r after allocating the kth type of resource;

[0177] α k It is the weight of the contribution of the processing speed corresponding to the k-th resource to the final service rate;

[0178] K is the total number of resource types.

[0179] The function is an exponential function, which occurs when the predicate p is true. The value is 1.

[0180] S142. Transform the subproblem into an augmented Lagrangian function in dual form to obtain the corresponding sub-optimization model;

[0181] In this embodiment, the expression for the sub-optimization model corresponding to the k-th resource is:

[0182]

[0183] in:

[0184] {u n} n As dual variables;

[0185] η is the penalty coefficient.

[0186] Based on the total allocation of the kth resource in the above sub-optimization model, y k Sub-allocation of the k-th resource in the n-th application As decision variables, this embodiment uses the ADMM (Alternating Directions Method of Multiplier) method to alternately update each decision variable;

[0187] In this embodiment, Python threading is used to concurrently update the decision variables of each application.

[0188] During the (t+1)th iteration, the following steps are performed:

[0189] S310, Update the total allocation of the k-th resource. k ;

[0190] The updated formula is:

[0191]

[0192] because Not involving y k Therefore, the above formula can be optimized to:

[0193]

[0194] By taking the gradient of the above expression and setting it to 0, we can obtain the updated y. k The value of .

[0195] S320. Update the sub-allocation of the k-th resource for each application.

[0196]

[0197] Where n′∈[N]\{n};

[0198] The above expression expands to obtain:

[0199]

[0200] Since the above expression contains nonlinear constraints, it is linearized to obtain:

[0201]

[0202] in:

[0203] For a radius of μ k The projection of the L1 sphere;

[0204] ρ n It is a constant used for adjustment. and degree of closeness

[0205] Calculate the gradient of the above expression and set it to 0. Finally, perform a projection operation to obtain the updated result. The value of .

[0206] S330. For each application, update its intermediate variable in parallel, that is, update the dual variable u corresponding to each application in parallel. n :

[0207]

[0208] In this embodiment, the decision variables are iteratively updated based on step S310 and step S330 until the preset iteration completion condition is met, and the obtained iteratively updated decision variables are output as the optimal solution to obtain a corresponding resource allocation strategy.

[0209] The iteration completion condition can be set by the person skilled in the art according to actual needs. In this embodiment, the iteration is completed when the number of iterations reaches a preset iteration number threshold.

[0210] The prior art does not consider the diversified resource allocation of all microservices when allocating resources, and may cause unfair resource scheduling and application starvation. The group norm is used to constrain the diversified resource allocation in this embodiment, and the optimal solution of the response time under the constraint condition is obtained based on the ADMM algorithm. For a complex and dynamic large microservice system, the average response time of microservices can be minimized on the basis of ensuring a certain resource allocation diversity, and the effect of resource allocation of the large microservice system can be effectively improved.

[0211] Embodiment 2: A resource allocation system, in a microservice system, based on user request information, each application is allocated resources, comprising:

[0212] A model acquisition module is configured to acquire a target optimization model, the target optimization model comprising a plurality of sub-optimization models corresponding to resources one by one;

[0213] The optimization objective of the sub-optimization model is to minimize the sum of the average response times of all applications on the corresponding resources;

[0214] The variables of the sub-optimization model include decision variables and environmental variables;

[0215] The decision variables include 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;

[0216] The environmental variables include a user request set corresponding to each application and internal communication overhead;

[0217] A data acquisition module is configured to acquire environmental parameters corresponding to the current microservice system;

[0218] An optimization module is configured to perform parallel solving of each sub-optimization model based on the environmental parameters according to an alternating direction multiplier method, to obtain optimal solutions corresponding to each decision variable, and to generate a corresponding resource allocation strategy.

[0219] Further, the model acquisition module comprises a model construction module, which is configured to:

[0220] constructing an original computing function for calculating the average response time of the target application based on the environment parameters;

[0221] constructing a differentiated constraint condition based on the group norm, obtaining a first constraint, the differentiated constraint condition indicating that, for each type of resource, the corresponding resource in each application program is less than or equal to the upper threshold of the resource;

[0222] taking the matrix vector multiplication form of the sub-allocation situation corresponding to the target application as a second constraint;

[0223] constructing a sum minimization problem of the average response times of all applications based on the original computing function, the first constraint, and the second constraint, obtaining a target optimization problem;

[0224] splitting the target optimization problem into sub-problems corresponding to the resources one by one, and taking the augmented Lagrange function corresponding to each sub-problem as a corresponding sub-optimization model.

[0225] Embodiment 3: A computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the steps of the resource allocation method of Embodiment 1.

[0226] Embodiment 4: An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the resource allocation method of Embodiment 1 when executing the program.

[0227] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts are referred to the part of the method embodiment.

[0228] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts between the embodiments can be referred to each other.

[0229] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can 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.

[0230] The application is described with reference to the drawings in which is shown a flowchart and / or a block diagram that illustrates an operational process according to the present application for a method, terminal device (system), and computer program product. It will be understood that each block of the flowchart and / or block diagram, and combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more of the flowcharts and / or blocks Figure 1 one or more of the flowcharts and / or blocks

[0231] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing terminal device to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more of the flowcharts and / or blocks Figure 1 one or more of the flowcharts and / or blocks

[0232] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device to cause a series of operational steps to be performed on the computer or other programmable terminal device to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal device provide steps for implementing the function specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more of the flowcharts and / or blocks Figure 1 one or more of the flowcharts and / or blocks

[0233] It is to be understood that:

[0234] The phrase "one embodiment" or "an embodiment" as used throughout this specification means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. Therefore, appearances of the phrases "one embodiment" or "an embodiment" throughout the specification are not necessarily all referring to the same embodiment.

[0235] Although preferred embodiments of the application have been described, a worker of ordinary skill in the art will recognize that variations and modifications of the preferred embodiments can be made while remaining within the scope of the application. Accordingly, it is intended that the appended claims be construed to include all such variations and modifications as falling within the scope of the application.

[0236] Moreover, it should be noted that the specific embodiments described in the specification are illustrative only and not restrictive of the patent concept. Equivalent or similar changes or modifications made to the configuration, features and principles described in the patent concept are included in the scope of the patent. Those skilled in the art can make various modifications or supplements to the specific embodiments described or use similar ways to replace them, as long as they do not deviate from the structure of the patent or exceed the scope defined by the claims.

Claims

1. A resource allocation method characterized by, In a micro-service system, resource allocation is performed for each application based on user request information, including the following steps: An objective optimization model is obtained, the objective optimization model including a plurality of sub-optimization models corresponding to resources one by one; An optimization objective of the sub-optimization model is to minimize the sum of average response times of all applications on the corresponding resource; Variables of the sub-optimization model include decision variables and environmental variables; The decision variables include total allocation and sub-allocation of the corresponding resource, the total allocation referring to allocation of the corresponding resource in the micro-service system, and the sub-allocation referring to allocation of the corresponding type in each application; The environmental variables include a user request set corresponding to each application and internal communication overhead; An environmental parameter corresponding to the current micro-service system is obtained; Based on the environmental parameter, parallel solving of each sub-optimization model is performed according to an alternating direction multiplier method, to obtain an optimal solution corresponding to each decision variable, and to generate a corresponding resource allocation strategy; The construction method of the objective optimization model includes: An original calculation function is constructed, the original calculation function being used to calculate an average response time of a target application based on the environmental parameter; A differentiated constraint condition is constructed based on a group norm, to obtain a first constraint, the differentiated constraint condition referring to that, for each type of resource, a corresponding resource in each application is less than or equal to an upper threshold of the resource; A matrix vector multiplication form of the sub-allocation of the target application is taken as a second constraint; Based on the original calculation function, the first constraint and the second constraint, a sum minimization problem of average response times of all applications is constructed, to obtain an objective optimization problem; The objective optimization problem is split into sub-problems corresponding to the resources one by one, and an augmented Lagrangian function corresponding to each sub-problem is taken as a corresponding sub-optimization model.

2. The resource allocation method according to claim 1, wherein: The original calculation function is: wherein: is the average response time corresponding to the nth application; is the queue average waiting time; is the average service time; λ n is the average rate of user requests arriving to the nthapplication; 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 nthapplication; represents the sub-allocation of each resource in the nth application; This represents the set of user requests that have arrived. n Given The resources, and the average processing speed of the nth application; represents the internal communication overhead of the nthapplication.

3. The resource allocation method according to claim 2, wherein: The objective optimization problem is: wherein: y k is the total allocation of the kth resource; is a sub-allocation of the kth resource in the nth application, is is a short hand for S n is a diagonal matrix; μ k is an upper threshold value corresponding to the kth resource; is a collection of microservices in the nth application; m is an mth micro-service in an nth application.

4. The resource allocation method according to claim 3, wherein: A sub-problem corresponding to a kth resource is: wherein: f nk f is the processing speed of the nthapplication for the user request r after the allocation of the kthresource; a k is the contribution weight of the processing speed corresponding to the kth resource to the final service rate; K is a total number of resource types.

5. The resource allocation method according to any one of claims 1 to 4, wherein: The sub-optimization model is an augmented Lagrangian function in a dual form; An expression of the sub-optimization model corresponding to the kth resource is: wherein: 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 For the dual variable u n the set; η is a penalty coefficient; a k is the contribution weight of the processing speed corresponding to the kth resource to the final service rate; Γ n is the set of user requests corresponding to the nthapplication; f nk f is the processing speed of the nthapplication for the user request r after the allocation of the kthresource; K is a total number of resource types; represents the internal communication overhead of the nthapplication; S n is a diagonal matrix; μ k is an upper threshold value corresponding to the kth resource; is a collection of microservices in the nth application; m is an mth micro-service in an nth application.

6. A resource allocation system characterized by, In a micro-service system, resource allocation is performed for each application based on user request information, including: A model obtaining module is configured to obtain an objective optimization model, the objective optimization model including a plurality of sub-optimization models corresponding to resources one by one; An optimization objective of the sub-optimization model is to minimize the sum of average response times of all applications on the corresponding resource; Variables of the sub-optimization model include decision variables and environmental variables; The decision variables include total allocation and sub-allocation of corresponding resources, the total allocation refers to allocation of corresponding resources in the micro-service system, and the sub-allocation refers to allocation of corresponding types in each application; The environment variables include a user request set corresponding to each application and internal communication overhead; a data acquisition module configured to acquire environment parameters corresponding to a current micro-service system; an optimization module configured to perform parallel solving on each sub-optimization model according to an alternating direction multiplier method based on the environment parameters, to obtain optimal solutions corresponding to each decision variable, and to generate a corresponding resource allocation strategy; The model acquisition module includes a model construction module, which is configured to: construct an original calculation function, the original calculation function being used to calculate an average response time of a target application based on the environment parameters; construct a differentiated constraint condition based on a group norm to obtain a first constraint, the differentiated constraint condition referring to, for each type of resource, a corresponding resource in each application being less than or equal to an upper threshold of the resource; take a matrix vector multiplication form of the sub-allocation of the target application as a second constraint; construct a sum minimization problem of average response times of all applications based on the original calculation function, the first constraint and the second constraint to obtain a target optimization problem; split the target optimization problem into sub-problems corresponding to the resources one by one, and take an augmented Lagrange function corresponding to each sub-problem as a corresponding sub-optimization model.

7. A computer readable storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the steps of the resource allocation method in any one of claims 1 to 5.

8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the steps of the resource allocation method in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Resource allocation and calculation task unloading method based on alternating direction multiplier

    CN113507712A

  • Edge computing micro-service deployment and task scheduling method based on micro-cell architecture

    CN116347473A