Resource management method and device, electronic equipment and storage medium

By determining and recovering resources from the shared resource pool in advance in the cluster system, the problem of cluster business instability caused by insufficient resources is solved, and timely allocation of resources and stable operation of cluster business is achieved.

CN120371491APending Publication Date: 2025-07-25MOMENTA (SUZHOU) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410095195.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-23
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

In a cluster system, when the shared resource pool resources are insufficient, the problem of inability to recover in time leads to unstable operation of other cluster services.

Method used

When the shared resource pool is insufficient, the target cluster to be recycled from multiple clusters in advance and forced the resource to be recycled to the shared resource pool is ensured that the resource-deficient cluster can obtain resources in a timely manner.

Benefits of technology

It realizes timely allocation of resources when resources are scarce, ensures the stable operation of cluster business, and avoids resource waste and business interruption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371491A_ABST
    Figure CN120371491A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource management method and device, electronic equipment and a storage medium, and can recycle resources allocated in a shared resource pool in advance when it is determined that the resources in the shared resource pool are insufficient, so that the resources can be allocated to a cluster needing the resources in time. The resource management method comprises the following steps: obtaining the quantity of available resources in a shared resource pool; in response to the fact that the available resource quantity is smaller than an available resource threshold value, determining a to-be-recycled resource quantity, and determining a first target cluster of the to-be-recycled resources from the plurality of clusters; resources corresponding to the to-be-recycled resource quantity are recycled from the first target cluster to a shared resource pool; and in response to a resource application request of the second target cluster, allocating resources to the second target cluster from the shared resource pool.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of cluster systems, and in particular, to a resource management method, apparatus, electronic device, and storage medium.

Background Art

[0002] Currently, in a cluster system, in order to improve the resource utilization rate of each cluster, each cluster can share some resources to a shared resource pool for some clusters that are currently at the peak of their business. However, when other clusters are also about to reach the peak of their business, the shared resources may not be recovered in time, resulting in the unstable operation of the business of other clusters.

Summary of the Invention

[0003] The embodiments of the present application provide a resource management method, apparatus, electronic device, and storage medium, which can pre-recover the resources allocated from the shared resource pool when it is determined that the resources in the shared resource pool are insufficient, so as to timely allocate resources to the clusters that need resources.

[0004] In a first aspect, the embodiments of the present application provide a resource management method applied to a cluster system, where the cluster system includes multiple clusters, and a shared resource pool is formed among the multiple clusters. The method includes:

[0005] Obtain the available resource amount in the shared resource pool;

[0006] In response to the available resource amount being less than the available resource threshold, determine the amount of resources to be recovered, and determine a first target cluster for the resources to be recovered from the multiple clusters;

[0007] Recover the resources corresponding to the amount of resources to be recovered from the first target cluster to the shared resource pool;

[0008] In response to a resource application request from a second target cluster, allocate resources from the shared resource pool to the second target cluster.

[0009] In the embodiments of the present application, there is a corresponding available resource threshold for the available resource amount in the shared resource pool. Once the available resource amount in the shared resource pool is lower than the above available resource threshold, it can be considered that the available resource amount in the shared resource pool is insufficient. At this time, the amount of resources to be recovered and the first target cluster that can perform resource recovery can be determined, and the resources corresponding to the amount of resources to be recovered can be forcibly recovered from the first target cluster to the shared resource pool in advance. After the recovery is completed, if there is a second target cluster that needs to apply for resources due to insufficient resources, the recovered resources can be timely reallocated to the second target cluster, so as to ensure the stable operation of the business of the second target cluster.

[0010] Optionally, in response to the available resource amount being less than the available resource threshold, determining the amount of resources to be recycled includes:

[0011] In response to the available resource amount being less than the available resource threshold, calculating the difference between the available resource amount and the available resource threshold to obtain the baseline amount of resources to be recycled;

[0012] Calculating the product of the baseline amount of resources to be recycled and a preset recycling coefficient and performing a ceiling operation to obtain the amount of resources to be recycled, where the preset recycling coefficient is greater than 1.

[0013] In the embodiments of the present application, the difference between the available resource amount and the available resource threshold, that is, the baseline amount of resources to be recycled, can be considered as the minimum amount of resources to be recycled. By assigning a preset recycling coefficient greater than 1 to this minimum amount of resources, the recycling amount can be increased, enabling as many clusters as possible to participate in the recycling process, so that as much resources as possible can be recycled in a short time.

[0014] Optionally, in response to the available resource amount being less than the available resource threshold, determining a first target cluster for the resources to be recycled from the multiple clusters includes:

[0015] In response to the available resource amount being less than the available resource threshold, obtaining the first resource occupancy of each cluster in the multiple clusters;

[0016] Calculating the difference between the first resource occupancy and the necessary guarantee resource threshold corresponding to each cluster to obtain the resource surplus;

[0017] Calculating the difference between the maximum resource occupancy and the minimum resource occupancy corresponding to each cluster to obtain the resource variability;

[0018] Regarding the clusters with the resource variability greater than 0 and the resource surplus greater than 0 as the first target clusters.

[0019] In the embodiments of the present application, each cluster has a maximum resource occupancy, a minimum resource occupancy, and a necessary guarantee resource threshold required to ensure the stable operation of the service. When determining whether a certain cluster can recycle resources, on the one hand, it is necessary to judge whether the resources actually occupied by the cluster currently are higher than the necessary guarantee resource threshold required by itself. If it is higher, it can be considered that there are redundant resources in these clusters. If it is less, it can be considered that there are no redundant resources in this cluster. On the other hand, it is necessary to judge whether the maximum resource occupancy of this cluster is greater than the minimum resource occupancy. If it is greater, it can be considered that the resources in this cluster are allowed to change. If they are equal, it can be considered that the resources in this cluster need to be fixed and are not allowed to change. Therefore, regarding the clusters with redundant resources and allowing resource changes as the clusters that can recycle resources not only ensures the stable operation of the original cluster but also accurately screens out the clusters that can recycle resources.

[0020] Optionally, there are at least two first target clusters, and recycling the resources with the to-be-recycled resource amount from the first target clusters to the shared resource pool includes:

