A Priority-Based Resource Allocation Method, Device, and Equipment

The method enables high-priority resource requests to preempt low-priority allocations in distributed systems, ensuring timely allocation and optimizing resource utilization.

CN113687941BActive Publication Date: 2025-07-15ALIBABA GROUP HOLDING LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110769141.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2016-06-13
Publication Date
2025-07-15
Estimated Expiration
2036-06-13

AI Technical Summary

Technical Problem

In a distributed system, when the cluster resources are exhausted as a whole, high-priority resource requests cannot obtain resources immediately, and they need to wait for the low-priority resource to be returned, resulting in the resource scheduler being unable to effectively utilize system resources.

Method used

By sequentially traversing allocated resource applications lower than the target resource application in the allocated resource queue, calculating available resources and assigning them to high-priority resource applications, ensuring that high-priority resource requests can seize resources occupied by low-priority resource applications.

Benefits of technology

Realize instant resource acquisition in the case of resource exhaustion by high-priority resource application, and maximize the efficiency of system resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113687941B_ABST
    Figure CN113687941B_ABST
Patent Text Reader

Abstract

The present application provides a resource allocation method based on priorities, including: accepting a resource application submitted by a job; judging whether the remaining resources of the system meet the resource application according to the resource requirement information of the resource application, if not, sequentially traversing the allocated resource applications whose job priorities are lower than that of the resource application; taking the sum of the system resources occupied by the traversed resource applications and the remaining resources of the system as the available resources; for each traversed allocated resource application, judging whether the available resources meet the resource application, and when the available resources meet the resource application, stopping the traversal and allocating the available resources to the resource application; if there is a second remaining resource after the available resources are allocated to the resource application, allocating the second remaining resource to the traversed resource applications, where the second remaining resource is the system resource remaining after the available resources are allocated to the resource application. The technical solution of the present application solves the problem that the resource application with a high job priority can preempt the resource application with a low job priority.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of a Chinese patent application with an application date of June 13, 2016, an application number of 201610410884.7, and an invention title of "A Priority-Based Resource Allocation Method, Apparatus, and Device". Technical Field

[0002] This application relates to the field of computer technologies, and particularly to a priority-based resource allocation method. Corresponding to the above method, this application also relates to a priority-based resource allocation apparatus and device. Background Art

[0003] In a distributed system, there are usually three roles: a resource scheduler, a job manager and its subordinate job nodes, and machine nodes. When a user needs to submit a job, the job manager will apply to the resource scheduler for a certain amount of machine resources, such as CPU, memory, etc., for the job nodes to use; after receiving the job resource application, the resource scheduler will calculate a list of available resources that can be allocated to the job manager based on the remaining available resources in the distributed system. For example: 1 core of CPU and 1 GB of memory are available on machine A, and 2 cores of CPU and 2 GB of memory are available on machine B; then, the resource scheduler will send the resource list to the job manager and the corresponding machine nodes.

[0004] In a distributed system, there will be thousands of job managers. Usually, the job priorities of the resource applications of these job managers are different: some job managers have higher job priorities for resource applications and require the resource scheduler to allocate resources to them first; some job managers have lower job priorities for resource applications, indicating that they can tolerate the resource scheduler allocating resources to other resource applications with higher job priorities first. In a distributed system, there often occurs a situation where the overall resources of the cluster are exhausted, resulting in a queue for resource applications. A common solution is to queue the requests according to the priorities, and then periodically take out the resource requests from the queue and resubmit them. As Figure 1 shown, in the waiting queue, resource requests with higher job priorities will be ranked in the front, and resource requests with lower priorities will be ranked in the back.

[0005] However, the above method cannot solve the following problems: when the resource scheduler receives a resource request with a very high priority in the case of overall exhaustion of cluster resources, this resource request needs to obtain resources immediately; however, all the resource applications that have been satisfied still need to execute for a quite long time. Therefore, even though the job priority of this resource application is very high, it has to wait until other resource applications with lower job priorities return resources before it can be allocated resources. In this situation, the resource scheduler needs to support resource applications with higher job priorities to be able to obtain the resources that resource applications with lower job priorities have already obtained. Summary of the Invention

[0006] This application provides a priority-based resource allocation method, which solves the problem that resource requests with high job priorities can preempt resource requests with low job priorities, and can effectively utilize system resources.

[0007] This application provides a priority-based resource allocation method, including:

[0008] Accepting a resource request submitted by a job, where the resource request includes resource requirement information and job priority information;

[0009] Judging whether the remaining system resources meet the resource request according to the resource requirement information of the resource request. When the remaining resources do not meet the resource request, sequentially traversing the allocated resource requests with job priorities lower than the resource request in the allocated resource request queue; the allocated resource requests are resource requests that have been fully or partially allocated resources.

[0010] All the traversed allocated resource requests form the traversed resource requests. Adding the sum of the system resources occupied by all the traversed resource requests and the remaining resources as the available resources.

