Resource allocation method, device and equipment for public cluster and readable storage medium
By automating the resource allocation process in public clusters, the problem of inaccurate resource allocation caused by manual operations is solved, and efficient and accurate resource management and cost control are achieved.
Patent Information
- Application Number
- CN202411584542.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, the allocation of public cluster resources depends on manual operations, which is prone to problems such as slow information input and errors in data input, resulting in resource allocation and billing that cannot accurately reflect the actual use situation, affecting reasonable resource allocation and cost control.
By determining multiple resource dimensions and allocation ratios associated with the public cluster every time at preset configuration cycles, automatically allocating resources to ensure the accuracy and efficiency of resource allocation. The specific steps include: determining the resource dimension and allocation ratio, allocating the total amount to be allocated, querying the resource allocation ratio of the subsystem, and allocating resources to the subsystem.
It realizes the automation of resource allocation, avoids errors in manual operations, ensures the accuracy of resource allocation and billing, greatly improves resource allocation efficiency, and helps enterprises more accurately control costs and optimize resource usage through multi-resource dimension management.
Smart Images

Figure CN119537001A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and readable storage medium for allocating resources of a public cluster. Background Art
[0002] Public cluster is a computing resource sharing model in a multi-tenant environment, where multiple users or tenants share the same set of hardware resources, such as servers, storage and network devices. Each tenant may have different requirements for resources in different business time periods. Therefore, how to reasonably allocate these shared resources to avoid resource waste or excessive competition has become a key issue that needs to be solved.
[0003] Currently, many companies rely on manual allocation operations for resource allocation. However, manual allocation operations may lead to problems such as slow information input and data input errors, which may result in resource allocation and billing failing to accurately reflect actual usage, affecting the reasonable allocation of resources and cost control. Summary of the invention
[0004] In view of this, the present application provides a resource allocation method, device, equipment and readable storage medium for a public cluster. The main purpose is to solve the problems of slow information input, data input errors, etc. that may occur in the current manual allocation operation, resulting in resource allocation and billing unable to accurately reflect actual usage, affecting the reasonable allocation of resources and cost control.
[0005] According to a first aspect of the present application, a method for allocating resources of a public cluster is provided, the method comprising:
[0006] At every preset configuration period, determining a plurality of resource dimensions associated with a public cluster and a resource allocation ratio corresponding to each of the resource dimensions, wherein the public cluster includes a plurality of subsystems;
[0007] Allocate the total amount to be allocated associated with the public cluster according to the resource allocation ratio corresponding to each resource dimension, and determine the total amount of resource allocation corresponding to each resource dimension;
[0008] Query the system resource allocation ratio corresponding to each of the subsystems under each of the resource dimensions, and allocate the total resource allocation amount corresponding to each of the resource dimensions according to the queried system resource allocation ratio to determine the system allocation amount corresponding to each of the subsystems under each of the resource dimensions;
[0009] Resources are allocated to each subsystem according to the system allocation amount corresponding to each subsystem under each resource dimension, wherein, for each resource dimension, the resource type of the resources allocated to each subsystem matches the resource dimension and the resource quantity is equal to the system allocation amount corresponding to the subsystem under the resource dimension.
[0010] According to a second aspect of the present application, a resource allocation device for a public cluster is provided, the device comprising:
[0011] A first determination module is used to determine, at every preset configuration period, a plurality of resource dimensions associated with a public cluster and a resource allocation ratio corresponding to each of the resource dimensions, wherein the public cluster includes a plurality of subsystems;
[0012] A second determination module is used to allocate the total amount to be allocated associated with the public cluster according to the resource allocation ratio corresponding to each resource dimension, and determine the total amount of resource allocation corresponding to each resource dimension;
[0013] The third determination module is used to query the system resource allocation ratio corresponding to each of the subsystems under each of the resource dimensions, and allocate the total resource allocation amount corresponding to each of the resource dimensions according to the queried system resource allocation ratio to determine the system allocation amount corresponding to each of the subsystems under each of the resource dimensions;
[0014] An allocation module is used to allocate resources to each subsystem according to the system allocation amount corresponding to each subsystem under each resource dimension, wherein, for each resource dimension, the resource type of the resources allocated to each subsystem matches the resource dimension and the resource amount is equal to the system allocation amount corresponding to the subsystem under the resource dimension.
[0015] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.
[0016] According to a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the methods described in the first aspect are implemented.
[0017] By means of the above technical solution, the present application provides a method, device, equipment and readable storage medium for allocating resources of a public cluster. The present application first determines multiple resource dimensions associated with the public cluster and the resource allocation ratio corresponding to each resource dimension every preset configuration period, wherein the public cluster includes multiple subsystems. Further, according to the resource allocation ratio corresponding to each resource dimension, the total amount to be allocated associated with the public cluster is allocated to determine the total amount of resource allocation corresponding to each resource dimension. Next, the system resource allocation ratio corresponding to each subsystem under each resource dimension is queried, and the total amount of resource allocation corresponding to each resource dimension is allocated according to the queried system resource allocation ratio to determine the system allocation amount corresponding to each subsystem under each resource dimension. Finally, according to the system allocation amount corresponding to each subsystem under each resource dimension, resources are allocated to each subsystem, wherein, for each resource dimension, the resource type of the resources allocated to each subsystem matches the resource dimension and the resource amount is equal to the system allocation amount corresponding to the subsystem under the resource dimension. In the embodiment of the present application, the resource allocation system automatically allocates resources according to the preset cycle and ratio without manual intervention, which can avoid the problems of slow information input and data input errors that may occur in the manual allocation process, ensure that resource allocation and billing can accurately reflect the actual usage, and thus greatly improve the efficiency of resource allocation. In addition, the embodiment of the present application allocates resources through multiple resource dimensions and system resource allocation ratios, which can achieve more fine-grained management of resources, thereby helping enterprises to control costs more accurately and optimize resource use.
[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0020] Figure 1 A schematic diagram of a resource allocation method for a public cluster provided in an embodiment of the present application is shown;
[0021] Figure 2 A schematic diagram of a resource allocation method for a public cluster provided in an embodiment of the present application is shown;
[0022] Figure 3A schematic diagram of a resource allocation method for a public cluster provided in an embodiment of the present application is shown;
[0023] Figure 4 A schematic diagram of a resource allocation method for a public cluster provided in an embodiment of the present application is shown;
[0024] Figure 5 A schematic diagram of a resource allocation method for a public cluster provided in an embodiment of the present application is shown;
[0025] Figure 6 A schematic diagram of the structure of a resource allocation device for a public cluster provided in an embodiment of the present application is shown;
[0026] Figure 7 A schematic diagram of the device structure of a computer device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0027] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0028] Public cluster is a computing resource sharing model in a multi-tenant environment, in which multiple users or tenants share the same set of hardware resources, such as servers, storage and network devices, and each tenant may have different requirements for resources in different business time periods. Therefore, how to reasonably allocate these shared resources to avoid resource waste or excessive competition has become a key issue that needs to be solved. Currently, many enterprises rely on manual allocation operations for resource allocation. However, manual allocation operations may have problems such as slow information input and data input errors, which leads to the allocation and billing of resources failing to accurately reflect the actual usage, affecting the reasonable allocation and cost control of resources. The resource allocation method for a public cluster provided in an embodiment of the present invention is applicable to a resource allocation system for a public cluster. Relevant technicians can access the visual interface provided by the resource allocation system based on the terminal device in advance, and then set the resource configuration cycle and the resource dimension to be allocated and other parameters on the visual interface. Among them, the terminal device can be but not limited to various personal computers, laptops, smart phones and tablet computers.
[0029] See also Figure 1 As shown, Figure 1 A schematic flow chart of a method for allocating resources of a public cluster provided in an embodiment of the present invention includes the following steps:
[0030] S10. Determine, at every preset configuration period, a plurality of resource dimensions associated with a public cluster and a resource allocation ratio corresponding to each resource dimension, wherein the public cluster includes a plurality of subsystems.
[0031] In the embodiment of the present application, the multiple resource dimensions include but are not limited to CPU resource dimension, memory resource dimension and storage resource dimension. The public cluster has multiple subsystems, each of which corresponds to multiple subqueues. In the actual operation process, the resource allocation system can adjust the timing duration of the timer according to the preset configuration period. When the timing duration of the timer reaches the preset configuration period, Figure 2 The execution steps S10 to S40 shown in the figure determine the corresponding system allocation amount of each subsystem under each resource dimension, and then allocate resources to each subsystem according to the system allocation amount. Among them, the preset configuration period can adopt the system default period, such as one month, or it can adopt the period set by the technician according to actual needs, such as 10 days, 15 days, 20 days, etc. The length of the preset configuration period is not specifically limited in this application. In addition, the resource allocation system can also provide a visual interface, so that managers can more conveniently set resource allocation cycles, resource dimension parameters and view resource usage reports based on the visual interface. The visual interface can support access from multiple terminal devices, including personal computers, laptops, smart phones and tablets, etc., to meet the operational needs of different managers.
[0032] S11. Determine the resource utilization rate corresponding to each resource dimension, and take the sum of all resource utilization rates as the total resource utilization rate.
[0033] In the embodiment of the present application, in order to allocate resources to each subsystem in the public cluster according to resource dimensions, it is necessary to determine the resource utilization rate corresponding to each resource dimension, so as to facilitate the subsequent calculation of the resource allocation ratio corresponding to each resource dimension according to the resource utilization rate corresponding to each resource dimension. Figure 3 As shown, when the resource dimension is the CPU resource dimension or the memory resource dimension, the resource utilization rate corresponding to the resource dimension is determined according to the following step S111. When the resource dimension is the storage resource dimension, the resource utilization rate corresponding to the resource dimension is determined according to the following step S112. Finally, the resource utilization rates of all resource dimensions are summarized and their sum is calculated. It should be noted that the sum represents the total resource utilization rate of all resource dimensions in the public cluster. By calculating the resource utilization rate corresponding to each resource dimension, the resource utilization of the public cluster can be fully understood, thereby providing a basis for resource scheduling and optimization to ensure the stable operation of the public cluster system and the efficient use of resources.
[0034] S111. When the resource dimension is a CPU resource dimension or a memory resource dimension, determine a CPU resource usage rate or a memory resource usage rate corresponding to the resource dimension.
[0035] In an embodiment of the present application, when the resource dimension is a CPU resource dimension or a memory resource dimension, first determine the multiple real-time resource usage values corresponding to the root queue. During the actual operation process, the resource allocation system records the real-time usage value of the root queue once a minute, and determines the real-time usage value of the root queue collected within the preset configuration period as the real-time resource usage value corresponding to the current resource dimension. It should be noted that the root queue is a root queue associated with a public cluster, including multiple sub-queues, and each sub-queue corresponds to a unique subsystem. Further, the resource allocation system draws a resource usage line graph of the root queue based on multiple real-time resource usage values. Subsequently, in order to more accurately evaluate the resource usage, the resource allocation system uses an integral method or a trapezoidal method to calculate the offline area of the resource usage line graph to obtain the actual resource usage area corresponding to the resource dimension. Next, calculate the offline area of the preset resource quota line graph to obtain the resource quota area corresponding to the resource dimension. It should be noted that the preset resource quota is usually pre-set by the system administrator based on the overall resource situation and business needs of the cluster, which can ensure the reasonable allocation and use of resources. Finally, the resource utilization rate (CPU resource utilization rate or memory resource utilization rate) corresponding to the resource dimension is determined based on the ratio between the actual resource usage area and the resource quota area. Resource utilization rate reflects the relationship between the actual resource usage and the preset quota. By calculating the resource utilization rate, you can better monitor and manage resource usage, ensure efficient resource utilization, and adjust resource quotas in a timely manner to meet changing business needs.
[0036] S112: When the resource dimension is a storage resource dimension, determine the storage resource usage rate corresponding to the resource dimension.
[0037] In this step, when the resource dimension is a storage resource dimension, the resource allocation system first selects a specified collection time period within the current configuration cycle. Taking the preset configuration cycle as one month as an example, the specified collection time period can be the last day of each month. Further, the resource allocation system queries the total database usage associated with the specified collection time period. Finally, the ratio between the total database usage and the total database storage corresponding to the public cluster is calculated, and the storage resource usage corresponding to the resource dimension is determined based on the ratio.
[0038] S12. Calculate the ratio between the resource utilization rate corresponding to each resource dimension and the total resource utilization rate, and determine the resource allocation ratio corresponding to each resource dimension according to the ratio.
[0039] In an embodiment of the present application, the total resource utilization is the sum of the CPU resource utilization, the memory resource utilization, and the storage resource utilization. Furthermore, the resource allocation system calculates the ratio between the resource utilization corresponding to each resource dimension and the total resource utilization, and then determines the resource allocation ratio corresponding to each resource dimension based on the ratio. Specifically, the ratio between the CPU resource utilization and the total resource utilization is calculated to obtain the CPU resource allocation ratio. The ratio between the memory resource utilization and the total resource utilization is calculated to obtain the memory resource allocation ratio. The ratio between the storage resource utilization and the total resource utilization is calculated to obtain the storage resource allocation ratio.
[0040] S20. Allocate the total amount to be allocated associated with the public cluster according to the resource allocation ratio corresponding to each resource dimension, and determine the total amount of resource allocation corresponding to each resource dimension.
[0041] In order to meet the specific needs of different resource dimensions and ensure the efficient operation of the entire public cluster. In an embodiment of the present application, the resource allocation system needs to split the total amount to be allocated associated with the public cluster according to the resource dimension according to the resource allocation ratio corresponding to each resource dimension, and then obtain the total amount of resource allocation corresponding to each resource dimension. Specifically, calculate the product of the CPU resource allocation ratio and the total amount to be allocated to obtain the total amount of resource allocation corresponding to the CPU resource dimension. Calculate the product of the memory resource allocation ratio and the total amount to be allocated to obtain the total amount of resource allocation corresponding to the memory resource dimension. Calculate the product of the storage resource allocation ratio and the total amount to be allocated to obtain the total amount of resource allocation corresponding to the storage resource dimension.
[0042] S30. Query the system resource allocation ratio corresponding to each subsystem under each resource dimension, and allocate the total resource allocation amount corresponding to each resource dimension according to the queried system resource allocation ratio to determine the system allocation amount corresponding to each subsystem under each resource dimension.
[0043] In the embodiment of the present application, considering that there are multiple subsystems under the public cluster, in order to ensure that each subsystem can obtain sufficient support in each resource dimension to improve the operating efficiency and stability of the entire system. The resource allocation system also needs to determine the system allocation amount corresponding to each subsystem in each resource dimension. Figure 4As shown, when the resource dimension is the CPU resource dimension or the memory resource dimension, the following step S31 is executed to allocate the total resource allocation amount corresponding to each resource dimension according to the queried system resource allocation ratio, and determine the system allocation amount corresponding to each subsystem under the CPU resource dimension or the memory resource dimension. When the resource dimension is the storage resource dimension, the following step S32 is executed to allocate the total resource allocation amount corresponding to each resource dimension according to the queried system resource allocation ratio, and determine the system allocation amount corresponding to each subsystem under the storage resource dimension.
[0044] S31. When the resource dimension is a CPU resource dimension or a memory resource dimension, determine the system allocation amount corresponding to each subsystem under the resource dimension.
[0045] In the embodiment of the present application, considering the characteristics of current big data application scenarios, the value of CPU resources and memory resources in different time periods of the day is also different. Generally speaking, the resource usage value in the early morning period is higher than that in the daytime and evening periods. Therefore, in the actual application process, Figure 5 As shown, the resource allocation system introduces statistical period parameters, and dynamically adjusts the system resource allocation ratio corresponding to each subsystem in each statistical period by determining the queue resource utilization rate associated with each subqueue corresponding to each subsystem in each statistical period, thereby achieving reasonable allocation of resource costs.
[0046] S311. When the resource dimension is a CPU resource dimension or a memory resource dimension, determine a total usage amount of a first resource associated with the resource dimension in a current preset configuration period, where the preset configuration period includes multiple collection time periods.
[0047] Taking the preset configuration cycle of one month as an example, in this step, the preset configuration cycle includes multiple collection time periods, and the collection time period can be one day. When the resource dimension is the CPU resource dimension or the memory resource dimension, determine the total first resource usage RootVol_month associated with the resource dimension in the current preset configuration cycle. It should be noted that the total first resource usage is the total usage of the CPU resource dimension or the memory resource dimension in the preset configuration cycle.
[0048] S312: Determine the resource usage associated with the resource dimension in each collection time period, split the resource usage associated in each collection time period according to multiple preset statistical time periods, and obtain the specified resource usage corresponding to each collection time period in each statistical time period.
[0049] In this step, the resource allocation system divides each collection time period into three statistical periods, namely early morning (0:00 to 8:00), daytime (8:00 to 16:00) and night (16:00 to 24:00). The resource allocation system first determines the daily resource usage of the CPU resource dimension or the memory resource dimension, and then divides the daily resource usage according to the statistical period to obtain the specified resource usage corresponding to each collection time period in each statistical period. For example, the CPU resource usage on the 14th is 100 units. The 100 units of CPU resource usage are re-divided according to the statistical period. The CPU resource usage used in the early morning period (0:00 to 8:00) is 30 units. The CPU resource usage used in the daytime period (8:00 to 16:00) is 50 units. The CPU resource usage used in the night period (16:00 to 24:00) is 20 units.
[0050] S313: determine all designated resource usages corresponding to each statistical period as target usages, calculate the sum of all target usages as period resource usages, and use the ratio between the period resource usages and the first resource usage total as the period weight corresponding to the statistical period.
[0051] In this step, all the specified resource usage corresponding to each statistical period is determined as the target usage, and the sum of all the target usage is calculated as the period resource usage RootVol_time, and the ratio between the period resource usage RootVol_time and the first resource usage total RootVol_month is used as the period weight W_time corresponding to the statistical period. The specific process of calculating the period weight is shown in the following formula 1:
[0052] Formula 1: W_time=RootVol_time / RootVol_month
[0053] The embodiment of the present application obtains the time period weight by collecting statistics and analyzing the resource usage in each statistical period, and provides a basis for subsequent resource allocation. The time period weight reflects the importance or priority of the time period in the entire statistical cycle.
[0054] S314: Determine a plurality of sub-queues corresponding to each sub-system, and determine a time period resource usage rate corresponding to each sub-queue in each statistical time period.
[0055] In this step, the resource allocation system first determines the multiple sub-queues corresponding to each subsystem. For the CPU resource dimension or the memory resource dimension, the resource allocation system needs to determine the total amount of the second resource usage of the root queue within the preset configuration period. It should be noted that the total amount of the second resource usage is the total amount of CPU resources or memory resources used by the root queue within the preset configuration period. Further, the queue resource usage SubQVol_time of each sub-queue in the statistical period is determined, the ratio between each queue resource usage SubQVol_time and the total amount of the second resource usage is calculated, and the time period resource usage R_time corresponding to each sub-queue in the statistical period is determined according to the ratio.
[0056] S315: Calculate the product of the resource utilization rate of each period in each statistical period and the period weight of the corresponding statistical period to obtain the queue resource utilization rate associated with each subqueue in each statistical period, and calculate the sum of the resource utilization rates of all queues.
[0057] In this step, in order to more accurately evaluate the resource usage of each subqueue in different statistical time periods, under the CPU resource dimension or the memory resource dimension, for any subqueue, the resource allocation system needs to calculate the product of the resource usage R_time corresponding to the subqueue in each time period and the time period weight W_time of the corresponding statistical time period, and obtain the weighted resource usage value corresponding to each statistical time period, that is, the queue resource usage associated with the subqueue in each statistical time period. The queue resource usage can more accurately reflect the resource usage of the subqueue in different statistical time periods.
[0058] S316. Determine the queue allocation ratio corresponding to each subqueue in each statistical period according to the ratio between the queue resource utilization rate associated with each subqueue in each statistical period and the sum value, and determine the period allocation amount corresponding to each subsystem in each statistical period according to the queue allocation ratio.
[0059] In the embodiment of the present application, the resource allocation system calculates the ratio between the queue resource utilization rate associated with each subqueue in each statistical period and the sum of the resource utilization rates of all queues, and determines the queue allocation ratio S_time corresponding to each subqueue in each statistical period. The specific calculation of the queue allocation ratio S_time can be implemented based on the following formula 2:
[0060] Formula 2: S_time=W_time*R_time / ∑(W_time*R_time)
[0061] Furthermore, the sum of the allocation ratios of all queues associated with each statistical period is calculated to obtain the system resource allocation ratio corresponding to the subsystem in each statistical period, wherein the system resource allocation ratio corresponding to the subsystem under the resource dimension includes the system resource allocation ratio corresponding to the subsystem in each statistical period. Further, the product of the system resource allocation ratio corresponding to each subsystem in each statistical period and the total amount of resource allocation is calculated to determine the time period allocation amount corresponding to each subsystem in each statistical period, aggregate the time period allocation amount of each subsystem in each statistical period, and obtain the system allocation amount corresponding to each subsystem. By calculating the resource utilization rate of each subqueue, the resource allocation system can be dynamically adjusted based on actual usage, realize refined resource allocation, and avoid waste or shortage of resources.
[0062] S32: When the resource dimension is a storage resource dimension, determine the system allocation amount corresponding to each subsystem under the resource dimension.
[0063] In an embodiment of the present application, when the resource dimension is a storage resource dimension, a specified collection time period is selected within the current configuration cycle, such as the last day of each month, or the 15th day of each month, to determine the database usage corresponding to each database within the specified collection time period. Further, the ratio between the usage of each database and the total database usage corresponding to the public cluster is calculated, and the single database usage rate corresponding to each database is determined based on the ratio. Determine the multiple databases corresponding to each subsystem, and aggregate the single database usage rates corresponding to the multiple databases as the system resource allocation ratio corresponding to the subsystem. Next, calculate the product of the usage rate of each single database and the total amount of resource allocation corresponding to the resource dimension to obtain the single database allocation amount corresponding to each database. Finally, calculate the sum of the multiple single database allocation amounts corresponding to the multiple databases to obtain the system allocation amount corresponding to the subsystem. The system allocation amount reflects the overall demand of the entire subsystem in resource allocation, and provides an important basis for the rational allocation of resources.
[0064] S40. Allocate resources to each subsystem according to the system allocation amount corresponding to each subsystem under each resource dimension, wherein, for each resource dimension, the resource type of the resources allocated to each subsystem matches the resource dimension and the resource amount is equal to the system allocation amount corresponding to the subsystem under the resource dimension.
[0065] In this step, the resource allocation system needs to allocate resources to each subsystem according to the system allocation amount corresponding to each subsystem under each resource dimension. Specifically, for each resource dimension, the resource allocation system will allocate corresponding resources to each subsystem. The types of these resources must match the resource dimensions, and the number of resources must be consistent with the system allocation amount corresponding to the subsystem under the resource dimension. In this way, each subsystem can obtain resources that match its needs, thereby ensuring the efficient operation of the entire system.
[0066] The method provided in the embodiment of the present application first determines multiple resource dimensions associated with the public cluster and the resource allocation ratio corresponding to each resource dimension every preset configuration period, wherein the public cluster includes multiple subsystems. Further, according to the resource allocation ratio corresponding to each resource dimension, the total amount to be allocated associated with the public cluster is allocated to determine the total amount of resource allocation corresponding to each resource dimension. Next, the system resource allocation ratio corresponding to each subsystem under each resource dimension is queried, and the total amount of resource allocation corresponding to each resource dimension is allocated according to the queried system resource allocation ratio, and the system allocation amount corresponding to each subsystem under each resource dimension is determined. Finally, according to the system allocation amount corresponding to each subsystem under each resource dimension, resources are allocated to each subsystem, wherein, for each resource dimension, the resource type of the resource allocated to each subsystem matches the resource dimension and the resource amount is equal to the system allocation amount corresponding to the subsystem under the resource dimension. In the embodiment of the present application, the resource allocation system automatically allocates resources according to the preset period and ratio without manual intervention, which can avoid the problems of slow information input and data input errors that may occur in the manual apportionment process, and ensure that resource allocation and billing can accurately reflect the actual usage, thereby greatly improving the efficiency of resource allocation. In addition, the embodiments of the present application can achieve more fine-grained management of resources by allocating resources across multiple resource dimensions and system resource allocation ratios, thereby helping enterprises to more accurately control costs and optimize resource usage.
[0067] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a resource allocation device for a public cluster, such as Figure 6 As shown, the device includes: a first determination module 601, a second determination module 602, a third determination module 603, and an allocation module 604.
[0068] The first determination module 601 is used to determine multiple resource dimensions associated with a public cluster and a resource allocation ratio corresponding to each resource dimension every preset configuration period, wherein the public cluster includes multiple subsystems;
[0069] The second determining module 602 is used to allocate the total amount to be allocated associated with the public cluster according to the resource allocation ratio corresponding to each resource dimension, and determine the total amount of resource allocation corresponding to each resource dimension;
[0070] The third determination module 603 is used to query the system resource allocation ratio corresponding to each of the subsystems under each of the resource dimensions, and allocate the total resource allocation amount corresponding to each of the resource dimensions according to the queried system resource allocation ratio to determine the system allocation amount corresponding to each of the subsystems under each of the resource dimensions;
[0071] The allocation module 604 is used to allocate resources to each subsystem according to the system allocation amount corresponding to each subsystem under each resource dimension, wherein, for each resource dimension, the resource type of the resources allocated to each subsystem matches the resource dimension and the resource quantity is equal to the system allocation amount corresponding to the subsystem under the resource dimension.
[0072] In a specific application scenario, the first determination module 601 is used to determine the resource utilization rate corresponding to each of the resource dimensions, and take the sum of all resource utilization rates as the total resource utilization rate; calculate the ratio between the resource utilization rate corresponding to each of the resource dimensions and the total resource utilization rate, and determine the resource allocation ratio corresponding to each of the resource dimensions based on the ratio.
[0073] In a specific application scenario, the first determination module 601 is used to determine multiple real-time resource usage values corresponding to the root queue when the resource dimension is a CPU resource dimension or a memory resource dimension, the collection time point corresponding to the real-time resource usage value is within the current configuration cycle, and the root queue is the root queue associated with the public cluster; draw a resource usage line graph of the root queue according to the multiple real-time resource usage values, and use the integral method or the trapezoidal method to calculate the offline area of the resource usage line graph to obtain the actual resource usage area corresponding to the resource dimension; calculate the offline area of the preset resource quota line graph to obtain the resource quota area corresponding to the resource dimension; determine the resource utilization rate corresponding to the resource dimension according to the ratio between the actual resource usage area and the resource quota area.
[0074] In a specific application scenario, the first determination module 601 is used to select a specified collection time period within the current configuration cycle when the resource dimension is a storage resource dimension, and determine the total database usage associated with the specified collection time period; calculate the ratio between the total database usage and the total database storage capacity corresponding to the public cluster, and determine the resource utilization rate corresponding to the resource dimension based on the ratio.
[0075] In a specific application scenario, the third determination module 603 is used to determine the total first resource usage associated with the resource dimension in the current preset configuration cycle when the resource dimension is a CPU resource dimension or a memory resource dimension, and the preset configuration cycle includes multiple collection time periods; determine the resource usage associated with the resource dimension in each collection time period, split the resource usage associated in each collection time period according to multiple preset statistical time periods, and obtain the specified resource usage corresponding to each collection time period in each statistical time period; determine all the specified resource usages corresponding to each statistical time period as the target usage, and calculate the sum of all the target usages as the time period resource usage, and use the ratio between the time period resource usage and the first resource usage as the time period weight corresponding to the statistical time period; determine multiple subqueues corresponding to each subsystem, and determine the time period resource usage rate of each subqueue in each statistical time period; calculate the resource usage rate of each time period in each statistical time period and the ratio of the resource usage rate of each time period to the total first resource usage. The product of the time period weights of the corresponding statistical time periods is obtained to obtain the queue resource utilization rate associated with each subqueue in each statistical time period, and the sum of all queue resource utilization rates is calculated; according to the ratio between the queue resource utilization rate associated with each subqueue in each statistical time period and the sum, the queue allocation ratio corresponding to each subqueue in each statistical time period is determined, and the sum of all queue allocation ratios associated with each statistical time period is calculated to obtain the system resource allocation ratio corresponding to the subsystem in each statistical time period, wherein the system resource allocation ratio corresponding to the subsystem under the resource dimension includes the system resource allocation ratio corresponding to the subsystem in each statistical time period; the product of the system resource allocation ratio corresponding to each subsystem in each statistical time period and the total amount of resource allocation is calculated to determine the time period allocation amount corresponding to each subsystem in each statistical time period, and the time period allocation amount of each subsystem in each statistical time period is aggregated to obtain the system allocation amount corresponding to each subsystem.
[0076] In a specific application scenario, the third determination module 603 is used to determine the total second resource usage of the root queue within the preset configuration period for the resource dimension when the resource dimension is the CPU resource dimension or the memory resource dimension, and the root queue is the root queue associated with the public cluster; determine the queue resource usage of each of the subqueues within the statistical period, calculate the ratio between the resource usage of each of the queues and the total second resource usage, and determine the time period resource usage corresponding to each of the subqueues in the statistical period based on the ratio.
[0077] In a specific application scenario, the third determination module 603 is used to select a specified collection time period within the current configuration cycle when the resource dimension is a storage resource dimension, and determine the database usage corresponding to each database within the specified collection time period; calculate the ratio between the usage of each database and the total database usage corresponding to the public cluster, and determine the single database usage rate corresponding to each database based on the ratio; determine multiple databases corresponding to each subsystem, and aggregate the single database usage rates corresponding to multiple databases as the system resource allocation ratio corresponding to the subsystem; calculate the product of each single database usage rate and the total resource allocation amount corresponding to the resource dimension to obtain the single database allocation amount corresponding to each database, and calculate the sum of multiple single database allocation amounts corresponding to multiple databases to obtain the system allocation amount corresponding to the subsystem.
[0078] The device provided in the embodiment of the present application first determines multiple resource dimensions associated with the public cluster and the resource allocation ratio corresponding to each resource dimension every preset configuration period, wherein the public cluster includes multiple subsystems. Further, according to the resource allocation ratio corresponding to each resource dimension, the total amount to be allocated associated with the public cluster is allocated to determine the total amount of resource allocation corresponding to each resource dimension. Next, the system resource allocation ratio corresponding to each subsystem under each resource dimension is queried, and the total amount of resource allocation corresponding to each resource dimension is allocated according to the queried system resource allocation ratio, and the system allocation amount corresponding to each subsystem under each resource dimension is determined. Finally, according to the system allocation amount corresponding to each subsystem under each resource dimension, resources are allocated to each subsystem, wherein, for each resource dimension, the resource type of the resource allocated to each subsystem matches the resource dimension and the resource amount is equal to the system allocation amount corresponding to the subsystem under the resource dimension. In the embodiment of the present application, the resource allocation system automatically allocates resources according to the preset period and ratio without manual intervention, which can avoid the problems of slow information input and data input errors that may occur in the manual apportionment process, ensure that resource allocation and billing can accurately reflect the actual usage, and thus greatly improve the efficiency of resource allocation. In addition, the embodiments of the present application can achieve more fine-grained management of resources by allocating resources across multiple resource dimensions and system resource allocation ratios, thereby helping enterprises to more accurately control costs and optimize resource usage.
[0079] It should be noted that for other corresponding descriptions of the functional units involved in the resource allocation device for a public cluster provided in the embodiment of the present application, reference can be made to Figures 1 to 5 The corresponding description in will not be repeated here.
[0080] In an exemplary embodiment, see Figure 7, and also provides a device, which includes a communication bus, a processor, a memory and a communication interface, and may also include an input and output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the resource allocation method of the public cluster in the above embodiment.
[0081] A computer-readable storage medium stores a computer program, which implements the steps of the resource allocation method of a public cluster when executed by a processor.
[0082] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by hardware, or by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0083] Those skilled in the art will appreciate that the accompanying drawings are merely schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required for implementing the present application.
[0084] Those skilled in the art will appreciate that the modules in the device in the implementation scenario can be distributed in the device in the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple sub-modules.
[0085] The above application serial numbers are for description only and do not represent the advantages or disadvantages of the implementation scenarios.
[0086] The above disclosure only discloses several specific implementation scenarios of the present application. However, the present application is not limited thereto, and any changes that can be conceived by technicians in this field should fall within the scope of protection of the present application.
Claims
1. A resource allocation method for a public cluster, characterized in that: include: At every preset configuration period, determining a plurality of resource dimensions associated with a public cluster and a resource allocation ratio corresponding to each of the resource dimensions, wherein the public cluster includes a plurality of subsystems; Allocate the total amount to be allocated associated with the public cluster according to the resource allocation ratio corresponding to each resource dimension, and determine the total amount of resource allocation corresponding to each resource dimension; Query the system resource allocation ratio corresponding to each of the subsystems under each of the resource dimensions, and allocate the total resource allocation amount corresponding to each of the resource dimensions according to the queried system resource allocation ratio to determine the system allocation amount corresponding to each of the subsystems under each of the resource dimensions; Resources are allocated to each subsystem according to the system allocation amount corresponding to each subsystem under each resource dimension, wherein, for each resource dimension, the resource type of the resources allocated to each subsystem matches the resource dimension and the resource quantity is equal to the system allocation amount corresponding to the subsystem under the resource dimension.
2. The method according to claim 1, characterized in that The determining of multiple resource dimensions associated with the public cluster and the resource allocation ratio corresponding to each resource dimension includes: Determine the resource utilization rate corresponding to each resource dimension, and take the sum of all resource utilization rates as the total resource utilization rate; The ratio between the resource utilization rate corresponding to each resource dimension and the total resource utilization rate is calculated, and the resource allocation ratio corresponding to each resource dimension is determined according to the ratio.
3. The method according to claim 2, characterized in that The determining the resource usage rate corresponding to each resource dimension includes: When the resource dimension is a CPU resource dimension or a memory resource dimension, determining a plurality of resource real-time usage values corresponding to a root queue, wherein the collection time points corresponding to the resource real-time usage values are within a current configuration period, and the root queue is a root queue associated with the public cluster; Draw a resource usage line graph of the root queue according to the multiple real-time resource usage values, and calculate the offline area of the resource usage line graph by using an integral method or a trapezoidal method to obtain an actual resource usage area corresponding to the resource dimension; Calculate the area below the preset resource quota line graph to obtain the resource quota area corresponding to the resource dimension; The resource usage rate corresponding to the resource dimension is determined according to the ratio between the actual resource usage area and the resource quota area.
4. The method according to claim 2, characterized in that: The determining of the resource usage rate corresponding to each resource dimension further includes: When the resource dimension is a storage resource dimension, selecting a specified collection time period in the current configuration period, and determining the total database usage associated with the specified collection time period; The ratio between the total database usage and the total database storage corresponding to the public cluster is calculated, and the resource usage rate corresponding to the resource dimension is determined according to the ratio.
5. The method according to claim 1, characterized in that The querying of the system resource allocation ratio corresponding to each of the subsystems under each of the resource dimensions, and allocating the total resource allocation amount corresponding to each of the resource dimensions according to the queried system resource allocation ratio, to determine the system allocation amount corresponding to each of the subsystems under each of the resource dimensions, includes: When the resource dimension is a CPU resource dimension or a memory resource dimension, determining a total usage amount of a first resource associated with the resource dimension in a current preset configuration period, wherein the preset configuration period includes a plurality of collection time periods; Determine the resource usage associated with the resource dimension in each of the collection time periods, split the resource usage associated with each of the collection time periods according to a plurality of preset statistical time periods, and obtain the specified resource usage corresponding to each of the collection time periods in each statistical time period; Determine all designated resource usages corresponding to each statistical period as target usages, calculate the sum of all target usages as period resource usages, and use the ratio between the period resource usages and the first resource usage total as the period weight corresponding to the statistical period; Determine a plurality of sub-queues corresponding to each subsystem, and determine a time period resource usage rate corresponding to each of the sub-queues in each statistical time period; Calculate the product of each time period resource utilization rate in each statistical time period and the time period weight of the corresponding statistical time period to obtain the queue resource utilization rate associated with each subqueue in each statistical time period, and calculate the sum of all queue resource utilization rates; Determine the queue allocation ratio corresponding to each subqueue in each statistical period according to the ratio between the queue resource usage rate associated with each subqueue in each statistical period and the sum value, calculate the sum value of all queue allocation ratios associated with each statistical period, and obtain the system resource allocation ratio corresponding to the subsystem in each statistical period, wherein the system resource allocation ratio corresponding to the subsystem under the resource dimension includes the system resource allocation ratio corresponding to the subsystem in each statistical period; Calculate the product of the system resource allocation ratio corresponding to each subsystem in each statistical period and the total amount of resource allocation, determine the time period allocation amount corresponding to each subsystem in each statistical period, aggregate the time period allocation amount of each subsystem in each statistical period, and obtain the system allocation amount corresponding to each subsystem.
6. The method according to claim 5, characterized in that The determining of the time period resource usage rate of each subqueue corresponding to each statistical time period includes: When the resource dimension is a CPU resource dimension or a memory resource dimension, for the resource dimension, determining a second resource usage total of a root queue within the preset configuration period, the root queue being a root queue associated with the public cluster; Determine the queue resource usage of each of the subqueues in the statistical period, calculate the ratio between the queue resource usage of each of the subqueues and the total second resource usage, and determine the period resource usage rate of each of the subqueues corresponding to the statistical period according to the ratio.
7. The method according to claim 1, characterized in that The querying of the system resource allocation ratio corresponding to each of the subsystems under each of the resource dimensions, and allocating the total resource allocation amount corresponding to each of the resource dimensions according to the queried system resource allocation ratio, to determine the system allocation amount corresponding to each of the subsystems under each of the resource dimensions, includes: When the resource dimension is a storage resource dimension, a specified collection time period is selected within the current configuration period, and a database usage corresponding to each database within the specified collection time period is determined; Calculate the ratio between the usage of each database and the total usage of the databases corresponding to the public cluster, and determine the single database usage rate corresponding to each database according to the ratio; Determine multiple databases corresponding to each subsystem, and aggregate single database usage rates corresponding to the multiple databases as the system resource allocation ratio corresponding to the subsystem; The product of the usage rate of each single database and the total amount of resource allocation corresponding to the resource dimension is calculated to obtain the single database allocation amount corresponding to each of the databases, and the sum of multiple single database allocation amounts corresponding to multiple databases is calculated to obtain the system allocation amount corresponding to the subsystem.
8. A resource allocation device for a public cluster, characterized in that: include: A first determination module is used to determine, at every preset configuration period, a plurality of resource dimensions associated with a public cluster and a resource allocation ratio corresponding to each of the resource dimensions, wherein the public cluster includes a plurality of subsystems; A second determination module is used to allocate the total amount to be allocated associated with the public cluster according to the resource allocation ratio corresponding to each resource dimension, and determine the total amount of resource allocation corresponding to each resource dimension; The third determination module is used to query the system resource allocation ratio corresponding to each of the subsystems under each of the resource dimensions, and allocate the total resource allocation amount corresponding to each of the resource dimensions according to the queried system resource allocation ratio to determine the system allocation amount corresponding to each of the subsystems under each of the resource dimensions; An allocation module is used to allocate resources to each subsystem according to the system allocation amount corresponding to each subsystem under each resource dimension, wherein, for each resource dimension, the resource type of the resources allocated to each subsystem matches the resource dimension and the resource amount is equal to the system allocation amount corresponding to the subsystem under the resource dimension.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.