[0021] Sorting at least two first target clusters in descending order based on the resource surplus;

[0022] If the resource surplus corresponding to the first first target cluster is not less than the to-be-recycled resource amount, recycling the resources with the to-be-recycled resource amount in the first first target cluster to the shared resource pool.

[0023] In the embodiments of the present application, when there are multiple first target clusters with a resource surplus greater than 0, the multiple first target clusters with a resource surplus greater than 0 can be sorted in descending order according to the resource surplus. When the first target cluster with the largest resource surplus meets the requirements of the to-be-recycled resource amount, resource recycling is preferentially performed from the first target cluster with the largest resource surplus, which can not only meet the requirement of recycling a sufficient amount of resources but also improve the resource recycling efficiency.

[0024] Optionally, the method further includes:

[0025] If the resource surplus corresponding to the first first target cluster is less than the to-be-recycled resource amount, recycling the resources with the resource surplus corresponding to the first first target cluster to the shared resource pool;

[0026] Calculating the difference between the to-be-recycled resource amount and the resource surplus corresponding to the first first target cluster to obtain the to-be-recycled resource vacancy amount;

[0027] Recycling the resources with the to-be-recycled resource vacancy amount in the remaining first target clusters except the first first target cluster in the at least two first target clusters to the shared resource pool.

[0028] In the embodiments of the present application, when the first target cluster with the largest resource surplus cannot meet the to-be-recycled resource amount, all the resource surplus can be recycled from the first target cluster with the largest resource surplus, and the to-be-recycled resource vacancy amount is recycled from other first target clusters, so as to ensure that a sufficient amount of resources can be recycled.

[0029] Optionally, the resource application request carries a resource application amount. Responding to the resource application request of the second target cluster and allocating resources from the shared resource pool to the second target cluster includes:

[0030] Responding to the resource application request of the second target cluster, and obtaining the second resource occupation amount of the second target cluster;

[0031] In response to the second resource occupancy being less than the maximum resource occupancy corresponding to the second target cluster, compare the updated available resource amount with the available resource threshold;

[0032] In response to the updated available resource amount being greater than the available resource threshold, allocate the resource application amount from the shared resource pool to the second target cluster.

[0033] In the embodiments of the present application, after resource recovery in the shared resource pool, if the actual resource occupancy of the second target cluster that applies for resources from the shared resource pool is less than the maximum resource occupancy allowed for the second target cluster, it can be considered at this time that the resource amount of the second target cluster is allowed to increase. At this time, it can be further determined whether the updated available resource amount in the resource pool after resource recovery is greater than the available resource threshold. If it is greater, it indicates that the available resources in the shared resource pool after resource recovery are sufficient. Then, allocate the resource amount applied by the second target cluster to the second target cluster, so as to better meet the resource requirements of the services in the second target cluster.

[0034] Optionally, after obtaining the second resource occupancy of the second target cluster, the method further includes:

[0035] In response to the second resource occupancy being not less than the maximum cluster resource occupancy corresponding to the second target cluster, reject allocating resources from the shared resource pool to the second target cluster.

[0036] In the embodiments of the present application, after resource recovery in the shared resource pool, if the actual resource occupancy of the second target cluster that applies for resources from the shared resource pool is greater than the maximum resource occupancy allowed for the second target cluster, it can be considered at this time that the resource amount of the second target cluster is sufficient, that is, it can fully meet the stable operation of the services in the second target cluster. At this time, the shared resource pool can reject allocating resources to the second target cluster.

[0037] Optionally, after comparing the updated available resource amount with the available resource threshold, the method further includes:

[0038] In response to the updated available resource amount being less than the available resource threshold, compare the second resource occupancy with the necessary guarantee resource threshold corresponding to the second target cluster;

[0039] In response to the second resource occupancy being less than the necessary guarantee resource threshold corresponding to the second target cluster, compare the updated available resource amount with the resource application amount;

[0040] In response to the updated available resource amount being greater than the resource application amount, allocate the cluster resource application amount from the shared resource pool to the second target cluster.

[0041] In the embodiment of the present application, after resource recovery in the shared resource pool, if the actual resource occupancy of the second target cluster that applies for resources from the shared resource pool is less than the maximum resource occupancy allowed by the second target cluster, at this time, it can be considered that the resource volume of the second target cluster is allowed to increase. At this time, it can be further determined whether the updated available resource volume in the resource pool after resource recovery is greater than the available resource threshold. If it is less, it indicates that the available resources in the shared resource pool after resource recovery are still not sufficient. At this time, it can be further determined whether the actual resource volume of the second target cluster is less than the necessary guarantee resource threshold corresponding to maintaining the service. If it is less, the actual resource volume of the second target cluster is in short supply. At this time, if the resource application volume of the second target cluster is less than the available resource volume of the shared resource pool, the shared resource pool allocates the applied resource volume to the second target cluster, so as to ensure that the services in the second target cluster with resource shortage can run stably.

[0042] Optionally, after comparing the second resource occupancy with the necessary guarantee resource threshold corresponding to the second target cluster, the method further includes:

[0043] In response to the second resource occupancy being not less than the necessary guarantee resource threshold corresponding to the second target cluster, rejecting to allocate resources from the shared resource pool to the second target cluster.

[0044] In the embodiment of the present application, after resource recovery in the shared resource pool, if the actual resource occupancy of the second target cluster that applies for resources from the shared resource pool is less than the maximum resource occupancy allowed by the second target cluster, at this time, it can be considered that the resource volume of the second target cluster is allowed to increase. At this time, it can be further determined whether the updated available resource volume in the resource pool after resource recovery is greater than the available resource threshold. If it is less, it indicates that the available resources in the shared resource pool after resource recovery are still not sufficient. At this time, it can be further determined whether the actual resource volume of the second target cluster is less than the necessary guarantee resource threshold corresponding to maintaining the service. If it is not less, the actual resource volume of the second target cluster can maintain the stable operation of the service. At this time, the shared resource pool rejects to allocate resources to the second target cluster, so that in the case of insufficient resources in the shared resource pool, the limited resources can be allocated to the clusters that are more in urgent need of resources.