[0011] For each traversed allocated resource request, judging whether the available resources meet the resource request. When the available resources meet the resource request, stop traversing and allocate the available resources to the resource request.

[0012] Optionally, in the process of judging whether the remaining system resources meet the resource request according to the resource requirement information of the resource request, if the remaining resources meet the resource request, allocating corresponding resources to the job according to the resource requirement information of the resource request; and recording the resource request as the allocated resource request in the allocated resource request queue.

[0013] Optionally, for each traversed allocated resource request, judging whether the available resources meet the resource request further includes: if the available resources cannot meet the resource request, continue traversing until the available resources meet the resource request.

[0014] Optionally, for each traversed allocated resource request, judging whether the available resources meet the resource request further includes: if after traversing all the allocated resource requests with low job priorities, the available resources still cannot meet the resource request, allocating partial resources to the resource request.

[0015] Optionally, when the available resources meet the resource request, stopping traversing and allocating the available resources to the resource request specifically includes:

[0016] If the available resources satisfy the resource application, stop traversing, allocate the available resources to the resource application; and allocate the second remaining resources after allocation to the traversed resource applications in descending order of job priority.

[0017] The second remaining resources are the system resources remaining after the available resources are allocated to the resource application.

[0018] Optionally, when the available resources satisfy the resource application, stop traversing, and specifically allocating the available resources to the resource application includes:

[0019] If the available resources satisfy the resource application, stop traversing, further determine whether the second remaining resources satisfy any traversed resource application. If so, allocate the available resources to the resource application, and allocate the second remaining resources to any traversed resource application.

[0020] Optionally, when the available resources satisfy the resource application, stop traversing, and specifically allocating the available resources to the resource application includes:

[0021] If the available resources satisfy the resource application, stop traversing, further determine whether the second remaining resources satisfy any traversed resource application. If so, allocate the remaining available resources except for the resources occupied by any traversed resource application to the resource application.

[0022] Optionally, specifically allocating part of the resources to the resource application includes:

[0023] Allocate the remaining resources to the resource application, and the unmet part of the resource application enters the queue of resource applications to be allocated, waiting for the next resource allocation.

[0024] Allocate the remaining part after allocating the available resources to the resource application to the traversed resource applications in descending order of the job priority.

[0025] Optionally, specifically allocating part of the resources to the resource application includes:

[0026] After traversing all the allocated resource applications with low job priorities, when the available resources still cannot satisfy the resource application, keep the system resources occupied by the allocated resource application unchanged, allocate the remaining resources to the resource application, and the unmet part of the resource application enters the queue of resource applications to be allocated, waiting for the next resource allocation.

[0027] Optionally, the resource application includes a resource application name, a resource application volume, a resource application quantity, and a job priority;

[0028] The resource application name is the identification name of the resource application;

[0029] The resource application volume is the minimum resource occupancy required for running the job corresponding to this resource application;

[0030] The resource application quantity is the quantity of the resource application volume applied for by this resource application;

[0031] The job priority is a priority level defined by the user and determined in quantity. The higher the priority level, the more important the corresponding job is, and the more the resource application should be preferentially satisfied; if the priority levels are the same, in the time series, the resource application submitted earlier is preferentially satisfied.

[0032] Optionally, the job priorities are aggregated into different priority intervals according to the set dimension; the sequentially traversing the allocated resource applications with job priorities lower than the job resource application in the allocated resource queue specifically includes:

[0033] Sequentially traversing all the allocated resource applications in the allocated resource queue whose priority intervals are lower than the priority interval of the resource application in ascending order of job priority.

[0034] Optionally, the sequentially traversing the allocated resource applications with job priorities lower than the job resource application in the allocated resource queue specifically includes:

[0035] Sequentially traversing all the allocated resource applications with job priorities lower than the resource application in ascending order of job priority in the allocated resource queue.

[0036] Optionally, the allocated resource queue is a set of allocated resource applications that are arranged in the order of the job priorities and have been fully or partially allocated resources.

[0037] Optionally, the allocated resource application includes the resource application name, the resource application volume, the allocated resource quantity, the allocated resources, and the job priority;

[0038] The allocated resource quantity is the quantity of the resource application volume that has been allocated to this resource application;

[0039] The allocated resources are the product of the resource application volume and the allocated resource quantity.

[0040] Optionally, the resource application queue to be allocated is a set of all resource applications to be allocated that are fully or partially unallocated resources arranged according to the job priority; the application includes the resource application name, the resource application volume, the resource application quantity, the quantity of resources to be allocated, and the job priority.

[0041] A priority-based resource allocation device includes: a resource application receiving unit and a resource preemption unit;

[0042] The resource application receiving unit is configured to receive the resource application submitted by the job, where the resource application includes resource requirement information and job priority information;

[0043] Judge whether the remaining resources of the system meet the resource application according to the resource requirement information of the resource application. If the remaining resources do not meet the resource application, enter the resource preemption unit.

