Method, device and equipment for processing resources in cluster, medium and product
By creating multiple resource pools with different priorities in the cluster and dynamically adjusting them according to resource utilization, the problem of insufficient resource allocation in the face of traffic fluctuations is solved, and more efficient resource utilization and service quality assurance is achieved.
Patent Information
- Application Number
- CN202411915932.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-05-06
AI Technical Summary
When the existing load balancing strategy faces a sudden surge in traffic, the resource allocation capacity is insufficient, resulting in a degradation of service performance; at the same time, during the traffic trough, excessive resource allocation leads to wasted computing and storage capacity.
By creating multiple resource pools, each resource pool corresponds to different priorities and dynamically adjusts according to individual resource utilization, resource optimization and allocation are achieved.
While ensuring service quality, improve the utilization rate of service clusters, ensure that high-priority tasks obtain sufficient resources, and reduce resource waste.
Smart Images

Figure CN119938315A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of load balancing, and in particular to a method, device, equipment, medium and product for processing resources in a cluster. Background Art
[0002] In modern distributed systems and Internet applications, load balancing is a crucial technical means. It optimizes resource utilization, improves response speed and enhances system reliability by distributing requests to multiple servers.
[0003] However, the load balancing strategies in the existing technologies usually face a series of challenges when dealing with actual application scenarios; because most of their load balancing strategies are based on static configuration or simple algorithms (such as polling, weighted polling, etc.) to distribute traffic; these methods may perform well when the traffic is relatively stable, but when faced with a sudden surge in traffic, their resource allocation capabilities are often insufficient. Summary of the invention
[0004] In view of the above problems, a method, apparatus, device, medium and product for resource processing in a cluster are proposed to overcome the above problems or at least partially solve the above problems, including:
[0005] A method for processing resources in a cluster, the method comprising:
[0006] Creating multiple resource pools for the cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priority;
[0007] Get the individual resource usage of each resource pool;
[0008] The resources in the multiple resource pools are dynamically adjusted according to the individual resource usage rates.
[0009] Optionally, dynamically adjusting resources in the multiple resource pools according to the individual resource usage rate includes:
[0010] Obtaining overall resource utilization rates of the multiple resource pools;
[0011] The resources in the multiple resource pools are dynamically adjusted according to the overall resource utilization rate and the individual resource utilization rate.
[0012] Optionally, dynamically adjusting the resources in the multiple resource pools according to the overall resource usage rate and the individual resource usage rate includes:
[0013] When the overall resource usage is less than the overall usage threshold, if it is detected that the individual resource usage of the first resource pool is greater than or equal to the individual usage threshold corresponding to the first resource pool, the idle resources of the multiple resource pools are allocated to the first resource pool.
[0014] Optionally, dynamically adjusting the resources in the multiple resource pools according to the overall resource usage rate and the individual resource usage rate includes:
[0015] In the case where the overall resource usage is greater than or equal to the overall usage threshold, if it is detected that the individual resource usage of the first resource pool is greater than or equal to the individual usage threshold corresponding to the first resource pool, the allocated resources in the second resource pool are allocated to the first resource pool;
[0016] The priority of the first resource pool is higher than the priority of the second resource pool.
[0017] Optionally, allocating the allocated resources in the second resource pool to the first resource pool includes:
[0018] The processing of at least part of the tasks to which the resources in the second resource pool have been allocated is suspended, and the resources in the second resource pool that have been allocated to the at least part of the tasks are allocated to the first resource pool.
[0019] Optionally, it also includes:
[0020] If it is detected that the individual resource usage rate of the second resource pool is less than the individual usage rate threshold corresponding to the second resource pool, resources are reallocated from the second resource pool to the at least part of the tasks to resume processing of the at least part of the tasks.
[0021] Optionally, after creating a plurality of resource pools for the cluster, the method further includes:
[0022] Individual resource usage rate thresholds are set for the multiple resource pools according to corresponding priorities.
[0023] Optionally, the cluster is provided with a plurality of nodes, and after the creating of a plurality of resource pools for the cluster, the method further includes:
[0024] The resources of each node in the cluster are divided into the multiple resource pools.
[0025] A device for resource processing in a cluster, the device comprising:
[0026] A resource pool creation module, used to create multiple resource pools for the cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priority;
[0027] An individual resource usage acquisition module is used to obtain the individual resource usage of each resource pool;
[0028] The resource dynamic adjustment module is used to dynamically adjust the resources in the multiple resource pools according to the individual resource utilization rates.
[0029] An electronic device comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the method described above when executed by the processor.
[0030] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0031] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described above.
[0032] The embodiments of the present invention have the following advantages:
[0033] In an embodiment of the present invention, multiple resource pools are created for a cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priorities; the individual resource utilization rate of each resource pool is obtained; and according to the individual resource utilization rate, the resources in the multiple resource pools are dynamically adjusted, thereby realizing optimization and allocation of resources according to task priorities, and dynamic adjustment of resources in the resource pools, thereby improving the utilization rate of the service cluster while ensuring the quality of service. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0035] Figure 1 is a flowchart of the steps of a method for processing resources in a cluster provided by some embodiments of the present invention;
[0036] Figure 2 is a schematic diagram of a load balancing strategy provided by some embodiments of the present invention;
[0037] Figure 3 is a flowchart of steps of another method for processing resources in a cluster provided by some embodiments of the present invention;
[0038] Figure 4is a flowchart of steps of another method for processing resources in a cluster provided by some embodiments of the present invention;
[0039] Figure 5 It is a structural block diagram of a device for processing resources in a cluster provided by some embodiments of the present invention. DETAILED DESCRIPTION
[0040] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] In related technologies, since the load balancing strategy cannot respond quickly to changes in traffic, the system may cause a significant decline in service performance due to insufficient resource allocation, and the user experience will also be affected. For example, in a high-concurrency scenario, if the resources on a server node are close to saturation and the load balancing strategy fails to adjust the traffic distribution in time, the node may respond slowly or refuse service due to overload, which will cause the overall service quality of the system to decline.
[0042] On the other hand, during the low traffic period, its load balancing strategy may waste a lot of computing and storage capacity due to over-allocation of resources; due to the inability to accurately predict the changing trend of traffic, the system may retain too many redundant resources for emergency use, and these resources are often not effectively utilized during the low traffic period; this waste of resources not only increases the company's operating costs, but may also cause the system to be unable to respond quickly when facing sudden traffic, because some resources have been ineffectively occupied.
[0043] In some embodiments of the present invention, a load balancing method is proposed, which monitors the system load in real time and classifies the resource pool, combines the feedback mechanism and the preemptive algorithm, dynamically adjusts the system resources, and improves the utilization rate of the service cluster while ensuring the quality of service.
[0044] The present invention will be further described below in conjunction with the accompanying drawings:
[0045] Reference Figure 1 , shows a flowchart of a method for processing resources in a cluster provided by some embodiments of the present invention, which may specifically include the following steps:
[0046] Step 101 : creating multiple resource pools for the cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priority.
[0047] Among them, a cluster can be a system composed of multiple computing nodes (such as servers, virtual machines, containers, etc.). These resources are connected together through a network and work together to perform various tasks.
[0048] In actual applications, you can create multiple resource pools for a cluster and set corresponding priorities for each resource pool, such as high priority, medium priority, and low priority. By creating multiple resource pools for a cluster, you can better manage and utilize the resources in the cluster to meet the needs of different tasks or users.
[0049] The priority of the resource pool may be pre-set. By associating the resource pool with the priority, it can be ensured that subsequent high-priority tasks can obtain sufficient resources to be completed in time, while low-priority tasks can be performed when resources permit.
[0050] In some examples, the corresponding priority can be set according to the type of task; for example, tasks such as basic services, middleware, and tasks involving orders and basic user experience can be high-priority tasks; tasks such as data synchronization can be medium-priority tasks; tasks such as data analysis, algorithm analysis, data storage, etc. can be low-priority tasks.
[0051] In actual applications, each resource pool contains a certain number and type of resources, which can be allocated to tasks of corresponding priorities. When a task is submitted to the cluster, the system can allocate it to the corresponding resource pool according to its priority, thereby ensuring that the task can obtain the required resources for execution.
[0052] In some embodiments of the present invention, the cluster is provided with a plurality of nodes, and after the creating of a plurality of resource pools for the cluster, the method further includes: dividing resources of each node in the cluster into the plurality of resource pools.
[0053] Among them, a node can be a server, and multiple nodes can form a cluster; each node contains certain computing resources, such as CPU, memory, storage, and network bandwidth.
[0054] After creating multiple resource pools for a cluster, resources of each node in the cluster may be divided into multiple resource pools; for example, resources of each node may be divided into resource pools of corresponding priority levels according to the resource service capability of each node.
[0055] As some examples, each server resource in the cluster can be divided into different resource pools. Different resource pools have different priorities and provide different resource priority levels to ensure that the overall resource ratio does not exceed a certain proportion at any time, thereby ensuring the quality of service; a resource pool can be composed of multiple interconnected servers, which together constitute the available resources of this server resource pool. At the same time, the control of resource water levels is also based on the average value of their resource statistics as a reference.
[0056] In some embodiments of the present invention, after creating a plurality of resource pools for the cluster, the method further includes: setting individual resource usage rate thresholds for the plurality of resource pools according to corresponding priorities.
[0057] The individual resource usage rate threshold may be a service proportion.
[0058] For example, the service share of a high-priority resource pool can be 40%; the service share of a medium-priority resource pool can be 20%; and the service share of a low-priority resource pool can be 20%; to ensure that the total resource water level (occupancy percentage) of all resource pools in the cluster does not exceed 80%.
[0059] Step 102: Obtain the individual resource usage rate of each resource pool.
[0060] The individual resource utilization rate may refer to the real-time resource utilization rate of resources in each resource pool; by obtaining the individual resource utilization rate of each resource pool, the resources in the resource pool may be dynamically adjusted later.
[0061] Step 103: Dynamically adjust the resources in the multiple resource pools according to the individual resource usage rates.
[0062] After obtaining the individual resource utilization rate, the resources in the resource pool can be reallocated or optimized based on the individual resource utilization rate to meet current or expected business needs; by dynamically adjusting resources, resource utilization can be improved to ensure that key applications or tasks obtain the required resources while reducing unnecessary resource waste.
[0063] For example, resources in one resource pool are allocated to another resource pool for use.
[0064] In some embodiments of the present invention, dynamically adjusting the resources in the multiple resource pools based on the individual resource utilization rates includes: obtaining the overall resource utilization rate of the multiple resource pools; and dynamically adjusting the resources in the multiple resource pools based on the overall resource utilization rate and the individual resource utilization rate.
[0065] Among them, the overall resource utilization rate of multiple resource pools can be obtained based on the individual resource utilization rate of each resource pool; for example, there are two resource pools AB in total, the individual resource utilization rate of resource pool A is 20%, and the individual resource utilization rate of resource pool B is 10%, then the overall resource utilization rate of the two resource pools AB is 30%.
[0066] After determining the overall resource utilization and the individual resource utilization, it can be determined whether it is necessary to dynamically adjust the resources in the multiple resource pools.
[0067] For example, if the overall resource utilization is high but the individual resource utilization is unevenly distributed, it means that some resources are overused while other resources are relatively idle; in this case, resource utilization can be optimized by reallocating resources or adjusting resource usage strategies.
[0068] In some embodiments of the present invention, the resources in the multiple resource pools are dynamically adjusted according to the overall resource utilization and the individual resource utilization, including: when the overall resource utilization is less than the overall utilization threshold, if it is detected that the individual resource utilization of the first resource pool is greater than or equal to the individual utilization threshold corresponding to the first resource pool, the idle resources of the multiple resource pools are allocated to the first resource pool.
[0069] The overall utilization rate threshold can be a preset value, such as 80%, which is used to determine whether the overall resource utilization rate is within a normal or reasonable range; when the overall resource utilization rate is lower than this threshold, it can be considered that the system resources are relatively sufficient and have a certain degree of redundancy. The first resource pool can be any resource pool among multiple resource pools.
[0070] When it is detected that the individual resource usage rate of the first resource pool is greater than or equal to the individual usage rate threshold corresponding to the first resource pool, idle resources of multiple resource pools are allocated to the first resource pool.
[0071] For example, there are two resource pools AB, and the overall utilization threshold is 80%; and the individual resource utilization thresholds of resource pools A and B are 20%; the individual resource utilization of resource pool A is 25%, and the individual resource utilization of resource pool B is 10%; the overall resource utilization of resource pools AB is 35%.
[0072] Among them, when the overall resource utilization rate of AB (35%) is less than the overall utilization rate threshold (80%), and the individual resource utilization rate of resource pool A (25%) is greater than the individual resource utilization rate threshold (20%) of resource pool A, the idle resources (10%) in resource pool B can be allocated to resource pool A for use.
[0073] In some embodiments of the present invention, the resources in the multiple resource pools are dynamically adjusted according to the overall resource utilization and the individual resource utilization, including: when the overall resource utilization is greater than or equal to the overall utilization threshold, if it is detected that the individual resource utilization of the first resource pool is greater than or equal to the individual utilization threshold corresponding to the first resource pool, the allocated resources in the second resource pool are allocated to the first resource pool; wherein the priority of the first resource pool is higher than the priority of the second resource pool.
[0074] The second resource pool is any one of the multiple resource pools whose priority is lower than that of the first resource pool.
[0075] For example, there are three resource pools ABC in total, and the overall utilization threshold is 80%; the individual resource utilization threshold of resource pool A is 40%, the individual resource utilization threshold of resource pool B is 20%, and the individual resource utilization threshold of resource pool C is 20%; the individual resource utilization rate of resource pool A is 70%, the individual resource utilization rate of resource pool B is 10%, and the individual resource utilization rate of resource pool C is 0%; the overall resource utilization rate of the three resource pools ABC is 80%; the priorities of the three resource pools ABC are A higher than B higher than C respectively.
[0076] Among them, when the overall resource utilization rate (80%) of the three resource pools ABC is equal to the overall utilization rate threshold (80%), it is detected that the individual resource utilization rate (70%) of resource pool A is greater than the individual utilization rate threshold (40%) corresponding to resource pool A, the allocated resources (20%) in resource pool C can be allocated to resource pool A, and the idle resources (10%) in resource pool B can be allocated to resource pool A for use.
[0077] As some examples, a resource preemption function can be added. When the system load reaches the "warning state" (when the overall resource utilization is greater than or equal to the overall resource utilization threshold), the resource scheduler will first evaluate the priority of the task processed by the current resource pool and decide whether resource preemption is needed; if the resource occupancy percentage is close to the preset upper limit (such as 80%), reaching 75%, then low-priority services need to be reduced to make room for high-priority services; for high-priority tasks, the resource scheduler will release sufficient computing resources from the low-priority resource pool or the idle resource pool, and allocate them to the high-priority resource pool that processes high-priority tasks.
[0078] In some examples, priority evaluation and scheduling can also be performed when performing resource preemption functions; for example, resource scheduling continuously tracks the priorities of all tasks in the system and dynamically adjusts task resources according to preset strategies. When a high-priority task is raised to the critical value for preempting resources, the resource scheduling immediately schedules the required resources from the resource pool.
[0079] In some embodiments of the present invention, allocating the allocated resources in the second resource pool to the first resource pool includes: suspending processing of at least part of the tasks to which resources in the second resource pool have been allocated, and allocating the resources in the second resource pool that have been allocated to the at least part of the tasks to the first resource pool.
[0080] For example, there are three resource pools ABC in total, and the overall utilization threshold is 80%; the individual resource utilization threshold of resource pool A is 40%, the individual resource utilization threshold of resource pool B is 20%, and the individual resource utilization threshold of resource pool C is 20%; the individual resource utilization rate of resource pool A is 70%, the individual resource utilization rate of resource pool B is 0%, and the individual resource utilization rate of resource pool C is 10%; the overall resource utilization rate of the three resource pools ABC is 80%; the priorities of the three resource pools ABC are: high priority for resource pool A, medium priority for resource pool B, and low priority for resource pool C.
[0081] Among them, when the overall resource utilization rate (80%) of the three resource pools ABC is equal to the overall utilization rate threshold (80%), it is detected that the individual resource utilization rate (70%) of resource pool A is greater than the individual utilization rate threshold (40%) corresponding to resource pool A, the allocated resources (20%) in resource pool B can be allocated to resource pool A. Since resource pool C is of low priority and there are 10% low priority tasks, the low priority tasks (1% or 5% or 10%) in resource pool C can be suspended, and the resources in resource pool C that have been allocated to at least part of the tasks can be allocated to resource pool A.
[0082] In some embodiments of the present invention, it also includes: if it is detected that the individual resource usage rate of the second resource pool is less than the individual usage rate threshold corresponding to the second resource pool, reallocating resources from the second resource pool to the at least part of the tasks to resume processing of the at least part of the tasks.
[0083] After pausing at least part of the tasks of the resources in the second resource pool and allocating the resources in the second resource pool that have been allocated to at least part of the tasks to the first resource pool, the individual resource usage of the second resource pool can be detected in real time. When it is detected that the individual resource usage of the second resource pool is less than the individual usage threshold corresponding to the second resource pool, it means that the individual resource usage of the first resource pool has not reached the individual resource usage threshold corresponding to the first resource pool, and the first resource pool has not used the resources of the second resource pool. Therefore, the tasks suspended in the second resource pool can be reallocated in the second resource pool to resume processing of at least part of the tasks.
[0084] As some examples, when resources of low-priority tasks are preempted, the resource scheduler will temporarily suspend these tasks to ensure the operation of high-priority tasks; when the load returns to normal levels, the resource scheduler will reallocate resources and resume the suspended tasks to ensure that the overall workflow of the system is not interrupted.
[0085] Among them, a dynamic resource pool management module can be built into the resource scheduling, which can intelligently judge the current resource utilization and adjust the resource pool; for example, during traffic peak periods, the resource scheduling will actively release reserved resources in the resource pool, or recycle resources from low-priority tasks to support the continuous operation of critical tasks.
[0086] In some examples, during the load adjustment process, resource scheduling will continuously optimize the preemption strategy to ensure that the resource preemption process does not affect the overall performance of the system; through adaptive algorithms, resource scheduling can dynamically adjust the intensity and frequency of preemption according to different business scenarios and load changes to avoid unnecessary resource preemption and task interruption.
[0087] For example, the traffic of high-priority tasks (device control tasks) changes relatively slowly, and it may take several hours to reach the peak. Therefore, it can be reallocated at a smaller granularity, such as 2%. However, if a university campus centrally rents air conditioners, it may be a problem of reaching the peak in just 10 minutes, so it may need to be allocated at a dense granularity of 10%.
[0088] In actual applications, if all resources of the low-priority resource pool are directly given to the high-priority resource pool (or vice versa), the high-priority resource pool may not need so many resources at present, which will lead to over-allocation. Therefore, according to the actual situation of the high-priority resource pool, the resources of the low-priority resource pool can be gradually allocated, such as allocating 2% or 1% of the resources to the high-priority resource pool at regular intervals (such as 10 minutes).
[0089] In actual applications, since online services are often highly volatile, uncertainty often occurs during traffic peaks. The resource pool preemption function of resource scheduling in the embodiment of the present invention can respond to traffic fluctuations in a timely manner, ensure that core services obtain priority resource scheduling, and prevent service performance degradation due to insufficient resources.
[0090] like Figure 2 As shown, there are four resource pools, including Pool0, Pool1, Pool2, and Pool3. Each resource pool is dynamically adjusted according to the load situation.
[0091] In an embodiment of the present invention, multiple resource pools are created for a cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priorities; the individual resource utilization rate of each resource pool is obtained; and according to the individual resource utilization rate, the resources in the multiple resource pools are dynamically adjusted, thereby realizing optimization and allocation of resources according to task priorities, and dynamic adjustment of resources in the resource pools, thereby improving the utilization rate of the service cluster while ensuring the quality of service.
[0092] Reference Figure 3 , shows a flowchart of another method for processing resources in a cluster provided by some embodiments of the present invention, which may specifically include the following steps:
[0093] Step 301 : Create multiple resource pools for the cluster; different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priority.
[0094] Among them, a cluster can be a system composed of multiple computing nodes (such as servers, virtual machines, containers, etc.). These resources are connected together through a network and work together to perform various tasks.
[0095] In actual applications, you can create multiple resource pools for a cluster and set corresponding priorities for each resource pool, such as high priority, medium priority, and low priority. By creating multiple resource pools for a cluster, you can better manage and utilize the resources in the cluster to meet the needs of different tasks or users.
[0096] The priority of the resource pool may be pre-set. By associating the resource pool with the priority, it can be ensured that subsequent high-priority tasks can obtain sufficient resources to be completed in time, while low-priority tasks can be performed when resources permit.
[0097] In some examples, the corresponding priority can be set according to the type of task; for example, tasks such as basic services, middleware, and tasks involving orders and basic user experience can be high-priority tasks; tasks such as data synchronization can be medium-priority tasks; tasks such as data analysis, algorithm analysis, data storage, etc. can be low-priority tasks.
[0098] In actual applications, each resource pool contains a certain number and type of resources, which can be allocated to tasks of corresponding priorities. When a task is submitted to the cluster, the system can allocate it to the corresponding resource pool according to its priority, thereby ensuring that the task can obtain the required resources for execution.
[0099] In some embodiments of the present invention, the cluster is provided with a plurality of nodes, and after the creating of a plurality of resource pools for the cluster, the method further includes: dividing resources of each node in the cluster into the plurality of resource pools.
[0100] Among them, a node can be a server, and multiple nodes can form a cluster; each node contains certain computing resources, such as CPU, memory, storage, and network bandwidth.
[0101] After creating multiple resource pools for a cluster, resources of each node in the cluster may be divided into multiple resource pools; for example, resources of each node may be divided into resource pools of corresponding priority levels according to the resource service capability of each node.
[0102] As some examples, each server resource in the cluster can be divided into different resource pools. Different resource pools have different priorities and provide different resource priority levels to ensure that the overall resource ratio does not exceed a certain proportion at any time, thereby ensuring the quality of service; a resource pool can be composed of multiple interconnected servers, which together constitute the available resources of this server resource pool. At the same time, the control of resource water levels is also based on the average value of their resource statistics as a reference.
[0103] Step 302: setting individual resource usage rate thresholds for the multiple resource pools according to corresponding priorities.
[0104] The individual resource usage rate threshold may be a service proportion.
[0105] For example, the service share of a high-priority resource pool can be 40%; the service share of a medium-priority resource pool can be 20%; and the service share of a low-priority resource pool can be 20%; to ensure that the total resource water level (occupancy percentage) of all resource pools in the cluster does not exceed 80%.
[0106] Step 303: Obtain the individual resource usage rate of each resource pool.
[0107] The individual resource utilization rate may refer to the real-time resource utilization rate of resources in each resource pool; by obtaining the individual resource utilization rate of each resource pool, the resources in the resource pool may be dynamically adjusted later.
[0108] Step 304: Dynamically adjust the resources in the multiple resource pools according to the individual resource usage rates.
[0109] After obtaining the individual resource utilization rate, the resources in the resource pool can be reallocated or optimized based on the individual resource utilization rate to meet current or expected business needs; by dynamically adjusting resources, resource utilization can be improved to ensure that key applications or tasks obtain the required resources while reducing unnecessary resource waste.
[0110] For example, resources in one resource pool are allocated to another resource pool for use.
[0111] In some embodiments of the present invention, dynamically adjusting the resources in the multiple resource pools based on the individual resource utilization rates includes: obtaining the overall resource utilization rate of the multiple resource pools; and dynamically adjusting the resources in the multiple resource pools based on the overall resource utilization rate and the individual resource utilization rate.
[0112] Among them, the overall resource utilization rate of multiple resource pools can be obtained based on the individual resource utilization rate of each resource pool; for example, there are two resource pools AB in total, the individual resource utilization rate of resource pool A is 20%, and the individual resource utilization rate of resource pool B is 10%, then the overall resource utilization rate of the two resource pools AB is 30%.
[0113] After determining the overall resource utilization and the individual resource utilization, it can be determined whether it is necessary to dynamically adjust the resources in the multiple resource pools.
[0114] For example, if the overall resource utilization is high but the individual resource utilization is unevenly distributed, it means that some resources are overused while other resources are relatively idle; in this case, resource utilization can be optimized by reallocating resources or adjusting resource usage strategies.
[0115] In some embodiments of the present invention, the resources in the multiple resource pools are dynamically adjusted according to the overall resource utilization and the individual resource utilization, including: when the overall resource utilization is less than the overall utilization threshold, if it is detected that the individual resource utilization of the first resource pool is greater than or equal to the individual utilization threshold corresponding to the first resource pool, the idle resources of the multiple resource pools are allocated to the first resource pool.
[0116] The overall utilization rate threshold can be a preset value, such as 80%, which is used to determine whether the overall resource utilization rate is within a normal or reasonable range; when the overall resource utilization rate is lower than this threshold, it can be considered that the system resources are relatively sufficient and have a certain degree of redundancy. The first resource pool can be any resource pool among multiple resource pools.
[0117] When it is detected that the individual resource usage rate of the first resource pool is greater than or equal to the individual usage rate threshold corresponding to the first resource pool, idle resources of multiple resource pools are allocated to the first resource pool.
[0118] For example, there are two resource pools AB, and the overall utilization threshold is 80%; and the individual resource utilization thresholds of resource pools A and B are 20%; the individual resource utilization of resource pool A is 25%, and the individual resource utilization of resource pool B is 10%; the overall resource utilization of resource pools AB is 35%.
[0119] Among them, when the overall resource utilization rate of AB (35%) is less than the overall utilization rate threshold (80%), and the individual resource utilization rate of resource pool A (25%) is greater than the individual resource utilization rate threshold (20%) of resource pool A, the idle resources (10%) in resource pool B can be allocated to resource pool A for use.
[0120] In some embodiments of the present invention, the resources in the multiple resource pools are dynamically adjusted according to the overall resource utilization and the individual resource utilization, including: when the overall resource utilization is greater than or equal to the overall utilization threshold, if it is detected that the individual resource utilization of the first resource pool is greater than or equal to the individual utilization threshold corresponding to the first resource pool, the allocated resources in the second resource pool are allocated to the first resource pool; wherein the priority of the first resource pool is higher than the priority of the second resource pool.
[0121] The second resource pool is any one of the multiple resource pools whose priority is lower than that of the first resource pool.
[0122] For example, there are three resource pools ABC in total, and the overall utilization threshold is 80%; the individual resource utilization threshold of resource pool A is 40%, the individual resource utilization threshold of resource pool B is 20%, and the individual resource utilization threshold of resource pool C is 20%; the individual resource utilization rate of resource pool A is 70%, the individual resource utilization rate of resource pool B is 10%, and the individual resource utilization rate of resource pool C is 0%; the overall resource utilization rate of the three resource pools ABC is 80%; the priorities of the three resource pools ABC are A higher than B higher than C respectively.
[0123] Among them, when the overall resource utilization rate (80%) of the three resource pools ABC is equal to the overall utilization rate threshold (80%), it is detected that the individual resource utilization rate (70%) of resource pool A is greater than the individual utilization rate threshold (40%) corresponding to resource pool A, the allocated resources (20%) in resource pool C can be allocated to resource pool A, and the idle resources (10%) in resource pool B can be allocated to resource pool A for use.
[0124] As some examples, a resource preemption function can be added. When the system load reaches the "warning state" (when the overall resource utilization is greater than or equal to the overall resource utilization threshold), the resource scheduler will first evaluate the priority of the task processed by the current resource pool and decide whether resource preemption is needed; if the resource occupancy percentage is close to the preset upper limit (such as 80%), reaching 75%, then low-priority services need to be reduced to make room for high-priority services; for high-priority tasks, the resource scheduler will release sufficient computing resources from the low-priority resource pool or the idle resource pool, and allocate them to the high-priority resource pool that processes high-priority tasks.
[0125] In some examples, priority evaluation and scheduling can also be performed when performing resource preemption functions; for example, resource scheduling continuously tracks the priorities of all tasks in the system and dynamically adjusts task resources according to preset strategies. When a high-priority task is raised to the critical value for preempting resources, the resource scheduling immediately schedules the required resources from the resource pool.
[0126] In some embodiments of the present invention, allocating the allocated resources in the second resource pool to the first resource pool includes: suspending processing of at least part of the tasks to which resources in the second resource pool have been allocated, and allocating the resources in the second resource pool that have been allocated to the at least part of the tasks to the first resource pool.
[0127] For example, there are three resource pools ABC in total, and the overall utilization threshold is 80%; the individual resource utilization threshold of resource pool A is 40%, the individual resource utilization threshold of resource pool B is 20%, and the individual resource utilization threshold of resource pool C is 20%; the individual resource utilization rate of resource pool A is 70%, the individual resource utilization rate of resource pool B is 0%, and the individual resource utilization rate of resource pool C is 10%; the overall resource utilization rate of the three resource pools ABC is 80%; the priorities of the three resource pools ABC are: high priority for resource pool A, medium priority for resource pool B, and low priority for resource pool C.
[0128] Among them, when the overall resource utilization rate (80%) of the three resource pools ABC is equal to the overall utilization rate threshold (80%), it is detected that the individual resource utilization rate (70%) of resource pool A is greater than the individual utilization rate threshold (40%) corresponding to resource pool A, the allocated resources (20%) in resource pool B can be allocated to resource pool A. Since resource pool C is of low priority and there are 10% low priority tasks, the low priority tasks (1% or 5% or 10%) in resource pool C can be suspended, and the resources in resource pool C that have been allocated to at least part of the tasks can be allocated to resource pool A.
[0129] In some embodiments of the present invention, it also includes: if it is detected that the individual resource usage rate of the second resource pool is less than the individual usage rate threshold corresponding to the second resource pool, reallocating resources from the second resource pool to the at least part of the tasks to resume processing of the at least part of the tasks.
[0130] After pausing at least part of the tasks of the resources in the second resource pool and allocating the resources in the second resource pool that have been allocated to at least part of the tasks to the first resource pool, the individual resource usage of the second resource pool can be detected in real time. When it is detected that the individual resource usage of the second resource pool is less than the individual usage threshold corresponding to the second resource pool, it means that the individual resource usage of the first resource pool has not reached the individual resource usage threshold corresponding to the first resource pool, and the first resource pool has not used the resources of the second resource pool. Therefore, the tasks suspended in the second resource pool can be reallocated in the second resource pool to resume processing of at least part of the tasks.
[0131] As some examples, when resources of low-priority tasks are preempted, the resource scheduler will temporarily suspend these tasks to ensure the operation of high-priority tasks; when the load returns to normal levels, the resource scheduler will reallocate resources and resume the suspended tasks to ensure that the overall workflow of the system is not interrupted.
[0132] Among them, a dynamic resource pool management module can be built into the resource scheduling, which can intelligently judge the current resource utilization and adjust the resource pool; for example, during traffic peak periods, the resource scheduling will actively release reserved resources in the resource pool, or recycle resources from low-priority tasks to support the continuous operation of critical tasks.
[0133] In some examples, during the load adjustment process, resource scheduling will continuously optimize the preemption strategy to ensure that the resource preemption process does not affect the overall performance of the system; through adaptive algorithms, resource scheduling can dynamically adjust the intensity and frequency of preemption according to different business scenarios and load changes to avoid unnecessary resource preemption and task interruption.
[0134] For example, the traffic of high-priority tasks (device control tasks) changes relatively slowly, and it may take several hours to reach the peak. Therefore, it can be reallocated at a smaller granularity, such as 2%. However, if a university campus centrally rents air conditioners, it may be a problem of reaching the peak in just 10 minutes, so it may need to be allocated at a dense granularity of 10%.
[0135] In actual applications, if all resources of the low-priority resource pool are directly given to the high-priority resource pool (or vice versa), the high-priority resource pool may not need so many resources at present, which will lead to over-allocation. Therefore, according to the actual situation of the high-priority resource pool, the resources of the low-priority resource pool can be gradually allocated, such as allocating 2% or 1% of the resources to the high-priority resource pool at regular intervals (such as 10 minutes).
[0136] In actual applications, since online services are often highly volatile, uncertainty often occurs during traffic peaks. The resource pool preemption function of resource scheduling in the embodiment of the present invention can respond to traffic fluctuations in a timely manner, ensure that core services obtain priority resource scheduling, and prevent service performance degradation due to insufficient resources.
[0137] like Figure 2 As shown, there are four resource pools, including Pool0, Pool1, Pool2, and Pool3. Each resource pool is dynamically adjusted according to the load situation.
[0138] In an embodiment of the present invention, multiple resource pools are created for a cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priorities; according to the corresponding priorities, individual resource utilization rate thresholds are set for the multiple resource pools; the individual resource utilization rate of each resource pool is obtained; according to the individual resource utilization rate, the resources in the multiple resource pools are dynamically adjusted, thereby realizing optimization and allocation of resources according to task priorities, and dynamic adjustment of resources in the resource pools, thereby improving the utilization rate of the service cluster while ensuring the service quality.
[0139] Reference Figure 4 , shows a flowchart of the steps of another method for processing resources in a cluster provided by some embodiments of the present invention, which may specifically include the following steps:
[0140] Step 401 : creating multiple resource pools for the cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priority.
[0141] Step 402: setting individual resource usage rate thresholds for the multiple resource pools according to corresponding priorities.
[0142] Step 403: divide the resources of each node in the cluster into the multiple resource pools.
[0143] Step 404: Obtain the individual resource usage rate of each resource pool.
[0144] Step 405: Dynamically adjust the resources in the multiple resource pools according to the individual resource usage rates.
[0145] In an embodiment of the present invention, multiple resource pools are created for a cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priorities; individual resource utilization rate thresholds are set for multiple resource pools according to corresponding priorities; resources of each node in the cluster are divided into multiple resource pools; the individual resource utilization rate of each resource pool is obtained; and resources in multiple resource pools are dynamically adjusted according to the individual resource utilization rate, thereby optimizing and allocating resources according to task priorities and dynamically adjusting resources in resource pools, thereby improving the utilization rate of the service cluster while ensuring the quality of service.
[0146] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0147] Reference Figure 5 , shows a schematic diagram of the structure of a device for processing resources in a cluster provided by some embodiments of the present invention, which may specifically include the following modules:
[0148] A resource pool creation module 501 is used to create multiple resource pools for the cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priority;
[0149] Individual resource usage rate acquisition module 502, used to acquire the individual resource usage rate of each resource pool;
[0150] The resource dynamic adjustment module 503 is used to dynamically adjust the resources in the multiple resource pools according to the individual resource usage rates.
[0151] In some embodiments of the present invention, the resource dynamic adjustment module 503 includes:
[0152] An overall resource utilization rate acquisition submodule, used to acquire the overall resource utilization rates of the multiple resource pools;
[0153] The first resource adjustment submodule is used to dynamically adjust the resources in the multiple resource pools according to the overall resource utilization rate and the individual resource utilization rate.
[0154] In some embodiments of the present invention, the first resource adjustment submodule includes:
[0155] The first resource allocation unit is used to allocate free resources of the multiple resource pools to the first resource pool if it is detected that the individual resource utilization rate of the first resource pool is greater than or equal to the individual utilization rate threshold corresponding to the first resource pool when the overall resource utilization rate is less than the overall utilization rate threshold.
[0156] In some embodiments of the present invention, the first resource adjustment submodule includes:
[0157] A second resource allocation unit is used to allocate the allocated resources in the second resource pool to the first resource pool if it is detected that the individual resource utilization rate of the first resource pool is greater than or equal to the individual utilization rate threshold corresponding to the first resource pool, when the overall resource utilization rate is greater than or equal to the overall utilization rate threshold; wherein the priority of the first resource pool is higher than the priority of the second resource pool.
[0158] In some embodiments of the present invention, the second resource allocation unit is configured to:
[0159] The processing of at least part of the tasks to which the resources in the second resource pool have been allocated is suspended, and the resources in the second resource pool that have been allocated to the at least part of the tasks are allocated to the first resource pool.
[0160] In some embodiments of the present invention, the device further comprises:
[0161] The task recovery processing module is used to reallocate resources from the second resource pool to at least part of the tasks if it is detected that the individual resource utilization rate of the second resource pool is less than the individual utilization rate threshold corresponding to the second resource pool, so as to recover the processing of at least part of the tasks.
[0162] In some embodiments of the present invention, the device further comprises:
[0163] The individual resource usage rate setting module is used to set individual resource usage rate thresholds for the multiple resource pools according to corresponding priorities.
[0164] In some embodiments of the present invention, the cluster is provided with a plurality of nodes, and the apparatus further comprises:
[0165] The node partitioning module is used to partition the resources of each node in the cluster into the multiple resource pools.
[0166] In an embodiment of the present invention, multiple resource pools are created for a cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priorities; the individual resource utilization rate of each resource pool is obtained; and according to the individual resource utilization rate, the resources in the multiple resource pools are dynamically adjusted, thereby realizing optimization and allocation of resources according to task priorities, and dynamic adjustment of resources in the resource pools, thereby improving the utilization rate of the service cluster while ensuring the quality of service.
[0167] Some embodiments of the present invention further provide an electronic device, comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the above method is implemented when the computer program is executed by the processor.
[0168] Some embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, and the computer program implements the above method when executed by a processor.
[0169] Some embodiments of the present invention further provide a computer program product, including a computer program, which implements the above method when executed by a processor.
[0170] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0171] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0172] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0173] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0174] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0175] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0176] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0177] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0178] Finally, it should be noted that, in this article, relational terms such as first and second, etc. 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 terminal 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 terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.
[0179] The above is a detailed introduction to the method, device, equipment, medium and product for resource processing in a cluster. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for resource processing in a cluster, characterized in that: The method comprises: Creating multiple resource pools for the cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priority; Get the individual resource usage of each resource pool; The resources in the multiple resource pools are dynamically adjusted according to the individual resource usage rates.
2. The method according to claim 1, characterized in that The dynamically adjusting the resources in the multiple resource pools according to the individual resource usage rate includes: Obtaining overall resource utilization rates of the multiple resource pools; The resources in the multiple resource pools are dynamically adjusted according to the overall resource utilization rate and the individual resource utilization rate.
3. The method according to claim 2, characterized in that The dynamically adjusting the resources in the plurality of resource pools according to the overall resource utilization rate and the individual resource utilization rate includes: When the overall resource usage is less than the overall usage threshold, if it is detected that the individual resource usage of the first resource pool is greater than or equal to the individual usage threshold corresponding to the first resource pool, the idle resources of the multiple resource pools are allocated to the first resource pool.
4. The method according to claim 2, characterized in that: The dynamically adjusting the resources in the plurality of resource pools according to the overall resource utilization rate and the individual resource utilization rate includes: In the case where the overall resource usage is greater than or equal to the overall usage threshold, if it is detected that the individual resource usage of the first resource pool is greater than or equal to the individual usage threshold corresponding to the first resource pool, the allocated resources in the second resource pool are allocated to the first resource pool; The priority of the first resource pool is higher than the priority of the second resource pool.
5. The method according to claim 4, characterized in that The allocating the allocated resources in the second resource pool to the first resource pool includes: The processing of at least part of the tasks to which the resources in the second resource pool have been allocated is suspended, and the resources in the second resource pool that have been allocated to the at least part of the tasks are allocated to the first resource pool.
6. The method according to claim 5, characterized in that Also includes: If it is detected that the individual resource usage rate of the second resource pool is less than the individual usage rate threshold corresponding to the second resource pool, resources are reallocated from the second resource pool to the at least part of the tasks to resume processing of the at least part of the tasks.
7. The method according to any one of claims 2 to 5, characterized in that: After creating a plurality of resource pools for the cluster, the method further includes: Individual resource usage rate thresholds are set for the multiple resource pools according to corresponding priorities.
8. The method according to claim 1, characterized in that The cluster is provided with a plurality of nodes, and after the plurality of resource pools for the cluster are created, the method further includes: The resources of each node in the cluster are divided into the multiple resource pools.
9. A device for resource processing in a cluster, characterized in that: The device comprises: A resource pool creation module, used to create multiple resource pools for the cluster; wherein different resource pools correspond to different priorities, and each resource pool provides resources for tasks of corresponding priority; An individual resource usage acquisition module is used to obtain the individual resource usage of each resource pool; The resource dynamic adjustment module is used to dynamically adjust the resources in the multiple resource pools according to the individual resource utilization rates.
10. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the method according to any one of claims 1 to 8 when executed by the processor.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
12. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 8.