[0045] In a second aspect, the embodiment of the present application provides a resource management device, which is set in a cluster system. The cluster system includes multiple clusters, and a shared resource pool is formed among the multiple clusters. The device includes:

[0046] A first acquisition unit, configured to acquire the available resource volume in the shared resource pool;

[0047] A determination unit, configured to determine the amount of resources to be recycled and a first target cluster for the resources to be recycled from the multiple clusters in response to the amount of available resources being less than the available resource threshold;

[0048] A recycling unit, configured to recycle the resources corresponding to the amount of resources to be recycled from the first target cluster to the shared resource pool;

[0049] A redistribution unit, configured to allocate resources from the shared resource pool to a second target cluster in response to a resource application request of the second target cluster.

[0050] Optionally, the determination unit includes: a unit for determining the amount of resources to be recycled;

[0051] The unit for determining the amount of resources to be recycled is specifically configured to:

[0052] In response to the amount of available resources being less than the available resource threshold, calculate the difference between the amount of available resources and the available resource threshold to obtain a benchmark amount of resources to be recycled;

[0053] Calculate the product of the benchmark amount of resources to be recycled and a preset recycling coefficient and perform a ceiling operation to obtain the amount of resources to be recycled, where the preset recycling coefficient is greater than 1.

[0054] Optionally, the determination unit includes: a cluster determination unit;

[0055] The cluster determination unit is specifically configured to:

[0056] In response to the amount of available resources being less than the available resource threshold, obtain the first resource occupancy of each cluster in the multiple clusters;

[0057] Calculate the difference between the first resource occupancy and the necessary guarantee resource threshold corresponding to each cluster to obtain a resource surplus;

[0058] Calculate the difference between the maximum resource occupancy and the minimum resource occupancy corresponding to each cluster to obtain a resource variability;

[0059] Use the clusters with the resource variability greater than 0 and the resource surplus greater than 0 as the first target clusters.

[0060] Optionally, there are at least two first target clusters, and the recycling unit includes:

[0061] A sorting unit, configured to sort at least two first target clusters in descending order based on the resource surplus;

[0062] A resource recovery unit, which is used to recover the resources with the amount of the to-be-recovered resources in the first first target cluster to the shared resource pool if the resource surplus corresponding to the first first target cluster is not less than the amount of the to-be-recovered resources.

[0063] Optionally, the resource recovery unit is further used for:

[0064] Calculating the difference between the amount of the to-be-recovered resources and the resource surplus corresponding to the first first target cluster to obtain the to-be-recovered resource vacancy;

[0065] Recovering the resources with the amount of the to-be-recovered resource vacancy in the remaining first target clusters except the first first target cluster in the at least two first target clusters to the shared resource pool.

[0066] Optionally, the resource application request carries the amount of the resource application, and the redistribution unit includes:

[0067] A second acquisition unit, which is used to acquire the second resource occupancy of the second target cluster in response to the resource application request of the second target cluster;

[0068] A comparison unit, which is used to compare the size of the updated available resource amount and the available resource threshold in response to the second resource occupancy being less than the maximum resource occupancy corresponding to the second target cluster;

[0069] A resource redistribution unit, which is used to allocate the amount of the resource application from the shared resource pool to the second target cluster in response to the updated available resource amount being greater than the available resource threshold.

[0070] Optionally, the redistribution unit is further used for:

[0071] Responding to the second resource occupancy being not less than the maximum cluster resource occupancy corresponding to the second target cluster, and refusing to allocate resources from the shared resource pool to the second target cluster.

[0072] Optionally, the comparison unit is further used for:

[0073] Responding to the updated available resource amount being less than the available resource threshold, and comparing the second resource occupancy with the necessary guarantee resource threshold corresponding to the second target cluster;

[0074] Responding to the second resource occupancy being less than the necessary guarantee resource threshold corresponding to the second target cluster, and comparing the updated available resource amount with the amount of the resource application;

[0075] The redistribution unit is further used for:

[0076] In response to the updated available resource amount being greater than the resource application amount, allocate the cluster resource application amount from the shared resource pool to the second target cluster.

[0077] Optionally, the reallocation unit is further configured to:

[0078] In response to the second resource occupancy being not less than the necessary guarantee resource threshold corresponding to the second target cluster, reject allocating resources for the second target cluster from the shared resource pool.

[0079] In a third aspect, an embodiment of the present application provides an electronic device, which includes:

[0080] At least one processor;

[0081] A memory coupled to the processor;

[0082] When the at least one processor is used to execute the computer program stored in the memory, the steps of the method described in any embodiment of the first aspect or the second aspect are implemented.

[0083] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in any embodiment of the first aspect are implemented.

[0084] It should be understood that the second to fourth aspects of the embodiments of the present application are consistent with the technical solutions of the first aspect and the second aspect of the embodiments of the present application. The beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar, and will not be repeated.

Description of the Drawings

[0085] To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0086] Figure 1 A schematic diagram of a resource management mode provided by an embodiment of the present application;

[0087] Figure 2 (a)- Figure 2 (b) is a schematic diagram of a resource management method provided by an embodiment of the present application;

[0088] Figure 3 A flowchart of a resource management method provided by an embodiment of the present application;

[0089] Figure 4Flow chart of a method for determining the amount of resources to be recycled provided by an embodiment of the present application;

[0090] Figure 5 Flow chart of a method for determining a resource recycling cluster provided by an embodiment of the present application;

[0091] Figure 6 Flow chart of a resource recycling method provided by an embodiment of the present application;

[0092] Figure 7 Flow chart of a resource recycling method provided by an embodiment of the present application;

[0093] Figure 8 Flow chart of a resource reallocation method provided by an embodiment of the present application;

[0094] Figure 9 Flow chart of a resource reallocation method provided by an embodiment of the present application;

[0095] Figure 10 Flow chart of a resource reallocation method provided by an embodiment of the present application;

[0096] Figure 11 Flow chart of a resource reallocation method provided by an embodiment of the present application;

[0097] Figure 12 Structural diagram of a resource management device provided by an embodiment of the present application;

[0098] Figure 13 Structural diagram of an electronic device provided by an embodiment of the present application.