[0044] Optionally, the priority-based resource allocation device further includes a resource allocation unit;

[0045] Judge whether the remaining resources of the system meet the resource application according to the resource requirement information of the resource application. When the remaining resources meet the resource application, enter the resource allocation unit;

[0046] The resource allocation unit is configured to allocate corresponding resources to the resource application according to the resource requirement information of the job; and record the resource application as an allocated resource application in the allocated resource application queue.

[0047] Optionally, the resource preemption unit includes a traversal subunit and a post-traversal processing subunit;

[0048] The traversal subunit is configured to traverse the allocated resource applications with job priorities lower than the resource application in the allocated resource queue in ascending order of the job priority; for each traversed allocated resource application, judge whether the available resources meet the resource application; if the available resources meet, stop traversing and allocate the available resources to the job; if the available resources do not meet, continue traversing until the available resources meet the resource application;

[0049] The post-traversal processing subunit is configured to process the situation where the available resources still do not meet the resource application after the traversal.

[0050] Optionally, in the traversal subunit, the step of if the available resources meet, stop traversing and allocate the available resources to the resource application specifically includes:

[0051] If the available resources are sufficient, stop traversing, allocate the available resources to the resource application; and allocate the remaining second resources after allocation to the traversed resource applications in descending order of job priority.

[0052] Optionally, in the traversing subunit, the step of "if the available resources are sufficient, stop traversing, and allocate the available resources to the resource application" specifically includes:

[0053] If the available resources are sufficient, stop traversing, further determine whether the remaining second resources can satisfy any of the traversed resource applications. If so, allocate the available resources to the resource application, and allocate the remaining second resources to the any traversed resource application.

[0054] Optionally, in the traversing subunit, the step of "if the available resources are sufficient, stop traversing, and allocate the available resources to the resource application" specifically includes:

[0055] If the available resources are sufficient, stop traversing, further determine whether the remaining second resources can satisfy any of the traversed resource applications. If so, allocate the remaining available resources except for the resources occupied by the any traversed resource application to the resource application.

[0056] Optionally, the post-traversing processing subunit includes:

[0057] After traversing all the allocated resource applications with low job priorities, when the available resources still cannot satisfy the resource application, allocate the available resources to the resource application, and the unmet part of the resource application enters the queue of resource applications waiting for allocation, waiting for the next resource allocation;

[0058] Allocate the remaining part after allocating the available resources to the resource application to the allocated traversed resource applications whose resources have been preempted in descending order of the job priority.

[0059] Optionally, the post-traversing processing subunit includes:

[0060] After traversing all the allocated resource applications with low job priorities, when the available resources still cannot satisfy the resource application, keep the system resources occupied by the allocated resource application unchanged, allocate the remaining resources to the resource application, and the unmet part of the resource application enters the queue of resource applications waiting for allocation, waiting for the next resource allocation.

[0061] Optionally, the resource application submitted by the resource application receiving unit includes: resource application name, resource application volume, resource application quantity, job priority.

[0062] An electronic device, characterized in that the electronic device includes:

[0063] A display;

[0064] A processor;

[0065] A memory for storing a priority-based resource allocation program, which, when read and executed by the processor, performs the following operations:

[0066] Accept a resource application for job submission, where the resource application includes resource requirement information and job priority information;

[0067] Judge whether the remaining system resources meet the resource application according to the resource requirement information of the resource application. If so, allocate corresponding resources to the job according to the resource requirement information of the resource application; and record the resource application as an allocated resource application in the allocated resource application queue;

[0068] If not, traverse the allocated resource applications with job priorities lower than the resource application in the allocated resource application queue in ascending order of the job priority;

[0069] All the traversed allocated resource applications form the traversed resource applications. The sum of the system resources occupied by all the traversed resource applications plus the remaining resources is used as the available resources. For each traversed allocated resource application, judge whether the available resources meet the resource application; if the available resources meet, stop traversing and allocate the available resources to the resource application; if the available resources do not meet, continue traversing until the available resources meet the resource application; or continue traversing until all the allocated resource applications with low job priorities are traversed and allocate resources to the resource application.

[0070] Compared with the prior art, the present application has the following advantages:

[0071] The present application provides a resource allocation method, apparatus, and device based on priorities. After receiving a resource application submitted by a job, the resource allocation method determines whether the remaining system resources meet the resource application according to the resource requirement information of the resource application. When the remaining system resources do not meet the resource application, it sequentially traverses the allocated resource applications in the allocated resource application queue whose job priorities are lower than that of the resource application; the sum of the system resources occupied by the traversed allocated resource applications plus the remaining resources is used as the available resources, and the available resources are allocated to the resource application with a high job priority. The technical solution provided by the present application solves the defect in the prior art that a resource application with a high job priority can only queue up and wait when the system resources are exhausted, enabling the resource application with a high job priority to obtain the resources required for operation to the greatest extent.

