Resource allocation method and device, computer equipment, storage medium and program product
By matching cloud server resource requirements with cloud host available resources and dynamic allocation of cloud servers, the problem of resource waste and unbalanced utilization caused by existing resource allocation methods is solved, and more efficient resource utilization is achieved.
Patent Information
- Application Number
- CN202411870410.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-18
AI Technical Summary
The existing cloud-specific host resource allocation method leads to wasting CPU or memory resources and unbalanced resource utilization.
By receiving resource allocation requests, the resource requirement information of the cloud server to be allocated is determined, and the available resource information of each cloud host in the host cluster is obtained. Then, based on the matching degree of resource demand information and available resource information, the target cloud host is determined, and the cloud server to be allocated is allocated to the target cloud host.
The resource utilization rate of the target cloud host is improved, resource waste is avoided, and balanced utilization of different types of resources is ensured.
Smart Images

Figure CN119847734A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource allocation method, apparatus, computer equipment, storage medium and program product. Background Art
[0002] Cloud Dedicated Host (CDH) supports users to purchase and create Cloud Virtual Machine (CVM) with exclusive host resources. CVM is used to run on cloud dedicated host resources to provide computing services. CDH cluster is composed of multiple CDHs. During the use of CDH cluster, CDH cluster resource allocation usually gives priority to scheduling to idle CDHs. However, this resource allocation method may result in the CPU in CDH being allocated but memory remaining, or memory being allocated but CPU remaining, resulting in resource waste. Summary of the invention
[0003] The present application provides a resource allocation method, apparatus, computer equipment, storage medium and program product to solve the problem of resource waste caused by existing resource allocation methods.
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present application provides a resource allocation method, apparatus, computer equipment, storage medium and program product.
[0005] On the one hand, the present application provides a resource allocation method, the method further comprising:
[0006] Upon receiving a resource allocation request, determining resource demand information corresponding to the cloud server to be allocated according to the resource allocation request, wherein the resource allocation request is used to request that the cloud server to be allocated be allocated to a cloud host, and the resource demand information is used to indicate the resource demand amount of the cloud server to be allocated for different resource types;
[0007] Obtaining available resource information corresponding to each cloud host in the host cluster, wherein the available resource information is used to indicate the remaining amount of resources of different resource types in the cloud host;
[0008] Determine the cloud host corresponding to the available resource information having the highest matching degree with the resource demand information as the target cloud host;
[0009] Allocate the to-be-allocated cloud server to the target cloud host.
[0010] On the other hand, the present application provides a resource allocation device, the resource allocation device comprising:
[0011] A processing module, configured to determine, upon receiving a resource allocation request, resource demand information corresponding to the cloud server to be allocated according to the resource allocation request, wherein the resource allocation request is used to request that the cloud server to be allocated be allocated to a cloud host, and the resource demand information is used to indicate the resource demand amount of the cloud server to be allocated for different resource types;
[0012] An acquisition module, used to acquire available resource information corresponding to each cloud host in the host cluster, wherein the available resource information is used to indicate the remaining amount of resources of different resource types in the cloud host;
[0013] A determination module, configured to determine the cloud host corresponding to the available resource information having the highest matching degree with the resource demand information as a target cloud host;
[0014] The allocation module is used to allocate the cloud server to be allocated to the target cloud host.
[0015] On the other hand, a computer device is provided, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0016] Memory, used to store computer programs;
[0017] The processor is used to implement the resource allocation method described in any embodiment of the first aspect when executing the program stored in the memory.
[0018] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the resource allocation method as described in any embodiment of the first aspect is implemented.
[0019] On the other hand, a computer program product is provided, including a computer program / instruction, which, when executed by a processor, implements the resource allocation method described in any embodiment of the first aspect.
[0020] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:
[0021] The method provided by the embodiment of the present application, when receiving a resource allocation request, determines the resource demand information corresponding to the cloud server to be allocated according to the resource allocation request, wherein the resource allocation request is used to request that the cloud server to be allocated be allocated to a cloud host machine, and the resource demand information is used to indicate the resource demand amount of the cloud server to be allocated for different resource types; obtains the available resource information corresponding to each cloud host machine in the host machine cluster, wherein the available resource information is used to indicate the remaining amount of resources of different resource types in the cloud host machine; determines the cloud host machine corresponding to the available resource information with the highest matching degree with the resource demand information as the target cloud host machine; and allocates the cloud server to be allocated to the target cloud host machine.
[0022] Based on the above method, the target cloud host is allocated to the cloud server to be allocated according to the matching degree between the resource demand information required by the cloud server to be allocated and the available resource information of each cloud host. The available resource information of the target cloud host has the highest matching degree with the resource demand information required by the cloud server to be allocated. It does not mean that the cloud server to be allocated is allocated to the cloud host with the most available resources. Allocating the cloud server to be allocated to the target cloud host can maximize the use of different types of available resources in the target cloud host, so as to improve the utilization rate of the target host and avoid the phenomenon of uneven utilization of different types of resources in the cloud host, thereby solving the problem of resource waste caused by the existing resource allocation method. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0025] Figure 1 An application environment diagram of a resource allocation method in an embodiment;
[0026] Figure 2 A schematic diagram of a resource allocation method provided in an embodiment of the present application;
[0027] Figure 3 A schematic diagram of a resource allocation method provided in an embodiment of the present application;
[0028] Figure 4 A schematic diagram of the structure of a resource allocation device provided in an embodiment of the present application;
[0029] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0031] Figure 1 FIG. 1 is an application environment diagram of a resource allocation method in an embodiment. Figure 1 , the resource allocation method is applied to a resource allocation system. The resource allocation system includes a terminal 110, a resource allocation device 120 and a host cluster 130. The terminal 110, the resource allocation device 120 and the host cluster 130 are connected via a network. The terminal 110 can be a desktop terminal 110 or a mobile terminal 110, and the mobile terminal 110 can be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The resource allocation device 120 can be implemented with an independent server or a server cluster composed of multiple servers. The host cluster 130 is composed of multiple cloud hosts 1301, and the cloud host 1301 can be implemented with an independent server or a server cluster composed of multiple servers.
[0032] In one embodiment, Figure 2 A schematic diagram of a resource allocation method in an embodiment is shown in FIG. Figure 2 , provides a resource allocation method. This embodiment mainly applies this method to the above Figure 1 Taking the resource allocation device 120 in FIG. 1 as an example, the resource allocation method specifically includes the following steps:
[0033] Step S210, when a resource allocation request is received, the resource demand information corresponding to the cloud server to be allocated is determined according to the resource allocation request, wherein the resource allocation request is used to request that the cloud server to be allocated be allocated to the cloud host 1301, and the resource demand information is used to indicate the resource demand amount of the cloud server to be allocated for different resource types.
[0034] Specifically, the cloud server to be allocated refers to the cloud server (SVM) requested to be created or purchased by the user through the terminal 110. The resource allocation request is a request initiated by the terminal 110 to the resource allocation device 120, which is used to request that the purchased or created cloud server to be allocated be allocated to any cloud host machine 1301 that can meet the allocation requirements of the cloud server to be allocated. The cloud host machine 1301 provides different types of resources for the cloud server to be allocated, so that the cloud server to be allocated can provide computing services for the terminal 110. The resource demand information is used to indicate the demand ratio between different types of resources required by the cloud server to be allocated in the cloud host machine 1301. Different types of resources include computing resources (CPU resources) and memory resources.
[0035] Step S220 , obtaining available resource information corresponding to each cloud host machine 1301 in the host machine cluster 130 , wherein the available resource information is used to indicate the remaining amount of resources of different resource types in the cloud host machine 1301 .
[0036] Specifically, the host cluster 130 includes multiple cloud host machines 1301, and the available resource information of each cloud host machine 1301 is different. The available resource information is used to indicate the remaining ratio between all different resource types in the cloud host machine 1301. Based on the available resource information, the load status of the cloud host machine 1301 can be determined, and the load status includes no load, partial load, and overload, etc.
[0037] Step S230 , determining the cloud host 1301 corresponding to the available resource information having the highest matching degree with the resource demand information as the target cloud host.
[0038] Specifically, the resource demand information is matched with the available resource information of each cloud host 1301, so as to screen out the cloud host 1301 corresponding to the available resource information with the highest matching degree with the resource demand information and determine it as the target cloud host, that is, the different types of remaining available resources in the target cloud host are matched with the required resources of different types of the cloud server to be allocated. If the cloud server to be allocated is allocated to the target cloud host, the load state of the target cloud host can reach full load or close to full load, that is, the packing rate of the target cloud host is close to the full packing rate, and the packing rate = allocation rate = allocated resources / total resources, thereby improving the resource utilization on the target cloud host.
[0039] Step S240: Allocate the cloud server to be allocated to the target cloud host.
[0040] Specifically, after determining the target cloud host that best matches the cloud server to be allocated, the cloud server to be allocated is allocated to the target cloud host to consume the remaining available resources in the target cloud host, so that the utilization rate of different types of resources in the target cloud host is as large as possible. Compared with the existing resource allocation method of allocating the cloud server to be allocated to the most idle cloud host 1301, it can avoid the phenomenon of uneven utilization of different types of resources in the cloud host 1301, thereby solving the problem of resource waste caused by the existing resource allocation method.
[0041] In one embodiment, upon receiving the resource allocation request, determining the resource requirement information corresponding to the cloud server to be allocated according to the resource allocation request includes:
[0042] Upon receiving a resource allocation request, determining the resource requirements of the to-be-allocated cloud server for different resource types according to the resource allocation request;
[0043] A first resource configuration ratio is determined according to a proportional relationship between resource requirements of the to-be-allocated cloud servers for different resource types, wherein the resource requirement information is used to indicate the first resource configuration ratio.
[0044] Specifically, the resource types required by the cloud server to be allocated in the cloud host 1301 include computing resources, memory resources, storage resources, network resources, image processing resources (GPU resources), virtual device resources, etc. Storage resources specifically include hard disk space, storage input / output bandwidth, and network resources include network bandwidth, number of network connections, etc. The resource requirements of the cloud server to be allocated for different resource types are determined by the user's configuration requirements for the cloud server to be allocated. The configuration requirements of the cloud server to be allocated specifically include service providers, parameter configurations, and billing methods. The parameter configurations specifically include cloud server models, memory parameters, video memory parameters, bandwidth parameters, etc. Billing methods include hourly payment, daily payment, monthly payment, and annual payment, etc. The higher the configuration requirements, the more resource requirements of the cloud server to be allocated for different resource types. Conversely, the lower the configuration requirements, the less resource requirements of the cloud server to be allocated for different resource types.
[0045] The resource demands corresponding to different resource types are compared in sequence to form a first resource allocation ratio. The first resource allocation ratio is c=a / b / d / e / f / …, or c=a:b:d:e:f:…, wherein a, b, d, e, f are the resource demands corresponding to different resource types. For example, a=1, b=2, d=3, e=4, f=5, then c=1:2:3:4:5, that is, the first resource allocation ratio is a ratio between the resource demands of these five resource types. The first resource allocation ratio can clearly and accurately reflect the demand situation of the cloud server to be allocated for different resource types.
[0046] In one embodiment, when receiving the resource allocation request, determining the resource requirements of the to-be-allocated cloud server for different resource types according to the resource allocation request includes:
[0047] Upon receiving a resource allocation request, determining a first number of computing cores and a first memory capacity required by the cloud server to be allocated according to the resource allocation request, wherein the first number of computing cores is the resource demand of the cloud server to be allocated for computing resources, and the first memory capacity is the resource demand of the cloud server to be allocated for memory resources;
[0048] The determining the first resource configuration ratio according to the proportional relationship between the resource demands of the to-be-allocated cloud servers for different resource types includes: determining the first resource configuration ratio according to the proportional relationship between the first number of computing cores and the first memory capacity.
[0049] Specifically, the first number of computing cores is used to indicate the demand of the cloud server to be allocated for computing resources in the cloud host 1301, and the first memory capacity is used to indicate the demand of the cloud server to be allocated for memory resources in the cloud host 1301. The minimum unit of computing resources is 1 core, and the minimum unit of memory resources is 1GB. The first number of computing cores is recorded as a, and the first memory capacity is recorded as b, that is, the first resource configuration ratio is c=a / b. The first resource configuration ratio accurately reflects the demand of the cloud server to be allocated for computing resources and memory resources, for example, the demand for computing resources is large or the demand for memory resources is large, or the demand for computing resources and the demand for memory resources are both small, or the demand for computing resources and the demand for memory resources are both large. Through the above situation, the waste of resources caused by the inability to allocate due to failure to meet the minimum allocation unit is avoided, the resource allocation rate is improved, and then the overall resource packing rate of the cluster is improved.
[0050] In one embodiment, obtaining available resource information corresponding to each cloud host 1301 in the host cluster 130 includes:
[0051] Obtain the remaining amount of resources of different resource types in each cloud host 1301 in the host cluster 130;
[0052] According to the proportional relationship between the remaining amounts of resources of different resource types in the cloud host 1301, a second resource configuration ratio corresponding to the cloud host 1301 is determined, wherein the available resource information includes the second resource configuration ratio.
[0053] Specifically, different resource types in the cloud host machine 1301 include computing resources, memory resources, storage resources, network resources, image processing resources (GPU resources), virtual device resources, etc. The remaining resources corresponding to different resource types in the cloud host machine 1301 are compared in sequence to form a second resource configuration ratio. The second resource configuration ratio is C=A / B / D / E / F / …, or C=A:B:D:E:F:…, wherein A, B, D, E, and F are the remaining resources corresponding to different resource types in the cloud host machine 1301. The comparison order between the resource types in the second resource configuration ratio is the same as the comparison order between the resource types in the first resource configuration ratio, that is, the resource type corresponding to A is the same as the resource type corresponding to a, and so on, the resource type corresponding to B is the same as the resource type corresponding to b. For example, A=3, B=2, D=1, E=3, F=5, then C=3:2:1:3:5. The second resource configuration ratio is the ratio between the remaining resources of these five resource types. The second resource configuration ratio can clearly and accurately reflect the remaining resource situation of different resource types in the cloud host 1301.
[0054] In one embodiment, obtaining the remaining amount of resources of different resource types in each cloud host 1301 in the host cluster 130 includes:
[0055] Obtain the number of available computing cores and available memory capacity corresponding to each cloud host 1301 in the host cluster 130, wherein the number of available computing cores is the remaining amount of computing resources in the cloud host 1301, and the available memory capacity is the remaining amount of memory resources in the cloud host 1301;
[0056] The determining, according to the proportional relationship between the remaining amounts of resources of different resource types in the cloud host 1301, the second resource configuration ratio corresponding to the cloud host 1301 includes:
[0057] The second resource allocation ratio is determined according to the proportional relationship between the number of available computing cores and the available memory capacity corresponding to each of the cloud host machines 1301.
[0058] Specifically, the number of available computing cores is used to indicate the remaining available computing resources in the cloud host 1301, that is, the computing resources that the cloud host 1301 can be allocated, and the available memory capacity is used to indicate the remaining available memory capacity in the cloud host 1301, that is, the memory capacity that can be allocated in the cloud host 1301. The number of available computing cores is recorded as A, and the available memory capacity is recorded as B, that is, the second resource configuration ratio is C=A / B, and the cloud host 1301 set corresponds to the resource configuration ratio set, and the resource configuration ratio set is S={C1=A1 / B1, C2=A2 / B2, ..., CN=AN / BN}, that is, the resource configuration ratio set includes the second resource configuration ratios corresponding to N different cloud hosts 1301, and the second resource configuration ratios are used to clearly and accurately reflect the proportional relationship between different types of available resources in the cloud host 1301, such as more remaining available computing resources or more remaining available memory resources, or the remaining available computing resources and the remaining available memory resources are equal.
[0059] In one embodiment, determining the cloud host 1301 corresponding to the available resource information having the highest matching degree with the resource demand information as the target cloud host includes:
[0060] Searching for the second resource configuration ratio that is the same as the first resource configuration ratio among a plurality of the second resource configuration ratios;
[0061] When the second resource configuration ratio identical to the first resource configuration ratio is found among multiple second resource configuration ratios, the cloud host 1301 corresponding to the second resource configuration ratio identical to the first resource configuration ratio is determined as the target cloud host.
[0062] Specifically, each second resource configuration ratio is compared with the first resource configuration ratio respectively, so as to screen out the second resource configuration ratio equal to the first resource configuration ratio, that is, C equal to c is preferentially screened out. If Ci=c, it means that the remaining available resources of different resource types in the i-th cloud host 1301 are the same as the resource demand for each resource type in the cloud server to be allocated, then the cloud host 1301 is selected as the target cloud host. The target cloud host not only meets the resource demand for different resource types of the cloud server to be allocated, but also ensures that the target cloud host has a full packing rate when the cloud server to be allocated is installed, so as to improve the utilization rate of different types of resources in the target cloud host and avoid the phenomenon of uneven utilization of different types of resources in the cloud host 1301.
[0063] In one embodiment, after searching for the second resource configuration ratio that is the same as the first resource configuration ratio among the plurality of second resource configuration ratios, the method further includes:
[0064] When the second resource configuration ratio identical to the first resource configuration ratio is not found in the plurality of second resource configuration ratios, the resource supply-demand ratios of different resource types between each of the cloud host machines 1301 and the cloud server to be allocated are determined according to the ratios between the remaining resources of different resource types in each of the cloud host machines 1301 in the host machine cluster 130 and the resource demand of the corresponding resource type by the cloud server to be allocated;
[0065] The cloud host 1301 having the largest number of resource supply-demand ratios whose values are positive integers is determined as the target cloud host.
[0066] Specifically, when the second resource configuration ratio that is the same as the first resource configuration ratio is not found, it is further determined whether the ratio between the remaining amount of resources of different resource types in the cloud host 1301 and the resource demand of the corresponding resource type by the to-be-allocated cloud server is a positive integer, that is, the ratios are calculated respectively. If the remaining resources of different resource types in the cloud host 1301 can divide the resource demand of the same resource type by the cloud server to be allocated, it means that the remaining resources of different resource types in the cloud host 1301 are positive integer multiples of the resource demand of the same resource type by the cloud server to be allocated, and resources can be allocated to a number of cloud servers to be allocated corresponding to the positive integer multiple for the same type of cloud servers to be allocated, so that the cloud host 1301 reaches a full load state, so as to maximize the packing rate of the cloud host 1301. Therefore, when the multiple resource supply-demand ratios between the cloud host 1301 and the cloud server to be allocated are all positive integers, it means that the cloud host 1301 is the cloud host 1301 with the largest number of resource supply-demand ratios whose values are positive integers, and the cloud host 1301 is determined as the target cloud host.
[0067] For example, when the different resource types include computing resources and memory resources, the cloud host 1301 that meets the following conditions is determined as the target cloud host:
[0068]
[0069] Among them, CDH cpu is the remaining amount of computing resources in the cloud host 1301, CDH mem The remaining amount of memory resources of the cloud host 1301, CVM cpu The resource demand of the cloud server to be allocated for computing resources, CVM memis the resource demand of the cloud server to be allocated for memory resources, Y1 and Y2 are arbitrary positive integers. When Y1≤Y2 are equal, for the same type of cloud servers to be allocated, resources can also be allocated to Y1 cloud servers to be allocated so that the cloud host machine 1301 reaches full load, thereby maximizing the packing rate of the cloud host machine 1301.
[0070] If the resource supply-demand ratios for different resource types between all cloud hosts 1301 and the cloud servers to be allocated are not all positive integers, then the cloud hosts 1301 with the largest number of resource supply-demand ratios that are positive integers are selected as the target cloud hosts. For example, two of the resource supply-demand ratios for different resource types between the first cloud host and the cloud servers to be allocated are positive integers ( and ), and one of the resource supply-demand ratios for different resource types between the second cloud host and the cloud server to be allocated is a positive integer The first cloud host is preferentially selected as the target cloud host to improve the resource utilization of different resource types in the cloud host 1301 as much as possible.
[0071] In one embodiment, after determining the resource supply-demand ratio between the cloud server to be allocated and each of the cloud hosts 1301 with respect to different resource types according to the ratio between the resource demand of the cloud server to be allocated for different resource types and the resource surplus of the corresponding resource types in each cloud host 1301 in the host cluster 130, the method further includes:
[0072] When there is no resource supply-demand ratio with a positive integer value in the resource supply-demand ratios between each of the cloud host machines 1301 and the to-be-allocated cloud servers for different resource types, a plurality of configuration supply-demand ratios are obtained according to a proportional relationship between the first resource configuration ratio and each of the second resource configuration ratios;
[0073] Obtaining a plurality of distance values according to the absolute value of the difference between the preset value and each of the configured supply-demand ratios;
[0074] The cloud host 1301 corresponding to the second resource configuration ratio associated with the smallest distance value is determined as the target cloud host.
[0075] Specifically, if there is no resource supply-demand ratio with a positive integer value in the resource supply-demand ratios between each of the cloud host machines 1301 and the cloud servers to be allocated for different resource types, the cloud host machine 1301 corresponding to the second resource configuration ratio with the smallest difference from the first resource configuration ratio is selected as the target cloud host machine, and the distance value between the first resource configuration ratio and the second resource configuration ratio is calculated as follows: first, the proportional relationship between the first resource configuration ratio and each second resource configuration ratio is calculated to obtain multiple configuration supply-demand ratios, which are c / C1, c / C2, c / C3, ..., c / CN respectively; then, the absolute value of the difference between the preset value and each configuration supply-demand ratio is calculated to obtain multiple distance values, which are respectively |Xc / C1|, |Xc / C2)|, ..., |Xc / CN|, where X is a preset value, the preset value is an arbitrary positive integer, and in this embodiment, the preset value is set to 1, then the multiple distance values are |1-c / C1|, |1-c / C2)|, ..., |1-c / CN|, and the cloud host 1301 corresponding to the second resource configuration ratio related to the smallest distance value is taken as the target cloud host, so as to select the cloud host 1301 whose resource remaining amount of each resource type is closest to the resource demand amount of each resource type for the cloud server to be allocated, and after the cloud server to be allocated is allocated to the target cloud host, the resource utilization rate of each resource type in the target cloud host is improved as much as possible.
[0076] Reference Figure 3 In a specific embodiment, the cloud host machine 1301 cluster 130 (CDH cluster) is composed of N cloud host machines 1301 (CDH), and the number of available computing cores of each CDH is A cores and the available memory capacity is B GB. The resource allocation request initiated by the resource demander indicates that n cloud servers (cvm) with a core and b GB are required to be allocated.
[0077] The following describes the allocation process for n a-core b GB CVMs in a hypothetical scenario:
[0078] 1. Obtain resource allocation requests submitted by resource demanders to request the allocation of n a-core b GB CVMs.
[0079] 2. Calculate the first resource allocation ratio of the cloud server to be allocated: c = a / b.
[0080] 3. Obtain the second resource allocation ratio corresponding to each cloud host 1301 in the cloud host 1301 cluster 130: C1=A1 / B1, C2=A2 / B2...CN=AN / BN.
[0081] 4. Optimal match check: Compare c and C1 to see if they are equal. If they are equal, allocate the cloud server to be allocated to the cloud host 1301. If they are not equal, continue to compare c and C2 to see if they are equal, until c and CN are compared. If they are not equal, start the suboptimal match check.
[0082] 5. Suboptimal match check: Calculate |1-c / C1|, |1-c / C2)|, ..., |1-c / CN| respectively, and sort the calculation results from small to large. The smaller the result, the closer the ratio between the two is. Select the cloud host 1301 with the smallest result as the target cloud host for allocation.
[0083] 6. Repeat the above 2-5 steps until the resource allocation of n a-cores and b GB is completed.
[0084] Based on the above method, the CPU resources and memory resources on the cloud host 1301 are allocated in the same proportion, thereby avoiding the situation where there is surplus CPU resources or memory resources.
[0085] Figure 2 and Figure 3 FIG. 1 is a flow chart of a resource allocation method in one embodiment. It should be understood that although Figure 2 and Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 and Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0086] In one embodiment, Figure 4 As shown, a resource allocation device 120 is provided, comprising:
[0087] The processing module 310 is used to determine the resource demand information corresponding to the cloud server to be allocated according to the resource allocation request when receiving the resource allocation request, wherein the resource allocation request is used to request that the cloud server to be allocated be allocated to the cloud host 1301, and the resource demand information is used to indicate the resource demand amount of the cloud server to be allocated for different resource types;
[0088] The acquisition module 320 is used to obtain available resource information corresponding to each cloud host 1301 in the host cluster 130, wherein the available resource information is used to indicate the remaining amount of resources of different resource types in the cloud host 1301;
[0089] A determination module 330 is used to determine the cloud host 1301 corresponding to the available resource information having the highest matching degree with the resource demand information as a target cloud host;
[0090] The allocation module 340 is used to allocate the to-be-allocated cloud server to the target cloud host.
[0091] In one embodiment, the processing module 310 is further configured to:
[0092] Upon receiving a resource allocation request, determining the resource requirements of the to-be-allocated cloud server for different resource types according to the resource allocation request;
[0093] A first resource configuration ratio is determined according to a proportional relationship between resource requirements of the to-be-allocated cloud servers for different resource types, wherein the resource requirement information includes the first resource configuration ratio.
[0094] In one embodiment, the processing module 310 is further configured to:
[0095] Upon receiving a resource allocation request, determining a first number of computing cores and a first memory capacity required by the cloud server to be allocated according to the resource allocation request, wherein the first number of computing cores is the resource demand of the cloud server to be allocated for computing resources, and the first memory capacity is the resource demand of the cloud server to be allocated for memory resources;
[0096] A first resource allocation ratio is determined according to a proportional relationship between the number of the first computing cores and the first memory capacity.
[0097] In one embodiment, the acquisition module 320 is further used to:
[0098] Obtain the remaining amount of resources of different resource types in each cloud host 1301 in the host cluster 130;
[0099] According to the proportional relationship between the remaining amounts of resources of different resource types in the cloud host 1301, a second resource configuration ratio corresponding to the cloud host 1301 is determined, wherein the available resource information includes the second resource configuration ratio.
[0100] In one embodiment, the acquisition module 320 is further used to:
[0101] Obtain the number of available computing cores and available memory capacity corresponding to each cloud host 1301 in the host cluster 130, wherein the number of available computing cores is the remaining amount of computing resources in the cloud host 1301, and the available memory capacity is the remaining amount of memory resources in the cloud host 1301;
[0102] The second resource allocation ratio is determined according to the proportional relationship between the number of available computing cores and the available memory capacity corresponding to each of the cloud host machines 1301.
[0103] In one embodiment, the determining module 330 is further configured to:
[0104] searching for the second resource configuration ratio that is the same as the first resource configuration ratio among a plurality of the second resource configuration ratios, wherein the resource demand information includes the first resource configuration ratio;
[0105] When the second resource configuration ratio identical to the first resource configuration ratio is found among multiple second resource configuration ratios, the cloud host 1301 corresponding to the second resource configuration ratio identical to the first resource configuration ratio is determined as the target cloud host.
[0106] In one embodiment, the determining module 330 is further configured to:
[0107] When the second resource configuration ratio identical to the first resource configuration ratio is not found in the plurality of second resource configuration ratios, the resource supply-demand ratios of different resource types between each of the cloud host machines 1301 and the cloud server to be allocated are determined according to the ratios between the remaining resources of different resource types in each of the cloud host machines 1301 in the host machine cluster 130 and the resource demand of the corresponding resource type by the cloud server to be allocated;
[0108] The cloud host 1301 having the largest number of resource supply-demand ratios whose values are positive integers is determined as the target cloud host.
[0109] In one embodiment, the determining module 330 is further configured to:
[0110] When there is no resource supply-demand ratio with a positive integer value in the resource supply-demand ratios between each of the cloud host machines 1301 and the to-be-allocated cloud servers for different resource types, a plurality of configuration supply-demand ratios are obtained according to a proportional relationship between the first resource configuration ratio and each of the second resource configuration ratios;
[0111] Obtaining a plurality of distance values according to the absolute value of the difference between the preset value and each of the configured supply-demand ratios;
[0112] The cloud host 1301 corresponding to the second resource configuration ratio associated with the smallest distance value is determined as the target cloud host.
[0113] like Figure 5 As shown, an embodiment of the present application provides a computer device, including a processor 711, a communication interface 712, a memory 713 and a communication bus 714, wherein the processor 711, the communication interface 712, and the memory 713 communicate with each other through the communication bus 714;
[0114] Memory 713, used for storing computer programs;
[0115] The processor 711 is used to implement the resource allocation method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 713.
[0116] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0117] In one embodiment, the resource allocation device 120 provided in the present application can be implemented in the form of a computer program. The computer program can be Figure 5 The memory of the computer device may store various program modules constituting the resource allocation device 120, for example, Figure 4 The processing module 310, the acquisition module 320, the determination module 330 and the allocation module 340 are shown. The computer program composed of various program modules enables the processor to execute the steps of the resource allocation method of each embodiment of the present application described in this specification.
[0118] Figure 5 The computer device shown can be Figure 4The processing module 310 in the resource allocation device 120 shown in the figure determines the resource demand information corresponding to the cloud server to be allocated according to the resource allocation request when receiving the resource allocation request, wherein the resource allocation request is used to request that the cloud server to be allocated be allocated to the cloud host 1301, and the resource demand information is used to indicate the resource demand amount of the cloud server to be allocated for different resource types. The computer device can obtain the available resource information corresponding to each cloud host 1301 in the host cluster 130 through the acquisition module 320, wherein the available resource information is used to indicate the remaining amount of resources of different resource types in the cloud host 1301. The computer device can determine the cloud host 1301 corresponding to the available resource information with the highest matching degree with the resource demand information as the target cloud host through the determination module 330. The computer device can allocate the cloud server to be allocated to the target cloud host through the allocation module 340.
[0119] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the resource allocation method provided in any of the aforementioned method embodiments is implemented.
[0120] An embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the resource allocation method provided in any of the aforementioned method embodiments.
[0121] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0122] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A resource allocation method, characterized in that: The method further comprises: Upon receiving a resource allocation request, determining resource demand information corresponding to the cloud server to be allocated according to the resource allocation request, wherein the resource allocation request is used to request that the cloud server to be allocated be allocated to a cloud host, and the resource demand information is used to indicate the resource demand amount of the cloud server to be allocated for different resource types; Obtaining available resource information corresponding to each cloud host in the host cluster, wherein the available resource information is used to indicate the remaining amount of resources of different resource types in the cloud host; Determine the cloud host corresponding to the available resource information having the highest matching degree with the resource demand information as the target cloud host; Allocate the to-be-allocated cloud server to the target cloud host.
2. The resource allocation method according to claim 1, characterized in that: When receiving the resource allocation request, determining the resource requirement information corresponding to the cloud server to be allocated according to the resource allocation request includes: Upon receiving a resource allocation request, determining the resource requirements of the to-be-allocated cloud server for different resource types according to the resource allocation request; A first resource configuration ratio is determined according to a proportional relationship between resource requirements of the to-be-allocated cloud servers for different resource types, wherein the resource requirement information includes the first resource configuration ratio.
3. The resource allocation method according to claim 2, characterized in that: When receiving the resource allocation request, determining the resource demand of the to-be-allocated cloud server for different resource types according to the resource allocation request includes: Upon receiving a resource allocation request, determining a first number of computing cores and a first memory capacity required by the cloud server to be allocated according to the resource allocation request, wherein the first number of computing cores is the resource demand of the cloud server to be allocated for computing resources, and the first memory capacity is the resource demand of the cloud server to be allocated for memory resources; The determining the first resource configuration ratio according to the proportional relationship between the resource demands of the to-be-allocated cloud servers for different resource types includes: determining the first resource configuration ratio according to the proportional relationship between the first number of computing cores and the first memory capacity.
4. The resource allocation method according to claim 1, characterized in that: The obtaining of available resource information corresponding to each cloud host in the host cluster includes: Get the remaining amount of different resource types in each cloud host in the host cluster; A second resource configuration ratio corresponding to the cloud host is determined according to a proportional relationship between remaining resources of different resource types in the cloud host, wherein the available resource information includes the second resource configuration ratio.
5. The resource allocation method according to claim 4, characterized in that: The obtaining of remaining resources of different resource types in each cloud host in the host cluster includes: Obtain the number of available computing cores and available memory capacity corresponding to each cloud host in the host cluster, wherein the number of available computing cores is the remaining amount of computing resources in the cloud host, and the available memory capacity is the remaining amount of memory resources in the cloud host; The determining, according to the proportional relationship between the remaining amounts of resources of different resource types in the cloud host, a second resource configuration ratio corresponding to the cloud host includes: The second resource allocation ratio is determined according to the proportional relationship between the number of available computing cores and the available memory capacity corresponding to each of the cloud host machines.
6. The resource allocation method according to claim 5, characterized in that: The step of determining the cloud host corresponding to the available resource information having the highest matching degree with the resource demand information as the target cloud host includes: searching for the second resource configuration ratio that is the same as the first resource configuration ratio among a plurality of the second resource configuration ratios, wherein the resource demand information includes the first resource configuration ratio; When the second resource configuration ratio identical to the first resource configuration ratio is found among the plurality of second resource configuration ratios, the cloud host corresponding to the second resource configuration ratio identical to the first resource configuration ratio is determined as the target cloud host.
7. The resource allocation method according to claim 6, characterized in that: After searching the plurality of second resource configuration ratios for the second resource configuration ratio that is the same as the first resource configuration ratio, the method further includes: When the second resource configuration ratio identical to the first resource configuration ratio is not found in the plurality of second resource configuration ratios, determining the resource supply-demand ratios of different resource types between each of the cloud hosts and the cloud servers to be allocated according to the ratios between the remaining resources of different resource types in each of the cloud hosts in the host cluster and the resource requirements of the cloud servers to be allocated for the corresponding resource types; The cloud host machine having the largest number of resource supply-demand ratios whose values are positive integers is determined as the target cloud host machine.
8. The resource allocation method according to claim 7, characterized in that: After determining the resource supply-demand ratio between the cloud server to be allocated and each of the cloud hosts with respect to different resource types according to the ratio between the resource demand of the cloud server to be allocated for different resource types and the resource surplus of the corresponding resource types in each cloud host in the host cluster, the method further includes: When there is no resource supply-demand ratio with a positive integer value among the resource supply-demand ratios between each of the cloud host machines and the to-be-allocated cloud servers for different resource types, a plurality of configuration supply-demand ratios are obtained according to a proportional relationship between the first resource configuration ratio and each of the second resource configuration ratios; Obtaining a plurality of distance values according to the absolute value of the difference between the preset value and each of the configured supply-demand ratios; The cloud host corresponding to the second resource configuration ratio associated with the smallest distance value is determined as the target cloud host.
9. A resource allocation device, characterized in that: The resource allocation device comprises: A processing module, configured to determine, upon receiving a resource allocation request, resource demand information corresponding to the cloud server to be allocated according to the resource allocation request, wherein the resource allocation request is used to request that the cloud server to be allocated be allocated to a cloud host, and the resource demand information is used to indicate the resource demand amount of the cloud server to be allocated for different resource types; An acquisition module, used to acquire available resource information corresponding to each cloud host in the host cluster, wherein the available resource information is used to indicate the remaining amount of resources of different resource types in the cloud host; A determination module, configured to determine the cloud host corresponding to the available resource information having the highest matching degree with the resource demand information as a target cloud host; The allocation module is used to allocate the cloud server to be allocated to the target cloud host.
10. A computer device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, used to implement the resource allocation method described in any one of claims 1-8 when executing a program stored in a memory.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the resource allocation method according to any one of claims 1 to 8 is implemented.
12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the resource allocation method according to any one of claims 1 to 8 is implemented.