Detailed implementation manners

[0099] To better understand the technical solutions of this specification, the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0100] It should be clear that the described embodiments are only a part of the embodiments of this specification, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this specification without creative efforts belong to the scope protected by this specification.

[0101] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit this specification. The singular forms of "a", "the" and "said" used in the embodiments of the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.

[0102] The following explains the professional terms involved in the embodiments of the present application.

[0103] Cluster mode: Cluster mode is a method of organizing and managing computing resources on one or more nodes to achieve high availability, fault tolerance, and scalability. In the field of computing, clusters are typically used to handle large-scale workloads and applications. In cluster mode, multiple computing nodes form a cluster and share resources and tasks. These nodes can be physical machines or virtual machines, which are connected together through a network. Cluster mode distributes the workload across multiple nodes to achieve parallel processing and sharing of resources. When a node fails or needs maintenance, other nodes can continue to process tasks, ensuring the availability and stability of the system.

[0104] Please refer to Figure 1 , which is a schematic diagram of a resource management mode provided by an embodiment of the present application. As Figure 1 shown, the cluster system includes Cluster A, Cluster B, and Cluster C. Each of Cluster A, Cluster B, and Cluster C has 9 resources. Each node within the same cluster can share these 9 resources, while the resources used between different clusters are isolated from each other, that is, Cluster A, Cluster B, and Cluster C cannot use the resources of each other. Since the business characteristics of Cluster A, Cluster B, and Cluster C may be different, the peak usage times of resources for each cluster are also different. In some cases, Cluster B and Cluster C are already at the business peak, but Cluster A is at the business low peak. However, due to the resource isolation limitation between Cluster A, Cluster B, and Cluster C, Cluster A at the business low peak cannot share its own resources with Cluster B and Cluster C at the business peak. At this time, additional resources need to be configured for Cluster B and Cluster C, and the idle resources in Cluster A are not fully utilized, resulting in resource waste.

[0105] Please refer to Figure 2 , which is a schematic diagram of a resource management method provided by an embodiment of the present application. As Figure 2 (a) shown, the cluster system includes Cluster A, Cluster B, and Cluster C. Each of Cluster A, Cluster B, and Cluster C has 9 resources. The difference from Figure 1 is that a shared resource pool is formed between Cluster A, Cluster B, and Cluster C. Cluster A, Cluster B, and Cluster C can all share a certain number of resources to the shared resource pool when their own business is at a low peak. For example, Cluster A, Cluster B, and Cluster C each contribute the resources corresponding to 4 machines as shared resources and add them to the shared resource pool. As Figure 2As shown in (b), when Cluster A is at a low business peak while Clusters B and C are at high business peaks, the scale of Cluster A can be shrunk, the resources corresponding to the 4 shared machines can be removed, and disassembled for use by Clusters B and C. In the above process, without destroying resource isolation, through dynamic resource disassembly, resource complementarity can be achieved and resource waste can be avoided. When the total amount of resources remains unchanged, more business can be carried by the relevant clusters.

[0106] The inventors of this application have found through research that in the above resource management method, in some scenarios, when the high business peaks of Clusters B and C have not yet subsided, but the high business peak of Cluster A is about to come, Clusters B and C will not actively release the borrowed resources to the shared resource pool. Then, Cluster A, which is about to be at a high business peak, will not be able to apply for resources from the shared resource pool, resulting in unstable business operation of Cluster A.

[0107] In view of this, the embodiments of this application provide a resource management method. In this method, when the available resources in the shared resource pool are insufficient, the resources are forcibly recycled in advance. After the recycling is completed, if there are clusters with resource shortages that need to apply for resources, resource reallocation can be carried out in a timely manner, so as to ensure the stable operation of the business of the clusters with resource shortages.

[0108] The technical solutions provided by the embodiments of this application are introduced below with reference to the accompanying drawings. Please refer to Figure 3 , which is a schematic flowchart of a resource management method provided by the embodiments of this application. The process of this method is described as follows:

[0109] Step 101: Obtain the amount of available resources in the shared resource pool.

[0110] In the embodiments of this application, the resources in the shared resource pool can be allocated to any cluster in the cluster system according to actual needs, and the amount of available resources is the amount of resources in the shared resource pool that have not been allocated to any cluster. By obtaining the amount of available resources in the shared resource pool, the allocable resource situation of the shared resource pool can be evaluated, which can be used as a basis for whether resource recycling is needed subsequently.

[0111] Step 102: Determine the amount of resources to be recycled in response to the available resource amount being less than the available resource threshold.

[0112] Step 103: Determine the first target cluster of the resources to be recycled from multiple clusters in response to the available resource amount being less than the available resource threshold.

[0113] In the embodiments of the present application, an available resource threshold is set for the shared resource pool, which is the minimum value of the theoretically available resources in the shared resource pool. If the actually obtained available resources in step 101 are less than the above available resource threshold, it indicates that the available resources in the shared resource pool are insufficient and may not be able to allocate the required resources to the resource-scarce cluster well. Then, resource recovery is required. Before resource recovery, it is necessary to determine how much resources need to be recovered specifically and, in the case of multiple clusters, from which cluster to recover resources.

[0114] Please refer to Figure 4 , which is a schematic flowchart of a method for determining the amount of resources to be recovered provided by the embodiments of the present application. Step 102 can be specifically implemented by executing sub-steps 1021 and 1022:

[0115] Step 1021: In response to the available resources being less than the available resource threshold, calculate the difference between the available resources and the available resource threshold to obtain the benchmark amount of resources to be recovered.

[0116] In the embodiments of the present application, since the available resource threshold is the minimum value of the theoretically available resources in the shared resource pool, that is, theoretically, as long as the available resources in the shared resource pool reach the available resource threshold, it can be considered that the available resources in the shared resource pool are relatively sufficient, thus meeting the resource allocation requirements for the resource-scarce cluster. Therefore, theoretically, the difference between the available resources and the available resource threshold is the minimum amount of resources that need to be recovered. Here, the minimum amount of resources that need to be recovered can be called the benchmark amount of resources to be recovered.