[0072] In addition, in a preferred example of the present application, the second remaining resources remaining after allocating the available resources to the resource application are allocated to the allocated resource applications whose resources are occupied in the order of decreasing job priority, so as to effectively utilize the system resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 Shows a schematic diagram of a resource application queue as a comparative technique;

[0074] Figure 2 Shows a flowchart of the resource allocation method based on priorities provided by an embodiment of the present application;

[0075] Figure 3 Shows a schematic diagram of an allocated resource application queue provided by an embodiment of the present application;

[0076] Figure 4 Shows a schematic diagram of the resource allocation apparatus based on priorities provided by an embodiment of the present application;

[0077] Figure 5 Shows a schematic diagram of the resource preemption unit provided by an embodiment of the present application;

[0078] Figure 6 Shows a schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0079] Many specific details are set forth in the following description in order to provide a thorough understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific implementations disclosed below.

[0080] Embodiments of the present application provide a priority-based resource allocation method and a priority-based resource allocation device; embodiments of the present application also provide an electronic device. The following embodiments will be described in detail one by one.

[0081] Before describing the specific steps of this embodiment in detail, a brief description will be given of the operating environment of the resource allocation involved in this technical solution.

[0082] In a distributed system, there are usually three roles: a resource scheduler, a job manager and its subordinate job nodes, and machine nodes. When a user needs to submit a job, the job manager will apply to the resource scheduler for a certain amount of machine resources, such as CPU, memory, etc., for the job nodes to use; after receiving the job resource application, the resource scheduler will calculate a list of available resources that can be allocated to the job manager based on the remaining available resources in the distributed system. For example, 1 core of CPU and 1 GB of memory are available on machine A, and 2 cores of CPU and 2 GB of memory are available on machine B; then, the resource scheduler will send the resource list to the job manager and the corresponding machine nodes. After receiving the resource list, the job manager will allocate the job nodes to the corresponding machine nodes to execute the job program. When the job nodes complete their execution, the job manager will inform the resource manager to return the resources of the job nodes, and after receiving the return application, the resource manager will notify the machine nodes to release the resources of the job nodes, and this released resources can be re-allocated to other jobs.

[0083] The job priorities of the resource applications of the job manager are different. When the system resources are sufficient, the resource scheduler will meet the resource requirements of each resource application, and record the resource applications that have been allocated resources as allocated resource applications in the allocated resource application queue in descending order of job priority; when the overall system resources are exhausted, if the resource scheduler receives a resource application with a high job priority, how to allocate resources for the resource application with a high job priority is what the technical solution provided by the present application needs to solve.

[0084] A priority-based resource allocation method provided by the present application, embodiments of the resource allocation method are as follows:

[0085] Figure 2 The flowchart of the priority-based resource allocation method provided by the embodiments of the present application is shown. The following will be described in conjunction with Figure 2 as follows.

[0086] Step S101, accept the resource application submitted by the job, where the resource application includes resource requirement information and job priority information.

[0087] As described above, when a user needs to submit a job, the resource application is submitted to the resource scheduler through the job manager; the resource application includes a resource application name, a resource application volume, a resource application quantity, and a job priority.

[0088] The resource application name is the identification name of the resource application; the resource application name is the same as the identification name of the job.

[0089] The resource application volume is the minimum resource occupancy required for running the job corresponding to the resource application; the minimum resource occupancy is the minimum requirement for a processor, memory, etc. when the job runs normally on a job node in a distributed system.

[0090] The resource application quantity is the quantity of the resource application volume applied for in the resource application; the resource application quantity can be understood as the number of working nodes required to run the job normally in a distributed system.

[0091] For example, running a user job requires 100 CPUs and 100G of memory. The user job has 100 job nodes to execute, and each job node execution requires 1 CPU and 1G of memory. Then 1 CPU and 1G of memory is the resource application volume, and 100 is the resource requirement quantity.

[0092] The resource application volume and the resource application quantity form the resource requirement information of the resource application, and the product of the resource application volume and the resource application quantity forms the total resource requirement of the resource application.

[0093] The job priority is defined by the user and is a determined number of priority levels. The higher the priority level, the more important the corresponding job is, and the more the resource application should be preferentially satisfied; if the priority levels are the same, then compare the time series, and the resource application submitted earlier has a higher priority.

[0094] Step S103, determine whether the remaining resources of the system meet the resource application according to the resource requirement information of the resource application. When the remaining resources do not meet the resource application, execute step S105.

[0095] The resource requirement information of the resource application includes the resource application volume and the resource application quantity; the resource scheduler compares the resource requirement with the remaining resources. If the remaining resources are less than the resource requirement, execute step S105.

[0096] Of course, when the resource scheduler compares the resource requirements with the remaining resources, there is another case, that is, the remaining resources are greater than or equal to the resource requirements. In this case, corresponding resources are allocated to the job according to the resource requirement information of the resource application, and the resource application is recorded as an allocated resource application in the allocated resource application queue.