[0117] Step 1022: Calculate the product of the benchmark amount of resources to be recovered and the preset recovery coefficient and perform a ceiling operation to obtain the amount of resources to be recovered, where the preset recovery coefficient is greater than 1.

[0118] In the embodiments of the present application, considering that in actual resource recovery, it is not completed instantaneously, and the resource recovery process takes a certain amount of time. Then, there may be a situation where the shared resource pool needs to allocate resources to the resource-scarce cluster before the resource recovery is completed. Therefore, on the basis of determining the benchmark amount of resources to be recovered, a preset recovery coefficient can be multiplied by the benchmark amount of resources to be recovered. The preset recovery coefficient can be set to be greater than 1. Then, the finally determined amount of resources to be recovered is greater than the benchmark amount of resources to be recovered. That is to say, by setting a preset recovery coefficient greater than 1, the amount of resources that need to be recovered is appropriately increased, so as to ensure that as much resources as possible can be recovered in a short time in the presence of recovery time consumption, thus meeting the requirements of subsequent resource reallocation.

[0119] For example, the available resources in the shared resource pool are 3, the available resource threshold is 5, the preset recovery coefficient is 1.3, the baseline amount of resources to be recovered is 5 - 3 = 2, the product of the baseline amount of resources to be recovered and the preset recovery coefficient is 1.3 * 2 = 2.6, and rounding up 2.6 gives the amount of resources to be recovered as 3.

[0120] Please refer to Figure 5 , which is a schematic flowchart of a method for determining a resource cluster to be recovered provided by an embodiment of the present application. Step 103 can be specifically implemented by executing sub-steps 1031 and 1034:

[0121] Step 1031: In response to the available resource amount being less than the available resource threshold, obtain the first resource occupancy of each cluster in multiple clusters.

[0122] Step 1032: Calculate the difference between the first resource occupancy and the necessary guarantee resource threshold corresponding to each cluster to obtain the resource surplus.

[0123] In an embodiment of the present application, each cluster has a corresponding necessary guarantee resource threshold, and the necessary guarantee resource threshold can be any value between the maximum resource occupancy and the minimum resource occupancy of the cluster. The necessary guarantee resource threshold is different from the minimum resource occupancy: the minimum resource occupancy is the minimum amount of resources reserved during the low peak of the cluster service, while the necessary guarantee resource threshold refers to the non-deprivable resource guarantee amount in the case of peak service and resource shortage. Then, when determining which cluster can perform resource recovery, it is first necessary to know the actual resource occupancy of each cluster, such as the first resource occupancy of each cluster, and then compare the first resource occupancy of each cluster with the necessary guarantee resource threshold of each cluster. If the first resource occupancy is greater than the necessary guarantee resource threshold, that is, the resource surplus is greater than 0, it indicates that there are some non-essential resources in this cluster, and it can be used as a candidate cluster for resource recovery; if the first resource occupancy is not greater than the necessary guarantee resource threshold, that is, the resource surplus is less than 0, it indicates that there are no non-essential resources in this cluster, and at this time, this cluster cannot be used as a candidate cluster for resource recovery.

[0124] Step 1033: Calculate the difference between the maximum resource occupancy and the minimum resource occupancy corresponding to each cluster to obtain the resource variability.

[0125] In the embodiments of the present application, for any cluster, there is a corresponding maximum resource occupancy and minimum resource occupancy. If the maximum resource occupancy is equal to the minimum resource occupancy, that is, the resource variable amount is 0, it indicates that once the resources of this cluster are allocated, they are not allowed to change. Naturally, resources cannot be recycled from these clusters either, otherwise it will affect the stable operation of the services in these clusters. If the maximum resource occupancy is greater than the minimum resource occupancy, that is, the resource variable amount is greater than 0, it indicates that the resources of this cluster are allowed to change between the minimum resource occupancy and the maximum resource occupancy. Then, the clusters whose resource amounts are allowed to change can be used as candidate clusters for resource recycling.

[0126] Step 1034: Use the clusters with a resource variable amount greater than 0 and a resource surplus greater than 0 as the first target clusters.

[0127] In the embodiments of the present application, after separately evaluating whether there is a resource surplus in each cluster and whether the resources of each cluster are variable, the clusters that simultaneously meet the conditions of having a resource surplus and being resource variable are used as the first target clusters for resource recycling, which can not only ensure the normal recycling of resources, but also ensure that the first target clusters can still operate stably after resource recycling.

[0128] Step 104: Recycle the resources corresponding to the amount of resources to be recycled from the first target clusters to the shared resource pool.

[0129] In the embodiments of the present application, after determining the first target clusters for resource recycling, the resources corresponding to the amount of resources to be recycled in the first target clusters can be recycled to the shared resource pool.

[0130] In some embodiments, if there are at least two first target clusters screened based on step 1034, then relevant strategies can be adopted to recycle the resources corresponding to the amount of resources to be recycled from the at least two first target clusters to the shared resource pool.

[0131] Please refer to Figure 6 , which is a schematic flowchart of a resource recycling method provided by the embodiments of the present application. Step 104 can be specifically implemented by executing sub-steps 1041 and 1042:

[0132] Step 1041: Sort the at least two first target clusters in descending order based on the resource surplus.

[0133] Step 1042: If the resource surplus corresponding to the first first target cluster is not less than the amount of resources to be recycled, recycle the resources corresponding to the amount of resources to be recycled in the first first target cluster to the shared resource pool.

[0134] In the embodiments of the present application, when there are multiple first target clusters with a resource surplus greater than 0, the multiple first target clusters with a resource surplus greater than 0 can be sorted in descending order of the resource surplus. If the first first target cluster, that is, the first target cluster with the largest resource surplus, meets the requirements for the amount of resources to be recycled, resource recycling is preferentially performed from the first first target cluster, which can not only meet the requirement of recycling a sufficient amount of resources but also improve the resource recycling efficiency.

[0135] For example, there are 4 first target clusters with a resource surplus greater than 0, and their resource surpluses are 5, 3, 2, and 1 respectively. If the amount of resources to be recycled is 4, then the first target cluster with the largest resource surplus, that is, the resource surplus is 5, can meet the requirement for the amount of resources to be recycled, so 4 amounts of resources can be directly recycled from the first target cluster.

[0136] In some embodiments, the resource surplus of the first first target cluster may not meet the requirements of the shared resource pool for the amount of resources to be recycled. Then, resource recycling can also be performed from other first target clusters except the first first target cluster.

[0137] Please refer to Figure 7 , which is a schematic flowchart of a resource recycling method provided by the embodiments of the present application. After step 1041 is executed, steps 1043-1045 can also be continued:

[0138] Step 1043: If the resource surplus corresponding to the first first target cluster is less than the amount of resources to be recycled, recycle the resources with the resource surplus corresponding to the first first target cluster to the shared resource pool.

[0139] Step 1044: Calculate the difference between the amount of resources to be recycled and the resource surplus corresponding to the first first target cluster to obtain the shortage of resources to be recycled.

[0140] Step 1045: Recycle the resources with the shortage of resources to be recycled in the remaining first target clusters except the first first target cluster among at least two first target clusters to the shared resource pool.

[0141] In the embodiments of the present application, when the first first target cluster with the largest resource surplus cannot meet the amount of resources to be recycled, the entire resource surplus can be recycled from the first first target cluster with the largest resource surplus, and the shortage of resources to be recycled is recycled from other first target clusters, so as to ensure that a sufficient amount of resources can be recycled.

[0142] For example, there are 4 first target clusters with a resource surplus greater than 0, and their resource surpluses are 5, 3, 2, and 1 respectively. If the amount of resources to be recycled is 8, first start resource recycling from the first target cluster with the largest resource surplus, that is, the first target cluster with a resource surplus of 5. After recycling 5 resources, the shortage of resources to be recycled is 8 - 5 = 3. At this time, it is possible to further start resource recycling from the first target cluster ranked second in terms of resource surplus, that is, the first target cluster with a resource surplus of 3. After recycling these 3 resources, the requirement for the amount of resources to be recycled is exactly met, thus ending the recycling process.

[0143] It should be understood that, of course, there may also be a situation where the amount of resources to be recycled is large, that is, the amount of resources to be recycled is greater than the sum of the resource surpluses of multiple first target clusters with a resource surplus greater than 0. In this case, at most only the resources corresponding to the sum of the resource surpluses of multiple first target clusters can be recycled to the shared resource pool, so as to try to meet the resource recycling requirements of the shared resource pool.

[0144] Step 105: In response to a resource application request from a second target cluster, allocate resources from the shared resource pool to the second target cluster.

[0145] In the embodiments of the present application, after the shared resource pool recycles the resources corresponding to the amount of resources to be recycled, when there is a resource application from a second target cluster, resources can be redistributed to the second target cluster in a timely manner from the shared resource pool, so as to ensure the stable operation of services in the second target cluster.

[0146] In some embodiments, when the resource shortage degrees of the second target clusters are different, the resource allocation strategies of the shared resource pool are also different.

[0147] Please refer to Figure 8 , which is a schematic flowchart of a resource redistribution method provided by the embodiments of the present application. Step 105 can be specifically implemented by executing sub-steps 1051 - 1053:

[0148] Step 1051: In response to a resource application request from a second target cluster, obtain the second resource occupancy of the second target cluster.

[0149] Step 1052: In response to the second resource occupancy being less than the maximum resource occupancy corresponding to the second target cluster, compare the updated available resource amount with the available resource threshold.

[0150] Step 1053: In response to the updated available resource amount being greater than the available resource threshold, allocate the resource application amount from the shared resource pool to the second target cluster.

[0151] In the embodiments of the present application, after resource recovery in the shared resource pool, if the actual resource occupancy of the second target cluster that applies for resources from the shared resource pool, that is, the second resource occupancy, is less than the maximum resource occupancy allowed by the second target cluster, it can be considered at this time that the resources of the second target cluster are allowed to increase. At this time, it can be further determined whether the updated available resources in the shared resource pool after resource recovery are greater than the available resource threshold. If so, it indicates that the available resources in the shared resource pool after resource recovery are sufficient. Then, allocate the resource amount applied by the second target cluster to the second target cluster, so as to better meet the resource requirements of the services in the second target cluster.

[0152] It should be understood that the resource application amount of the second target cluster each time is usually less than the available resource threshold. Therefore, when the updated available resources are greater than the available resource threshold, the updated available resources will definitely be able to meet the application amount requirements of the second target cluster.

[0153] Please refer to Figure 9 , which is a schematic flowchart of a resource reallocation method provided by the embodiments of the present application. After executing step 1051, step 1054 can also be continued:

[0154] Step 1054: In response to the second resource occupancy being not less than the maximum cluster resource occupancy corresponding to the second target cluster, reject allocating resources from the shared resource pool to the second target cluster.

[0155] In the embodiments of the present application, after resource recovery in the shared resource pool, if the actual resource occupancy of the second target cluster that applies for resources from the shared resource pool, that is, the second resource occupancy, is greater than the maximum resource occupancy allowed by the second target cluster, it can be considered at this time that the existing resources of the second target cluster are sufficient, that is, it can fully meet the stable operation of the services in the second target cluster. At this time, the shared resource pool can reject allocating resources to the second target cluster.

[0156] Please refer to Figure 10 , which is a schematic flowchart of a resource reallocation method provided by the embodiments of the present application. After executing step 1052, steps 1055 - 1057 can also be continued:

[0157] Step 1055: In response to the updated available resources being less than the available resource threshold, compare the second resource occupancy with the necessary guarantee resource threshold corresponding to the second target cluster.

[0158] Step 1056: In response to the second resource occupancy being less than the necessary guarantee resource threshold corresponding to the second target cluster, compare the updated available resources with the resource application amount.

[0159] Step 1057: In response to the updated available resource quantity being greater than the resource application quantity, allocate the resource application quantity from the shared resource pool to the second target cluster.