[0097] The allocated resource queue is a set of allocated resource applications that are arranged in the order of the job priorities and have been fully or partially allocated resources; the allocated resource applications include the resource application name, the resource application volume, the allocated resource quantity, the allocated resources, and the job priority;

[0098] Among them, the resource application name, the resource application volume, and the job priority are consistent with the corresponding items of the resource application; the allocated resource quantity is the quantity of the resource application volume that has been allocated to the resource application; the allocated resources are the product of the resource application volume and the allocated resource quantity.

[0099] Figure 3 The figure shows the allocated resource application queue diagram provided by the embodiment of the present application.

[0100] As Figure 3 shown, the allocated resource queue includes 3 allocated resource applications, and the resource application names are: Resource Application A, Resource Application B, and Resource Application C respectively. Among them, other items of Resource Application A include:

[0101] Resource application volume: CPU: 1, Memory (MEM): 1

[0102] Allocated resource quantity: 20

[0103] Allocated resources: CPU: 20, Memory (MEM): 20

[0104] Job priority: 3

[0105] Step S105, sequentially traverse all the currently allocated resource applications in the allocated resource application queue whose job priorities are lower than that of the resource application; all the traversed allocated resource applications form the traversed resource applications, and the sum of the system resources occupied by all the traversed resource applications plus the remaining resources is used as the available resources.

[0106] The order of sequentially traversing all the currently allocated resource applications in the allocated resource application queue whose job priorities are lower than that of the resource application is in the order from the lowest to the highest job priority.

[0107] In a preferred embodiment of the present application, the job priorities are aggregated into different priority intervals according to a set dimension; each of the priority intervals includes a determined priority level, and moreover, the system resources occupied by the allocated resource application cannot be preempted by other resource applications in the same priority interval.

[0108] In a preferred embodiment of the present application, traversing all the currently allocated resource applications in the allocated resource application queue whose job priorities are lower than that of the resource application, considering the priority interval, becomes: traversing all the allocated resource applications in the allocated resource queue whose priority intervals are lower than that of the resource application in ascending order of job priority.

[0109] In a preferred embodiment of the present application, the job priorities are divided into 10 levels from low to high, namely job priority 1, job priority 2,..., job priority 10; the 10 levels are aggregated into 3 priority partitions in ascending order of priority: priority partition I, including job priorities 1, 2, 3, and 4; priority partition II, including job priorities 5, 6, and 7; priority partition III, including job priorities 8, 9, 10. If the job priority of the submitted resource application is 9, then the traversal considering the priority interval can only traverse priority partition I and priority partition II, and will not traverse the allocated resource application with job priority 8.

[0110] In a preferred embodiment of the present application, during the traversal process, the system resources occupied by the traversed allocated resource applications will not be reclaimed, but will only be reclaimed after the final resource allocation plan is determined. In some cases, the resource scheduler will, during the traversal process, simultaneously reclaim the system resources occupied by the traversed allocated resource applications.

[0111] Step S107, for each traversed allocated resource application, determine whether the available resources satisfy the resource application; when the available resources satisfy the resource application, stop traversing and allocate the available resources to the resource application.

[0112] For each traversed allocated resource application, the system will determine whether the available resources satisfy the resource application:

[0113] If the available resources satisfy the resource application, stop traversing and allocate the available resources to the resource application.

[0114] If the available resources do not satisfy the resource application, continue traversing until the available resources satisfy the resource application.

[0115] The operations of stopping traversal and allocating the available resources to the resource application may have two cases. If the available resources exactly meet the resource requirements of the resource application, the allocation ends; if there is a second remaining resource after the available resources are allocated to the resource application, that is, the system resources remaining after the available resources are allocated to the resource application, then continue to allocate the second remaining resource to the traversed resource applications.

[0116] In the preferred embodiment provided by the present application, the second remaining resources are allocated to the traversed resource applications in the order of decreasing job priority.

[0117] As an alternative solution, there are the following two solutions for processing the available resources:

[0118] Solution 1: Further determine whether the second remaining resource meets any of the traversed resource applications. If it meets, first reclaim the system resources occupied by the traversed resource application, then allocate the available resources to the resource application, and allocate the second remaining resource to any of the traversed resource applications;

[0119] Solution 2: Further determine whether the second remaining resource meets any of the traversed resource applications. If it meets, the system resources occupied by any of the traversed resource applications are retained, and the remaining available resources except for the resources occupied by any of the traversed resource applications are allocated to the resource application.

[0120] The difference between the above Solution 1 and the preferred embodiment is that in Solution 1, the system resources occupied by each traversed allocated resource application are reclaimed first, and then the available resources are allocated; in the preferred embodiment, the system resources occupied by each traversed allocated resource application are not reclaimed in advance, but all the system resources occupied by the traversed allocated resource applications are reclaimed after the allocation scheme is determined.