[0160] In the embodiments of the present application, after resource recovery in the shared resource pool, if the actual resource occupancy of the second target cluster that applies for resources from the shared resource pool, that is, the second resource occupancy, is less than the maximum resource occupancy allowed for the second target cluster, it can be considered at this time that the resource quantity of the second target cluster is allowed to increase. At this time, it can be further determined whether the updated available resource quantity in the resource pool after resource recovery is greater than the available resource threshold. If it is less, it indicates that the available resources in the shared resource pool are still not sufficient after resource recovery. At this time, it can be further determined whether the actual resource quantity of the second target cluster is less than the necessary guarantee resource threshold corresponding to maintaining the service. If it is less, the actual resource quantity of the second target cluster is in short supply. At this time, if the resource application quantity of the second target cluster is less than the available resource quantity of the shared resource pool, the shared resource pool allocates the applied resource quantity to the second target cluster, so as to ensure the stable operation of the service in the second target cluster with resource shortage.

[0161] Please refer to Figure 11 , which is a schematic flowchart of a resource reallocation method provided by the embodiments of the present application. After executing step 1055, step 1058 can also be continued:

[0162] Step 1058: In response to the second resource occupancy being not less than the necessary guarantee resource threshold corresponding to the second target cluster, reject allocating resources from the shared resource pool to the second target cluster.

[0163] In the embodiments of the present application, after resource recovery in the shared resource pool, if the actual resource occupancy of the second target cluster that applies for resources from the shared resource pool, that is, the second resource occupancy, is less than the maximum resource occupancy allowed for the second target cluster, it can be considered at this time that the resource quantity of the second target cluster is allowed to increase. At this time, it can be further determined whether the updated available resource quantity in the resource pool after resource recovery is greater than the available resource threshold. If it is less, it indicates that the available resources in the shared resource pool are still not sufficient after resource recovery. At this time, it can be further determined whether the actual resource quantity of the second target cluster is less than the necessary guarantee resource threshold corresponding to maintaining the service. If it is not less, the actual resource quantity of the second target cluster can maintain the stable operation of the service. At this time, the shared resource pool rejects allocating resources to the second target cluster, so that in the case of insufficient resources in the shared resource pool, the limited resources can be allocated to the clusters that are more in urgent need of resources.

[0164] Please refer to Figure 12, based on the same inventive concept, embodiments of the present application provide a resource management device, which is disposed in a cluster system. The cluster system includes multiple clusters, and a shared resource pool is formed among the multiple clusters. The device includes: a first acquisition unit 201, a determination unit 202, a recycling unit 203, and a reallocation unit 204.

[0165] The first acquisition unit 201 is configured to acquire the available resource amount in the shared resource pool;

[0166] The determination unit 202 is configured to, in response to the available resource amount being less than the available resource threshold, determine the amount of resources to be recycled, and determine the first target cluster of the resources to be recycled from the multiple clusters;

[0167] The recycling unit 203 is configured to recycle the resources corresponding to the amount of resources to be recycled from the first target cluster to the shared resource pool;

[0168] The reallocation unit 204 is configured to, in response to a resource application request from a second target cluster, allocate resources from the shared resource pool to the second target cluster.

[0169] Optionally, the determination unit 202 includes: a unit for determining the amount of resources to be recycled;

[0170] The unit for determining the amount of resources to be recycled is specifically configured to:

[0171] In response to the available resource amount being less than the available resource threshold, calculate the difference between the available resource amount and the available resource threshold to obtain the benchmark amount of resources to be recycled;

[0172] Calculate the product of the benchmark amount of resources to be recycled and a preset recycling coefficient and perform a ceiling operation to obtain the amount of resources to be recycled, where the preset recycling coefficient is greater than 1.

[0173] Optionally, the determination unit 202 includes: a cluster determination unit;

[0174] The cluster determination unit is specifically configured to:

[0175] In response to the available resource amount being less than the available resource threshold, acquire the first resource occupancy of each cluster among the multiple clusters;

[0176] Calculate the difference between the first resource occupancy and the necessary guarantee resource threshold corresponding to each cluster to obtain the resource surplus;

[0177] Calculate the difference between the maximum resource occupancy and the minimum resource occupancy corresponding to each cluster to obtain the resource variability;

[0178] Take the clusters with the resource variability greater than 0 and the resource surplus greater than 0 as the first target clusters.

[0179] Optionally, there are at least two first target clusters, and the recycling unit 203 includes:

[0180] A sorting unit for sorting at least two first target clusters in descending order based on the remaining resources;

[0181] A resource recycling unit for recycling resources with an amount of the to-be-recycled resources in the first first target cluster to the shared resource pool if the remaining resources corresponding to the first first target cluster are not less than the to-be-recycled resources amount.

[0182] Optionally, the resource recycling unit is further configured to:

[0183] Calculate the difference between the to-be-recycled resources amount and the remaining resources corresponding to the first first target cluster to obtain the shortage amount of the to-be-recycled resources;

[0184] Recycle resources with the shortage amount of the to-be-recycled resources in the remaining first target clusters except the first first target cluster in the at least two first target clusters to the shared resource pool.

[0185] Optionally, the resource application request carries a resource application amount, and the reallocation unit 204 includes:

[0186] A second acquisition unit for acquiring the second resource occupancy of the second target cluster in response to a resource application request of the second target cluster;

[0187] A comparison unit for comparing the updated available resources amount with the available resources threshold in response to the second resource occupancy being less than the maximum resource occupancy corresponding to the second target cluster;

[0188] A resource reallocation unit for allocating the resource application amount from the shared resource pool to the second target cluster in response to the updated available resources amount being greater than the available resources threshold.

[0189] Optionally, the reallocation unit 204 is further configured to:

[0190] Reject allocating resources from the shared resource pool to the second target cluster in response to the second resource occupancy being not less than the maximum cluster resource occupancy corresponding to the second target cluster.

[0191] Optionally, the comparison unit is further configured to:

[0192] Compare the second resource occupancy with the necessary guarantee resources threshold corresponding to the second target cluster in response to the updated available resources amount being less than the available resources threshold;

[0193] Compare the updated available resources amount with the resource application amount in response to the second resource occupancy being less than the necessary guarantee resources threshold corresponding to the second target cluster;

[0194] The redistribution unit 204 is further configured to:

[0195] In response to the updated available resource amount being greater than the resource application amount, allocate the cluster resource application amount from the shared resource pool to the second target cluster.

[0196] Optionally, the redistribution unit 204 is further configured to:

[0197] In response to the second resource occupancy being not less than the necessary guarantee resource threshold corresponding to the second target cluster, reject allocating resources for the second target cluster from the shared resource pool.

[0198] Please refer to Figure 13 , based on the same inventive concept, an embodiment of the present application provides an electronic device, which includes at least one processor 301. The processor 301 is configured to execute a computer program stored in a memory to implement the steps of the resource management method provided in the embodiment of the present application as Figures 1 - 10 shown.

[0199] Optionally, the processor 301 may specifically be a central processing unit or a specific ASIC, and may be one or more integrated circuits for controlling program execution.

[0200] Optionally, the electronic device may further include a memory 302 coupled to at least one processor 301. The memory 302 may include a ROM, a RAM, and a disk memory. The memory 302 is used to store data required for the operation of the processor 301, that is, instructions that can be executed by at least one processor 301 are stored. At least one processor 301 executes the instructions stored in the memory 302 to execute the method as Figures 1 - 10 shown. Wherein, the number of the memories 302 is one or more.

[0201] Among them, the entity devices corresponding to the first acquisition unit 201, the determination unit 202, the recycling unit 203, and the redistribution unit 204 may all be the aforementioned processor 301. The electronic device may be used to execute the method provided in the embodiment as Figures 1 - 10 shown. Therefore, regarding the functions that can be realized by each functional module in the electronic device, reference may be made to the corresponding descriptions in the embodiment as Figures 1 - 10 shown, and details are not described herein again.

[0202] An embodiment of the present application further provides a computer storage medium. The computer storage medium stores computer instructions. When the computer instructions run on a computer, the computer is caused to execute the method as Figures 1 - 10 described.

[0203] The above are only the preferred embodiments of this specification and are not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification shall be included within the scope of protection of this specification.

Claims

1. A resource management method, characterized in that, Applied to a cluster system, the cluster system includes multiple clusters, and a shared resource pool is formed among the multiple clusters. The method includes: Obtain the available resource amount in the shared resource pool; In response to the available resource amount being less than the available resource threshold, determine the amount of resources to be recycled, and determine the first target cluster for the resources to be recycled from the multiple clusters; Recycle the resources corresponding to the amount of resources to be recycled from the first target cluster to the shared resource pool; In response to a resource application request from a second target cluster, allocate resources from the shared resource pool to the second target cluster.

2. The method according to claim 1, wherein In response to the available resource amount being less than the available resource threshold, determining the amount of resources to be recycled includes: In response to the available resource amount being less than the available resource threshold, calculate the difference between the available resource amount and the available resource threshold to obtain the baseline amount of resources to be recycled; Calculate the product of the baseline amount of resources to be recycled and a preset recycling coefficient and perform a ceiling operation to obtain the amount of resources to be recycled, where the preset recycling coefficient is greater than 1.

3. The method according to claim 1, characterized in that, In response to the available resource amount being less than the available resource threshold, determining the first target cluster for the resources to be recycled from the multiple clusters includes: In response to the available resource amount being less than the available resource threshold, obtain the first resource occupancy of each cluster in the multiple clusters; Calculate the difference between the first resource occupancy and the necessary guarantee resource threshold corresponding to each cluster to obtain the resource surplus; Calculate the difference between the maximum resource occupancy and the minimum resource occupancy corresponding to each cluster to obtain the resource variability; Use the clusters with the resource variability greater than 0 and the resource surplus greater than 0 as the first target clusters.

4. The method according to claim 3, wherein If there are at least two first target clusters, recycling the resources corresponding to the amount of resources to be recycled from the first target clusters to the shared resource pool includes: Sort the at least two first target clusters in descending order based on the resource surplus; If the resource surplus corresponding to the first first target cluster is not less than the amount of resources to be recycled, recycle the resources corresponding to the amount of resources to be recycled in the first first target cluster to the shared resource pool.

5. The method according to claim 4, characterized in that, The method further includes: If the resource surplus corresponding to the first first target cluster is less than the amount of resources to be recycled, recycle the resources corresponding to the resource surplus of the first first target cluster to the shared resource pool; Calculate the difference between the amount of resources to be recycled and the resource surplus corresponding to the first first target cluster to obtain the shortage amount of resources to be recycled; Recycle the resources corresponding to the shortage amount of resources to be recycled in the remaining first target clusters other than the first first target cluster among the at least two first target clusters to the shared resource pool.

6. The method according to claim 1, characterized in that The resource application request carries a resource application amount. In response to a resource application request from a second target cluster, allocating resources from the shared resource pool to the second target cluster includes: In response to the resource application request from the second target cluster, obtain the second resource occupancy of the second target cluster; In response to the second resource occupancy being less than the maximum resource occupancy corresponding to the second target cluster, compare the updated available resource amount with the available resource threshold; In response to the updated available resource amount being greater than the available resource threshold, allocate the resource application amount from the shared resource pool to the second target cluster.

7. The method according to claim 6, characterized in that After obtaining the second resource occupancy of the second target cluster, the method further includes: In response to the second resource occupancy being not less than the maximum cluster resource occupancy corresponding to the second target cluster, reject allocating resources from the shared resource pool to the second target cluster.

8. A resource management device, characterized in that, Provided in a cluster system, the cluster system includes multiple clusters, and each of the clusters shares part of its resources to a shared resource pool. The apparatus includes: An acquisition unit, configured to acquire the available resource amount in the shared resource pool; A determination unit, configured to, in response to the available resource amount being less than the available resource threshold, determine the amount of resources to be recycled, and determine a first target cluster of the resources to be recycled from the multiple clusters; A recycling unit, configured to recycle the resources corresponding to the amount of resources to be recycled from the first target cluster to the shared resource pool; A reallocation unit, configured to, in response to a resource application request of a second target cluster, allocate resources from the shared resource pool to the second target cluster.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; A memory coupled to the at least one processor; The at least one processor is configured to implement the steps of the method according to any one of claims 1-7 when executing a computer program stored in the memory.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program, when executed by a processor, implements the steps of the method according to any one of claims 1-7.