[0121] The above Solution 2 is to ensure the preferential execution of the traversed resource applications that have completely obtained the required resources.

[0122] If the available resources still cannot meet the resource application after traversing all the allocated resource applications with low job priorities, then allocate part of the resources to the resource application.

[0123] Allocating part of the resources to the resource application includes: allocating the remaining resources to the resource application, and the unmet part of the resource application enters the queue of resource applications to be allocated, waiting for the next resource allocation; the remaining part after the available resources are allocated to the resource application is allocated to the traversed resource applications in the order of decreasing job priority.

[0124] The to-be-allocated resource application queue is a set of to-be-allocated resource applications that are all or partially unallocated and are arranged according to the job priorities; the to-be-allocated resource applications include the resource application name, the resource application volume, the resource application quantity, the quantity of to-be-allocated resources, and the job priority.

[0125] The resource application name, the resource application volume, the resource application quantity, and the job priority are the same as those of the resource application.

[0126] The quantity of to-be-allocated resources is the quantity of the resource application volume required for the unfulfilled part of the resource application.

[0127] As an alternative, after traversing all the allocated resource applications with low job priorities and the available resources still cannot meet the resource application, the system resources occupied by the allocated resource applications can also remain unchanged, and the remaining resources are allocated to the resource application. The unfulfilled part of the resource application enters the to-be-allocated resource application queue and waits for the next resource allocation.

[0128] Next, combined with Figure 3 , a specific example is used to illustrate the entire process.

[0129] Suppose the total system resources are CPU: 100, Memory: 100. Since the resource application A occupies CPU: 20, Memory: 20, and the job priority is 3; the resource application B occupies CPU: 60, Memory: 40, and the job priority is 2; the resource application C occupies CPU: 20, Memory: 10, and the job priority is 1. Then the remaining resources of the system are CPU: 0, Memory: 30.

[0130] At this time, a resource application E comes in. Its resource application volume is CPU: 1, memory: 1, the application quantity is 30, and the priority is 4. Since the remaining resources cannot meet the resource application E, the next step is to traverse the allocated resource applications with job priorities lower than that of the resource application E in ascending order of job priority. First, the resource request C is traversed. After traversal, the new available resources are CPU: 20, memory: 40. The available resources are still not enough to meet the resource application E, so continue to traverse to the resource application B. Then the new available resources are CPU: 80, memory: 80. The available resources can meet the resource application E, so the available resources are allocated to the resource application E. After allocation, the remaining available resources, that is, the second remaining resources, are CPU: 50, memory: 50. The second remaining resources are reallocated to the traversed resource applications, that is, the resource application B and the resource application A, in descending order of job priority. First, check the resource application B. After dividing the second remaining resources by the resource application volume of the resource application B, 16 is obtained, that is, the system resources that can be allocated to the resource application B are: CPU: 48, memory: 32. The system resources remaining after the allocation of the second remaining resources, that is, the third remaining resources, become: CPU: 2, memory: 18. The unmet part of the resource application B, that is, CPU: 12, memory: 8, enters the pending resource application queue. Then check the resource application C. The third remaining resources can meet one resource application volume of the resource application C. After allocating the third remaining resources to one resource application volume of the resource application C, the remaining system resources become: CPU: 0, memory: 17, and no further allocation is possible. The unmet part of the resource application B, that is, CPU: 18, memory: 9, enters the pending resource application queue.

[0131] The final result is: The resource application E obtains system resources CPU: 30, memory: 30; the resource application B obtains system resources CPU: 48, memory: 32; the resource application C obtains: CPU: 2, memory: 1; the new remaining system resources are CPU: 0, memory: 17.

[0132] Finally, the resource scheduler will actually reclaim the resources occupied by the resource application B and the resource application C and allocate system resources according to the above new scheme.

[0133] The embodiments of the present application provide a priority-based resource allocation method. Correspondingly, the present application also provides a priority-based resource allocation device.

[0134] Figure 4 The figure shows a schematic diagram of the priority-based resource allocation device provided by the embodiments of the present application.

[0135] The priority-based resource allocation device includes: a resource application receiving unit 201 and a resource preemption unit 205.

[0136] The resource application receiving unit 201 is configured to receive the resource application submitted by a job, where the resource application includes resource requirement information and job priority information; determine whether the remaining system resources meet the resource application according to the resource requirement information of the resource application, and if the remaining resources do not meet the resource application, enter the resource preemption unit 205.

[0137] The resource preemption unit 205 is configured to traverse the allocated resource applications with job priorities lower than that of the resource application in the allocated resource application queue in ascending order of the job priorities, and reallocate system resources according to the traversal result.

[0138] As Figure 5 shown, the priority-based resource allocation device further includes a resource allocation unit 203.

[0139] In the resource application receiving unit 201, when determining whether the remaining system resources meet the resource application according to the resource requirement information of the resource application, if the remaining resources meet the resource application, enter the resource allocation unit 203.

[0140] The resource allocation unit 203 is configured to allocate corresponding resources to the resource application according to the resource requirement information of the job; and record the resource application as an allocated resource application in the allocated resource application queue.

[0141] Figure 5 FIG. shows a schematic diagram of the resource preemption unit provided by an embodiment of the present application.

[0142] As Figure 5 shown, the resource preemption unit 205 includes: a traversal subunit 301 and a post-traversal processing subunit 303.

[0143] The traversal subunit 301 is configured to traverse the allocated resource applications with job priorities lower than that of the resource application in the allocated resource queue in ascending order of the job priorities; for each traversed allocated resource application, determine whether the available resources meet the resource application; if the available resources meet, stop traversing and allocate the available resources to the job; if the available resources do not meet, continue traversing until the available resources meet the resource application.

[0144] The post-traversal processing subunit 303 is configured to handle the situation where the available resources still do not meet the resource application after the traversal.

[0145] Optionally, in the traversal subunit 301, if the available resources are sufficient, stop traversing and allocate the available resources to the resource application, which specifically includes:

[0146] If the available resources are sufficient, stop traversing, allocate the available resources to the resource application; and allocate the remaining second resources after allocation to the traversed resource applications in descending order of job priority.

[0147] Optionally, in the traversal subunit 301, if the available resources are sufficient, stop traversing and allocate the available resources to the resource application, which specifically includes:

[0148] If the available resources are sufficient, stop traversing, further determine whether the second remaining resources satisfy any of the traversed resource applications. If so, allocate the available resources to the resource application and allocate the second remaining resources to any of the traversed resource applications.

[0149] Optionally, in the traversal subunit 301, if the available resources are sufficient, stop traversing and allocate the available resources to the resource application, which specifically includes:

[0150] If the available resources are sufficient, stop traversing, further determine whether the second remaining resources satisfy any of the traversed resource applications. If so, allocate the remaining available resources except for the resources occupied by any of the traversed resource applications to the resource application.

[0151] Optionally, the post-traversal processing subunit 303 includes:

[0152] After traversing all the allocated resource applications with low job priorities, when the available resources still cannot satisfy the resource application, allocate the available resources to the resource application, and the unmet part of the resource application enters the queue of resource applications to be allocated, waiting for the next resource allocation.

[0153] The remaining part after allocating the available resources to the resource application is allocated to the allocated traversed resource applications whose resources have been preempted in descending order of the job priority.

[0154] Optionally, the post-traversal processing subunit 303 includes:

[0155] After traversing all the allocated resource requests with low job priorities, when the available resources still cannot meet the resource requests, keep the system resources occupied by the allocated resource requests unchanged, allocate the remaining resources to the resource requests, and the unmet part of the resource requests enters the queue of resource requests to be allocated, waiting for the next resource allocation.

[0156] In the above embodiments, a priority-based resource allocation method and a priority-based resource allocation device are provided. In addition, the present application also provides an electronic device; the embodiments of the electronic device are as follows:

[0157] Figure 6 The figure shows a schematic diagram of an electronic device provided by an embodiment of the present application.

[0158] The electronic device includes: a display 401; a processor 403; a memory 405;

[0159] The memory 405 is used to store a priority-based resource allocation program, and when the program is read and executed by the processor, it performs the following operations:

[0160] Accept a resource request submitted by a job, where the resource request includes resource requirement information and job priority information.

[0161] Judge whether the remaining system resources meet the resource request according to the resource requirement information of the resource request. If so, allocate corresponding resources to the job according to the resource requirement information of the resource request; and record the resource request as an allocated resource request in the allocated resource request queue.

[0162] If not, traverse the allocated resource requests with job priorities lower than the resource request in the allocated resource request queue in ascending order of the job priorities.

[0163] All the traversed allocated resource requests form the traversed resource requests. Add the sum of the system resources occupied by all the traversed resource requests and the remaining resources as the available resources; for each traversed allocated resource request, judge whether the available resources meet the resource request; if the available resources meet, stop traversing and allocate the available resources to the resource request; if the available resources do not meet, continue traversing until the available resources meet the resource request; or continue traversing until all the allocated resource requests with low job priorities are traversed and allocate resources to the resource request.

[0164] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and a memory.

[0165] The memory may include non - permanent memory in the form of computer - readable media, such as random access memory (RAM) and / or non - volatile memory, such as read - only memory (ROM) or flash RAM. The memory is an example of computer - readable media.

[0166] 1. Computer - readable media includes both permanent and non - permanent, removable and non - removable media that can store information by any method or technology. The information can be computer - readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase - change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read - only memory (ROM), electrically erasable programmable read - only memory (EEPROM), flash memory or other memory technologies, compact disc read - only memory (CD - ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non - transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, computer - readable media does not include transitory media, such as modulated data signals and carrier waves.

[0167] 2. Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer - usable storage media (including but not limited to disk memory, CD - ROM, optical memory, etc.) that contain computer - usable program code.

[0168] Although the present invention is disclosed above in preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention should be defined by the scope of the claims of the present invention.

Claims

1. A priority-based resource allocation method, characterized in that, Including: Receiving a resource application for job submission, where the resource application includes resource requirement information and job priority information; Judging whether the remaining system resources meet the resource application according to the resource requirement information of the resource application. If not, traverse all the allocated resource applications in the allocated resource application queue whose priority intervals are lower than that of the resource application in ascending order of job priority. The job priority is aggregated into different priority intervals according to the set dimension; the sum of the system resources occupied by all the traversed resource applications and the remaining system resources is used as the available resources; For each traversed allocated resource application, judge whether the available resources meet the resource application. When the available resources meet the resource application, stop traversing; if there is still a second remaining resource after the available resources are allocated to the resource application, judge whether the second remaining resource meets any of the traversed resource applications. If so, allocate the remaining available resources except the resources occupied by the any traversed resource application to the resource application.

2. The priority-based resource allocation method according to claim 1, wherein During the process of judging whether the remaining system resources meet the resource application according to the resource requirement information of the resource application, if so, allocate corresponding resources to the job according to the resource requirement information of the resource application; and record the resource application as the allocated resource application in the allocated resource application queue.

3. The priority-based resource allocation method according to claim 1, wherein For each traversed allocated resource application, judging whether the available resources meet the resource application includes: if not, continue traversing until the available resources meet the resource application.

4. The priority-based resource allocation method according to claim 1, wherein For each traversed allocated resource application, judging whether the available resources meet the resource application further includes: if the available resources still cannot meet the resource application after traversing all the allocated resource applications with low job priorities, allocate partial resources to the resource application.

5. The priority-based resource allocation method according to claim 1, characterized in that The allocating the remaining available resources except the resources occupied by the any traversed resource application to the resource application specifically includes: Allocating the available resources to the resource application and allocating the second remaining resource to the any traversed resource application.

6. The priority-based resource allocation method according to claim 4, wherein The allocating partial resources to the resource application specifically includes: Allocating the remaining resources to the resource application, and the unmet part of the resource application enters the resource application queue to be allocated, waiting for the next resource allocation; The remaining part after allocating the available resources to the resource application is allocated to the traversed resource applications in descending order of the job priority.

7. The priority-based resource allocation method according to claim 4, wherein The allocating partial resources to the resource application specifically includes: When the available resources still cannot meet the resource application after traversing all the allocated resource applications with low job priorities, keep the system resources occupied by the allocated resource application unchanged, allocate the remaining resources to the resource application, and the unmet part of the resource application enters the resource application queue to be allocated, waiting for the next resource allocation.

8. A priority-based resource allocation device, characterized in that, Including: A resource application receiving unit and a resource preemption unit; The resource application receiving unit is configured to receive the resource application submitted by the job, where the resource application includes resource requirement information and job priority information; Judge whether the remaining system resources meet the resource application according to the resource requirement information of the resource application. If not, enter the resource preemption unit; The resource preemption unit includes a traversal subunit. The traversal subunit is configured to traverse all the allocated resource applications in the allocated resource application queue whose priority intervals are lower than that of the resource application in ascending order of job priority. The job priority is aggregated into different priority intervals according to the set dimension, and the sum of the system resources occupied by all the traversed resource applications and the remaining system resources is used as the available resources; for each traversed allocated resource application, judge whether the available resources meet the resource application, and stop traversing when the available resources meet the resource application; if there is still a second remaining resource after the available resources are allocated to the resource application, judge whether the second remaining resource meets any of the traversed resource applications. If so, allocate the remaining available resources except the resources occupied by the any traversed resource application to the resource application.

9. An electronic device, characterized in that, The electronic device includes: A display; A processor; A memory for storing a priority-based resource allocation program, which, when read and executed by the processor, performs the following operations: Receive a resource application submitted by a job, where the resource application includes resource requirement information and job priority information; Judge whether the remaining system resources meet the resource application according to the resource requirement information of the resource application. If not, traverse all the allocated resource applications in the allocated resource application queue whose priority intervals are lower than that of the resource application in ascending order of job priority. The job priority is aggregated into different priority intervals according to the set dimension; and use the sum of the system resources occupied by all the traversed resource applications and the remaining system resources as the available resources; For each traversed allocated resource application, judge whether the available resources meet the resource application, and stop traversing when the available resources meet the resource application; if there is still a second remaining resource after the available resources are allocated to the resource application, judge whether the second remaining resource meets any of the traversed resource applications. If so, allocate the remaining available resources except the resources occupied by the any traversed resource application to the resource application.

Citation Information

Patent Citations

  • Task scheduling method, device and system

    CN103699445A