CN110275777B - Resource scheduling system - Google Patents

Resource scheduling system Download PDF

Info

Publication number
CN110275777B
CN110275777B CN201910496359.5A CN201910496359A CN110275777B CN 110275777 B CN110275777 B CN 110275777B CN 201910496359 A CN201910496359 A CN 201910496359A CN 110275777 B CN110275777 B CN 110275777B
Authority
CN
China
Prior art keywords
resource
slave
resources
additional
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910496359.5A
Other languages
Chinese (zh)
Other versions
CN110275777A (en
Inventor
李乐平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou 9skychina Information Technology Co ltd
Original Assignee
Guangzhou 9skychina Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou 9skychina Information Technology Co ltd filed Critical Guangzhou 9skychina Information Technology Co ltd
Priority to CN201910496359.5A priority Critical patent/CN110275777B/en
Publication of CN110275777A publication Critical patent/CN110275777A/en
Application granted granted Critical
Publication of CN110275777B publication Critical patent/CN110275777B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Abstract

The application relates to a resource scheduling system, which comprises a host and a slave; the host is used for determining idle resources of the slave, generating a resource allocation instruction according to the idle resources and sending the resource allocation instruction to the slave; the slave is used for receiving the resource allocation instruction and determining pre-allocated resources according to the resource allocation instruction; the pre-allocated resources are used for executing tasks in the slave machines; the slave machine is also used for acquiring actual consumed resources when executing tasks in the slave machine, and applying for releasing the residual resources to the host machine when the actual consumed resources are greater than the pre-allocated resources; the residual resource is a resource of which the pre-allocated resource exceeds the actual consumed resource; when the actual consumed resource is smaller than the pre-allocated resource, applying for an additional resource from the host; the additional resource is a resource of which the actual consumed resource exceeds the pre-allocated resource. The system can improve the resource utilization rate.

Description

Resource scheduling system
Technical Field
The present application relates to the field of resource allocation, and in particular, to a resource scheduling system.
Background
With the development of science and technology, distributed processing is an essential process of modern science and technology, for example, weather prediction needs to perform distributed processing on a large amount of weather data, the weather data is distributed in each computer of a distributed cluster, and each computer is enabled to process corresponding weather data at the same time, so that the weather data can be processed in time, and future air changes can be accurately and quickly determined.
At present, the management of the resources of the distributed computer system is generally performed by using open source software such as messs, and the allocation proportion of the resources is set according to a preset rule to implement the allocation of the resources. However, the method of setting the resource allocation proportion is not flexible, and once the resource allocation is performed according to the resource allocation proportion, it is difficult to change the resource allocation according to the actual operation requirement, which easily causes fragmentation of the resource, thereby resulting in low resource utilization rate.
Therefore, the existing resource scheduling method has the problem of low resource utilization rate.
Disclosure of Invention
In view of the above, it is necessary to provide a resource scheduling system capable of improving resource utilization rate.
A resource scheduling system, the system comprising: a master and a slave;
the host is used for determining idle resources of the slave, generating a resource allocation instruction according to the idle resources and sending the resource allocation instruction to the slave;
the slave is used for receiving the resource allocation instruction and determining pre-allocated resources according to the resource allocation instruction; the pre-allocated resources are used for executing tasks in the slave machines;
the slave machine is also used for acquiring actual consumed resources when executing tasks in the slave machine, and applying for releasing the residual resources to the host machine when the actual consumed resources are greater than the pre-allocated resources; the residual resource is a resource of which the pre-allocated resource exceeds the actual consumed resource; when the actual consumed resource is smaller than the pre-allocated resource, applying for an additional resource from the host; the additional resource is a resource of which the actual consumed resource exceeds the pre-allocated resource.
In one embodiment, the master is further configured to determine whether the slave machine has unallocated resources after receiving an additional resource application, and if the unallocated resources exist, send a first resource increasing instruction carrying additional resource information to the slave machine, so that the slave machine allocates additional resources from the unallocated resources to a task in the slave machine; the extra resource information is information describing the size of the extra resource.
In one embodiment, the slave is further configured to receive the first resource increasing instruction, extract the additional resource information from the first resource increasing instruction, and allocate the additional resource from the unallocated resource to a task in the slave according to the additional resource information; when the additional resources are less than the unallocated resources, allocating the additional resources from the unallocated resources to the task.
In one embodiment, the master is further configured to determine whether the slave machine has unallocated resources, and if the slave machine does not have unallocated resources, send a second resource increasing instruction carrying additional resource information to the slave machine, so that the slave machine allocates additional resources to the task from the remaining resources.
In one embodiment, the slave is further configured to determine that other tasks have remaining resources, extract additional resource information from the second resource addition instruction, and allocate the additional resources to the tasks from the remaining resources according to the additional resource information; and when the additional resource is smaller than the residual resource, allocating the additional resource to the task from the residual resource.
In one embodiment, the slave is further configured to, when the additional resource is greater than the remaining resource, continuously monitor a resource remaining condition of the other task, and if the remaining resource is less than the additional resource within a specified time, end the monitoring and fail to schedule the resource.
In one embodiment, the slave is further configured to monitor the task, and when the task issues an insufficient resource alarm and/or enters a retry state, the slave issues an additional resource application to the master.
In one embodiment, the master is further configured to receive the additional resource application, generate a slave resource check instruction, check the slave resource allocation condition, and send a first resource increase command according to the slave resource allocation condition.
In one embodiment, the slave is further configured to acquire a process/thread of the task, view ID information of the process/thread, and view actual consumed resources during running of the process/thread according to the ID information of the process/thread.
In one embodiment, the resource is at least one of a CPU and a memory.
In the resource scheduling system, the host sends the resource allocation instruction to the slave, the slave allocates the pre-allocated resources from the idle resources according to the resource allocation to execute the task, and provides the extra resource application or the residual resource release to the host according to the pre-allocated resources and the actual resources consumed during the task execution, so that the consumed resources during the task execution can change in real time according to the actual requirements, and the residual resources are reallocated in time, thereby realizing the reuse of resource fragments, improving the resource utilization rate and further solving the problem of low resource utilization rate of the existing resource scheduling method.
Drawings
FIG. 1 is a block diagram of a resource scheduling system of an embodiment;
FIG. 2 is a flow diagram of a resource scheduling system of an embodiment;
FIG. 3 is a flow diagram of another resource scheduling system of an embodiment;
fig. 4 is a block diagram illustrating a detailed structure of a resource scheduling system according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a resource scheduling system 100 provided by the present application may include a slave 110 and a master 120. There may be a plurality of slaves 110. Slave 110 may be used to perform a number of tasks. The slave 110 and the master 120 may be implemented with separate servers.
The master 120 is configured to determine idle resources of the slave 110, generate a resource allocation instruction according to the idle resources, and send the resource allocation instruction to the slave 110.
The free resources may be resources that are not used in the slave 110 and can be allocated for performing tasks. The resource may be specifically a CPU and a memory.
The resource allocation instruction is an instruction and a command for instructing the machine to allocate the resource.
In a specific implementation, the host 120 sends a resource query instruction to the slave 110, queries the idle resource of the slave 110, and after receiving the resource query instruction, the slave 110 returns the idle resource information to the host 120 and stores the idle resource information in a file system; the master aggregates and calculates the idle resources of all the slaves and sends a resource allocation instruction to the slave 110 according to the idle resources.
For example, a data collector may be first deployed on each slave 110 for collecting resource usage data of the slave 110, such as CPU size, CPU utilization, memory size, memory utilization, and the like. The host 120 sends a resource query instruction to the slave 110, the slave 110 receives the resource query instruction and sends resource usage data in the data collector to the host 120, the host 120 obtains idle resources of all the slaves 110 by aggregating the resource usage data, stores the idle resource information in a resource list, and sends a resource invitation carrying the idle resource information to a computing frame registered to the host 120. The computer frame refers to an external computer frame such as Hadoop, Spark, and tasks in the computer frame run in the slave 110. The computer framework sends a resource offer reply to the host 120. The resource offer reply includes the number of tasks that need to be run on the slave and the resources required for each task. The host 120 generates a Resource allocation command according to the idle Resource and the Resource offer reply and according to a DRF algorithm (Dominant Resource Fairness algorithm).
More specifically, the host 120 collects idle resources of 4 CPUs and 4GB RAMs of the slave 110, the host 120 invokes the allocation module to send a resource offer describing the current idle resources of the slave 110 to the computer frame 1, the computer frame 1 replies to the host 120, two tasks need to be run on the slave, the first task needs resources of 2 CPUs and 1GBRAM, the second task needs resources of 1CPU and 2GB RAM, and the host 120 replies according to the idle resources and the resource offer and generates a resource allocation instruction according to the DRF algorithm.
The slave 110 is configured to receive the resource allocation instruction, and determine a pre-allocated resource according to the resource allocation instruction.
The pre-allocated resources may be a part of resources determined in the idle resources by the slave 110 according to the resource allocation instruction issued by the master 120, and are allocated to a specific task.
In a specific implementation, an executor of a computer frame may be disposed on the slave 110 to execute tasks of each frame. The slave 110 is further configured to receive a specific resource allocation command of each task after receiving the resource allocation instruction, and the slave 110 allocates pre-allocated resources to the tasks of each frame according to the specific resource allocation command.
For example, slave 110 receives two allocation commands: 2CPU and 1GBRAM are allocated to task 1 of computer frame 1, and 1CPU and 2GB RAM are allocated to task 2 of computer frame 1. And storing the two commands into a command list, distributing the resources to a task 1 of the computer frame 1 and a task 2 of the computer frame 1 according to the sequence of the list, and starting to execute the tasks by the task executor after the tasks 1 and 2 receive the resources.
The slave 110 is further configured to obtain an actual consumed resource when executing a task of the slave 110, and apply for releasing the remaining resource to the host 120 when the actual consumed resource is greater than the pre-allocated resource; when the actual consumed resources are less than the pre-allocated resources, additional resources are applied to the host 120.
The actual consumed resource may be a resource actually occupied by the task when the task is executed.
Wherein the remaining resources may be resources that are pre-allocated resources beyond actually consumed resources.
Wherein the additional resource may be a resource that actually consumes a resource beyond the pre-allocated resource.
In a specific implementation, after a task executor in the slave 110 starts to execute a task, the slave 110 acquires a thread/process ID related to the task at regular intervals, and queries actual consumed resources of the task according to the thread/process ID; the slave 110 subtracts the actual consumed resources from the pre-allocated resources to obtain a resource difference value; when the resource difference is greater than zero, the slave 110 sends a resource release application carrying the resource difference information to the master 120 to request to release the remaining resources; when the resource difference is less than zero, the slave 110 sends an additional resource application carrying the resource difference information to the master 120, and applies for allocating additional resources.
For example, when the actual consumed resources of task 1 are 1CPU and 0.5GBRAM, and the pre-allocated resources are 2CPU and 1GBRAM, the resource difference is 1 and 0.5, and the slave 110 obtains the resource difference, sends a resource release application to the host 120, and releases 1CPU and 0.5GBRAM to idle resources; for another example, when the actual consumed resources of task 1 are 3CPU and 1.5GBRAM, and the pre-allocated resources are 2CPU and 1GBRAM, and the resource difference is minus 1 and minus 0.5, the slave 110 sends an additional resource application to the master 120 to request allocation of 1CPU and 0.5 GBRAM. For another example, when the actual consumed resources of task 1 are 3CPU and 0.5GBRAM, and the pre-allocated resources are 2CPU and 1GBRAM, and the resource difference is negative 1 and 0.5, the slave 110 sends a resource release request and an additional resource increase request to the master 120, and requests to increase 1CPU and release 0.5 GBRAM.
In the resource scheduling system, the host sends the resource allocation instruction to the slave, the slave allocates the pre-allocated resources from the idle resources according to the resource allocation to execute the task, and provides the extra resource application or the residual resource release to the host according to the pre-allocated resources and the actual resources consumed during the task execution, so that the consumed resources during the task execution can change in real time according to the actual requirements, and the residual resources are reallocated in time, thereby realizing the reuse of resource fragments, improving the resource utilization rate and further solving the problem of low resource utilization rate of the existing resource scheduling method.
In another embodiment, the master 120 is further configured to determine whether the slave 110 has unallocated resources after receiving the additional resource request, and if the unallocated resources exist, send a first resource increasing instruction carrying additional resource information to the slave 110, so as to enable the slave 110 to allocate the additional resources from the unallocated resources to a task in the slave.
The unallocated resource may be a resource that is not allocated by the slave to execute the task in the idle resource.
The extra resource information is information describing the type and size of the extra resource.
In a specific implementation, in the process of receiving the additional resource application by the master 120, after receiving the additional resource application sent by the slave 110, the master 120 extracts the type and size of the additional resource from the additional resource application, and packages and stores the type and size of the additional resource in the local area, more specifically, when the slave 110 has a plurality of slave nodes, the master 120 receives the resource application of the plurality of slave nodes, extracts the type and size of the additional resource from the resource application of the plurality of slave nodes, and then packages and stores the type and size of the additional resource in an additional resource information table of the server, where the left side of the additional resource information table is a slave node identifier and the right side of the additional resource information table is additional resource information corresponding to the slave node identifier. The slave node identification has a corresponding slave node.
The master 120 sends a resource check instruction to the slave 110 to check whether there is an unallocated resource in the slave 110.
When receiving the resource check instruction, the slave 110 checks whether the slave itself has unallocated resources, and sends the result to the master 120.
After determining that the slave 110 has the unallocated resource, the master 120 extracts the extra resource information from the extra resource information table, and generates a first resource increasing instruction according to the extra resource information, which indicates that the slave 110 allocates the extra resource to a task in the slave 110. For example, the master 120 determines that the slave identified by the slave node 2 has unallocated resources, extracts, from the extra resource information table, extra resource information corresponding to the slave node identified by 2, packages the information into JSON (JSON Object Notation) format, and transmits the JSON Object Notation) format together with the first resource addition instruction to the slave 110 identified by 2.
In the resource scheduling system, the host receives a resource application of the slave, and after determining that the slave has the residual resource, the first resource increasing instruction is sent to the slave, so that the slave can allocate additional resources to tasks in the slave from the residual resource according to the instruction; realizes the reutilization of the residual resources, thereby improving the resource utilization rate.
In another embodiment, the slave 110 is further configured to receive the first resource increasing instruction, extract the additional resource information from the first resource increasing instruction, and allocate the additional resource from the unallocated resource to the task of the slave 110 according to the additional resource information; and when the extra resource is smaller than the unallocated resource, allocating the extra resource to the task from the unallocated resource.
In a specific implementation, after receiving the first resource increase instruction, the slave 110 parses the instruction, and extracts additional resource information from the parsed instruction according to the keyword. For example, after receiving the first resource addition instruction, the slave 110 parses the instruction into JSON format, and extracts the size of the additional resource from the instruction according to the keywords of the additional resource information, such as "CPU" and "RAM". The slave 110 determines the size of the extra resource and the unallocated resource, and allocates the extra resource from the unallocated resource to the task in the slave when the extra resource is smaller than the unallocated resource. For example, the extra resource information at this time is: 0.5CPU, 1GBRAM, unallocated resources are: 1CPU and 2GBRAM, when the extra resource is less than the unallocated resource, allocating 0.5CPU and 1GBRAM from the allocated resource to the task of resource shortage in the slave; for another example, the additional resource information at this time is: 1.5CPU, 3GBRAM, unallocated resources are: 1CPU, 2GBRAM, and if the extra resource is greater than the unallocated resource, the slave 110 checks whether there is any other task releasing the remaining resource, and if so, compares the extra resource with the unallocated resource again.
In the resource scheduling system, the slave receives the first resource increasing instruction, and allocates the additional resource from the unallocated resource to the task with the insufficient resource in the slave according to the additional resource information, so that the task with the insufficient resource in the slave can obtain the additional resource to complete the execution of the task, and the resource utilization rate is improved.
In another embodiment, the master 120 is further configured to determine whether the slave 110 has unallocated resources, and if the slave 110 does not have unallocated resources, send a second resource increasing instruction carrying additional resource information to the slave 110, so that the slave 110 allocates additional resources to the task from the remaining resources.
In a specific implementation, the master 120 sends a resource query instruction to the slave 110, receives a resource reply message returned by the slave 110, and then reads the unallocated resource information from the resource reply message. When the slave 110 does not have unallocated resources, the master 120 extracts the extra resource information from the local, packages the extra resource information into a second resource increasing instruction, and then sends the second resource increasing instruction to the slave 110, so that the slave 110 allocates extra resources to tasks from the extra resources.
In the resource scheduling system, the master sends the resource query command to the slave, and after determining that the slave is not the allocated resource, sends the second resource increasing instruction to the slave, so that the slave allocates the additional resource from the remaining resource to the task with the resource shortage in the slave, and the task with the resource shortage in the slave can obtain the additional resource to complete the execution of the task, thereby improving the resource utilization rate.
In another embodiment, the slave 110 is further configured to determine that the other tasks have the remaining resources, extract the additional resource information from the second resource increasing instruction, and allocate the additional resources to the tasks from the remaining resources according to the additional resource information; and when the extra resource is smaller than the residual resource, allocating the extra resource to the task from the residual resource.
In a specific implementation, after receiving the second resource increase instruction, the slave 110 parses the instruction, and extracts additional resource information from the parsed instruction according to the keyword. Then, the slave 110 queries whether other tasks have the resource remaining condition, and if the other tasks have the resource remaining condition, the slave 110 makes a resource application to the master 120 to request to release the remaining resources, and when the released remaining resources are greater than the extra resources, the slave 110 allocates the extra resources to the resource-deficient tasks.
For example, when the slave has 6 tasks in total, the slave 110 receives the second resource increasing instruction, extracts the additional resource information from the second resource increasing instruction, and then sends a polling checking instruction, sequentially checks the resources consumed by the tasks in the slave 110 during execution, and divides the actual consumed resources of the tasks by the pre-allocated resources to obtain the resource utilization rate, and when the resource utilization rate is not more than 100% in a period of time, obtains the process/thread ID related to the task, and stores the ID information in the list. After the polling is finished, the slave 110 puts forward a resource release application to the host, sequentially extracts ID information from the list, and releases the residual resources of the corresponding process/thread after finding the corresponding process/thread according to the ID information; after the remaining resources of the task are released, the slave 110 compares the remaining resources with the extra resources, and when the remaining resources are greater than the extra resources, the slave 110 allocates the extra resources to the task with the resource shortage. More specifically, the slave 110 receives the second resource increasing instruction, and knows that task 6 applies for an additional resource to the master 120, and the applied additional resource is 0.5CPU and 1 GBRAM. The remaining resources of the slave 110 are 0CPU and 0.5 GBRAM. The slave 110 sequentially sends a checking instruction to other tasks except for the task 4, the checking result is that no resource remains in the tasks 1, 4 and 5, the task 2 has a resource remaining, and 0.2CPU and 0.2GBRAM remain, the task 3 has a resource remaining, and 0.3CPU and 0.4GBRAM remain, the slave 110 proposes a release resource application to the host 120, applies for releasing the remaining resource of the task 2 and the task 3, when the release of the remaining resource of the task 2 and the task 3 is completed, the remaining resource of the slave 110 is 0.5CPU and 1.1GBRAM, which is larger than the extra resource, and the slave 110 allocates the extra resource to the task 6 from the remaining resource.
For another example, when the slave machines have 6 tasks in total, the slave machine 110 receives the second resource increasing instruction, extracts the additional resource information from the second resource increasing instruction, sends a viewing instruction to view the actual resources consumed by the tasks of the slave machine 110 during execution, and immediately sends a resource release application to the host machine 120 to request for releasing the remaining resources once finding the tasks with the remaining resources; the slave 110 continuously monitors the remaining resources, and when the remaining resources are found to be larger than the extra resources, the slave 110 allocates the extra resources to the resource-hungry task. More specifically, the slave 110 receives the second resource increasing instruction, and knows that task 6 applies for an additional resource to the master 120, and the applied additional resource is 0.5CPU and 1 GBRAM. The remaining resources of the slave 110 are 0CPU and 0.5 GBRAM. The slave 110 sequentially sends a viewing instruction to other tasks except for the task 4, when the task 2 is found to have the resource surplus and 0.2CPU and 0.2GBRAM are left, the slave 110 releases the surplus resource of the task 2, and the surplus resource of the slave 110 is 0.2CPU and 0.7GBRAM and still smaller than the extra resource; the slave 110 continues to check the resource usage of the task 3, when the task 3 is found to have a resource surplus of 0.3CPU and 0.4GBRAM, the slave 110 releases the remaining resources of the task 3, and the remaining resources of the slave 110 are 0.5CPU and 1.1GBRAM, which are larger than the extra resources, and the slave 110 allocates the extra resources to the task 6 from the remaining resources.
In the resource scheduling system, the slave receives the second resource increasing instruction, determines whether the slave has the residual resource, and allocates the additional resource from the residual resource to the task with the resource shortage in the slave according to the additional resource and the residual resource, so that the task with the resource shortage in the slave can obtain the additional resource to complete the execution of the task, and the resource utilization rate is improved.
In another embodiment, the slave 110 is further configured to continuously monitor the resource remaining condition of other tasks when the extra resource is larger than the remaining resource, and if the remaining resource is smaller than the extra resource within the specified time, the monitoring is ended and the resource scheduling fails.
In a specific implementation, when the extra resources are greater than the remaining resources, the slave 110 sequentially sends a checking instruction to other tasks to check whether the remaining resources exist in the other tasks, and if the remaining resources exist in the other tasks, the remaining resources are released; the slave 110 compares the released remaining resources with the extra resources, when the released resources are still not enough to be allocated to the resource-deficient task, the slave 110 sends a checking instruction again to check whether the remaining resources exist in other tasks, and when the released remaining resources are still smaller than the extra resources within the specified time, the resource scheduling fails.
For example, when there are 4 tasks in the slave, task 4 applies for 0CPU and 1GBRAM to the master, and at this time, slave 110 has 0CPU and 0.1GBRAM as the released remaining resources, slave 110 sequentially sends a check instruction to other tasks, when task 1 has no remaining resources, it continues to check whether task 2 has remaining resources, when task 2 has a resource surplus and is rich in 1CPU and 0GBRAM, slave 110 applies for releasing 1CPU to the master, and when the slave 110 has 1CPU and 0.1GBRAM as the released remaining resources, and when task 3 has no resource surplus, slave 110 circularly checks the resource surplus condition of tasks 1, 2 and 3 until the released remaining resources of slave 110 are greater than the extra resources within a prescribed time, it allocates extra resources to the resource-strained task from the remaining resources, at this point the resource scheduling is successful.
In the resource scheduling system, the resource surplus condition of other tasks is continuously monitored, the surplus resources are released in time, and extra resources are distributed from the surplus resources to the task with insufficient resources in the slave machine, so that the task with insufficient resources in the slave machine can obtain the extra resources to complete the execution of the task, and the resource utilization rate is improved.
In another embodiment, the slave 110 is further configured to monitor the task, and when the task issues an out-of-resource alarm and/or enters a retry state, the slave 110 issues an additional resource request to the master 120.
In a specific implementation, the task types in the slave 110 may include: a to-be-run state, a running state, a completion state, and an abnormal state. The slave 110 continuously sends a status query instruction to the task to check the status of the task during execution. When the task returns the information of insufficient memory or CPU due to insufficient resources and the status changes to an abnormal status, the slave 110 instructs the task to enter a retry status according to the returned information and simultaneously issues an additional resource application to the master 120.
In the resource scheduling system, the state of the task is continuously monitored, and when the task sends out a resource shortage alarm and/or enters a retry state, an extra resource application is timely provided for the host, so that the subsequent host can allocate extra resources to the resource-deficient task according to the resource application to ensure the smooth execution of the task, and the resource utilization rate is improved.
In another embodiment, the master 120 is further configured to receive an additional resource application, generate a slave 110 resource check instruction, check a slave 110 resource allocation condition, and send a first resource increase command according to the slave 110 resource allocation condition.
In a specific implementation, the slave 110 is provided with a resource monitor. After receiving the additional resource application sent by the slave 110, the master 120 generates a slave resource viewing instruction and sends the slave resource viewing instruction to the slave 110. After receiving the resource checking instruction, the slave 110 extracts the CPU and the memory usage rate from the resource monitor, calculates the size and the type of the unallocated resource in the slave 110 according to the CPU size, the memory size, the CPU usage rate, and the memory usage rate of the slave 110, compares the size and the type of the unallocated resource with the size and the type of the additional resource, and if the unallocated resource type includes the additional resource type and the unallocated resource is greater than or equal to the additional resource, sends a first resource increasing instruction to the slave 110, which indicates that the slave 110 allocates the additional resource from the unallocated resource to a resource-deficient task, for example, when the unallocated resource is 1CPU and 1GBRAM and the additional resource is 1GBRAM, the unallocated resource type includes the additional resource type and the unallocated resource is equal to the additional resource, the master 120 sends the first resource increasing instruction to the slave 110.
In the resource scheduling system, by checking the resource allocation condition of the slave, when the unallocated resource type of the slave includes the additional resource type and the unallocated resource is greater than or equal to the additional resource, the master wants the slave to send the first resource increasing instruction, so that the subsequent slave can allocate the additional resource from the unallocated resource to a resource-deficient task according to the resource increasing instruction, thereby ensuring the smooth execution of the task and further improving the resource utilization rate.
In another embodiment, the slave 110 is further configured to obtain a process/thread of a task, view ID information of the process/thread, and view actual resources consumed during the process/thread operation according to the ID information of the process/thread.
In a specific implementation, the slave 110 obtains a thread/process ID related to a task, views actual consumed resources of each process/thread when the process/thread runs according to the ID information, and superimposes the actual consumed resources of each process/thread to obtain the actual consumed resources of the task.
For example, when a task in the slave 110 changes from the standby state to the operating state, the slave 110 stores the task as a target task in the task queue. The slave 110 sequentially extracts the target task from the task queue, queries the thread/process ID related to the target task, checks the actual consumed resources of each process/thread when the process/thread is running according to the process/thread ID, superimposes the actual consumed resources of each process/thread to obtain the actual consumed resources of the target task, and then stores the target task identifier and the actual consumed resources into the data table. When the task in the task queue changes from the running state to the completion state, the task is deleted from the task queue.
In the resource scheduling system, the target task is obtained by checking the state of the task, the thread/process ID related to the target task is checked, and the actual resource consumption is checked according to the thread/process ID when the target task is executed, so that the follow-up slave can selectively release the residual resource or apply for the extra resource according to the actual resource consumption and the pre-allocated resource of the target task, thereby avoiding fragmentation of the resource and further improving the resource utilization rate.
In another embodiment, the resource is at least one of a CPU and a memory.
In a specific implementation, the slave 110 sends a resource check instruction to each task, checks a thread/process ID related to the task, and checks a memory and a CPU, which actually consume resources, of each process/thread when the process/thread is running according to the process/thread ID; the slave 110 acquires pre-allocated memory and CPU of each task; if the actual consumed memory and CPU are smaller than the pre-allocated memory and CPU, the slave 110 sends a resource release application to the host 120 to request for releasing the rest memory and CPU; if the actual consumed memory and CPU are larger than the pre-allocated memory and CPU, applying for additional resources from the host computer 120; if the slave 110 has unallocated memory and CPU and the unallocated memory and CPU meet the allocated conditions, the master 120 sends a resource allocation instruction to the slave 110, which means that the slave 110 allocates external resources to a resource-deficient task from the unallocated memory and CPU; if there is no unallocated memory and CPU in the slave 110, the slave 110 allocates out-resources from the remaining memory and CPU of other tasks to the resource-hungry task.
In the resource scheduling system, the actually consumed memory and CPU and the pre-allocated memory and CPU of the task are obtained by checking the resource type and the resource utilization rate of the task, and the remaining resources are selectively released or extra resources are applied according to the actually consumed memory and CPU and the pre-allocated memory and CPU, so that resource fragmentation is avoided, and the resource utilization rate is improved.
To facilitate understanding by those skilled in the art, as shown in fig. 2, a flow chart of a resource scheduling system is provided; specifically, the slave 110 sends a resource check instruction to each task, checks whether the actual consumed resource is smaller than the pre-allocated resource when each task is executed, and sends a resource release application to the host 120 to request for releasing the remaining resource if the actual consumed resource is smaller than the pre-allocated resource; if the actual consumed resources are greater than the pre-allocated resources, applying for additional resources from the host 120; after receiving the request for additional resources sent by the slave 110, the master 120 sends a slave resource check instruction to the slave 110 to check the resource allocation of the slave 110, and if there is unallocated resource in the slave 110 and the unallocated resource is greater than the additional resource, the master 120 sends a first resource increasing command to the slave 110, which indicates that the slave 110 allocates additional resources from unallocated resources to a resource-starved task, if there is no unallocated resource in the slave 110, the master 120 sends a second resource increasing command to the slave 110, and after the slave 110 receives the second resource increasing command, checking whether other tasks of the slave 110 have residual resources, if the other tasks have residual resources, the slave 110 puts forward a resource release application to the master 120, releases the residual resources, and distributing the residual resources to the task with resource shortage, if other tasks have no residual resources, the resources of the slave computer are in shortage, and the resource application fails.
To facilitate understanding by those skilled in the art, as shown in FIG. 3, a flow diagram of another resource scheduling system is provided; specifically, the slave 110 sends a polling command to sequentially check the actual consumed resources and the pre-allocated resources of the task, if the pre-allocated resources are greater than the actual consumed resources, the slave 110 issues a resource release request to the master 120 to request release of the remaining resources, and if the pre-allocated resources are less than the actual consumed resources, the slave 110 issues an additional resource request to the master 120. After receiving the extra resource application, the master machine 120 checks whether the slave machine 110 has unallocated resources, and if the slave machine 110 has unallocated resources and the unallocated resources are greater than the extra resources, the slave machine 110 allocates the extra resources from the unallocated resources to a resource-deficient task; if the slave 110 has no unallocated resource or the unallocated resource is less than the extra resource, the slave 110 sequentially sends a resource query instruction to other tasks to query whether the other tasks have the remaining resource, if the other tasks have the remaining resource, whether the remaining resource is greater than the extra resource is checked, and if the remaining resource is greater than the resource, the extra resource is allocated to the resource-deficient task from the remaining resource; if the remaining resources are smaller than the extra resources, the slave 110 continuously monitors other tasks to release the remaining resources in time, and if the remaining resources are still smaller than the extra resources within a certain time, the resource scheduling fails.
To facilitate understanding by those skilled in the art, as shown in fig. 4, a block diagram of a resource scheduling system is provided; the resource scheduling system may schedule resources based on Mesos. The resource scheduling system comprises a host and a slave, wherein an executor and a resource scheduler of each computer frame are arranged in the slave, the resource scheduler is adapted to a bottom layer mainstream computing resource interface to realize the scheduling of tasks and computing resources and is used for dynamically scheduling the resources according to the actual resource consumption condition and the pre-allocation resource condition during the task operation; the executors are used to perform tasks for each computer frame. The resource scheduler firstly checks the actual resource consumption condition of the task running in the executor, and stores the actual resource consumption size and the resource utilization rate in a resource data table, and is also used for checking the size of the pre-allocated resource of the task and recording the pre-allocated resource size in the resource data table, wherein the left side of the resource data table is a task identifier, and the right side of the resource data table is the corresponding pre-allocated resource size, the corresponding resource utilization rate and the actual resource consumption size. The resource scheduler extracts the actual consumption size and the pre-allocated resource size in the task operation from the resource table, compares the actual consumption size with the pre-allocated resource size, and if the actual consumption resource size is equal to the pre-allocated resource size, the resource scheduler does not perform resource scheduling, and exits after the scheduling; if the actual consumed resource size is smaller than the pre-allocated resource size, indicating that the resources of the task are sufficient, scheduling the task, releasing the abundant resources, and exiting after the scheduling is finished; if the actual consumed resource size exceeds the pre-allocated resource size, the task is alarmed when the memory or CPU is insufficient, and the task applies for the resource while retrying; the host machine checks the use condition of the resources of the slave machine after receiving the resource application, if the slave machine has residual resources and the residual resources are more than the extra resources, the host machine sends a first resource increasing instruction to enable the resource scheduler to allocate the extra resources from the residual resources to the resource-deficient task, and the scheduling is finished; if the residual resources of the slave are less than the extra resources, checking whether other tasks have the condition of resource residual, if not, failing to apply for the resources, and finishing the scheduling; if other tasks have resources left, the remaining resources are released, and then the resource scheduler allocates the remaining resources to the resource-hungry task.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A system for scheduling resources, the system comprising: a master and a slave;
the host is used for determining idle resources of the slave, generating a resource allocation instruction according to the idle resources and sending the resource allocation instruction to the slave;
the slave is used for receiving the resource allocation instruction and determining pre-allocated resources according to the resource allocation instruction; the pre-allocated resources are used for executing tasks in the slave machines;
the slave machine is also used for acquiring actual consumed resources when executing tasks in the slave machine, and applying for releasing the residual resources to the host machine when the actual consumed resources are smaller than the pre-allocated resources; the residual resource is a resource of which the pre-allocated resource exceeds the actual consumed resource; when the actual consumed resource is larger than the pre-allocated resource, applying for an additional resource from the host; the additional resource is a resource of which the actual consumed resource exceeds the pre-allocated resource;
the host is further configured to extract the type and size of the additional resource from the additional resource application after receiving the additional resource application, and package and store the type and size of the additional resource as additional resource information in an additional resource information table, where the additional resource information is information describing the size of the additional resource;
the master is further configured to send a resource check instruction to the slave to determine whether the slave has unallocated resources, extract corresponding additional resource information from the additional resource information table if the unallocated resources exist, send a first resource increase instruction carrying the additional resource information to the slave, and instruct the slave to allocate additional resources to a task in the slave from the unallocated resources, where the unallocated resources are resources which are not allocated by the slave to execute the task in idle resources.
2. The system of claim 1, wherein the resource allocation instructions are instructions and commands directing the machine to allocate resources.
3. The system of claim 2, wherein the slave is further configured to receive the first resource adding instruction, extract the additional resource information from the first resource adding instruction, and allocate the additional resource from the unallocated resource to the task in the slave according to the additional resource information; when the additional resources are less than the unallocated resources, allocating the additional resources from the unallocated resources to the task.
4. The system according to claim 1, wherein the master is further configured to determine whether there are unallocated resources in the slave, and if there are no unallocated resources in the slave, send a second resource increase instruction carrying additional resource information to the slave, so as to enable the slave to allocate additional resources to the task from the remaining resources.
5. The system of claim 4, wherein the slave is further configured to determine that other tasks have remaining resources, extract additional resource information from the second resource addition instruction, and allocate the additional resources to the tasks from the remaining resources according to the additional resource information; and when the additional resource is smaller than the residual resource, allocating the additional resource to the task from the residual resource.
6. The system according to claim 5, wherein the slave is further configured to, when the additional resource is greater than the remaining resource, continuously monitor a resource remaining condition of the other task, and if the remaining resource is less than the additional resource within a specified time, end the monitoring and fail to schedule the resource.
7. The system of claim 1, wherein the slave is further configured to monitor the task, and when the task issues an out-of-resource alarm and/or enters a retry state, the slave issues an additional resource request to the master.
8. The system of claim 1, wherein the master is further configured to receive the additional resource application, generate a slave resource check instruction, check the slave resource allocation status, and send a first resource increase command according to the slave resource allocation status.
9. The system according to claim 1, wherein the slave is further configured to acquire a process/thread of the task, view ID information of the process/thread, and view actual consumed resources when the process/thread runs according to the ID information of the process/thread.
10. The system of claim 1, wherein the resource is at least one of a CPU and a memory.
CN201910496359.5A 2019-06-10 2019-06-10 Resource scheduling system Active CN110275777B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910496359.5A CN110275777B (en) 2019-06-10 2019-06-10 Resource scheduling system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910496359.5A CN110275777B (en) 2019-06-10 2019-06-10 Resource scheduling system

Publications (2)

Publication Number Publication Date
CN110275777A CN110275777A (en) 2019-09-24
CN110275777B true CN110275777B (en) 2021-10-29

Family

ID=67960598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910496359.5A Active CN110275777B (en) 2019-06-10 2019-06-10 Resource scheduling system

Country Status (1)

Country Link
CN (1) CN110275777B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113535514A (en) * 2021-07-02 2021-10-22 中科曙光国际信息产业有限公司 Job tracking method, device, computer equipment and storage medium
CN115269206B (en) * 2022-09-27 2023-01-10 湖南三湘银行股份有限公司 Data processing method and platform based on resource allocation

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102866918A (en) * 2012-07-26 2013-01-09 中国科学院信息工程研究所 Resource management system for distributed programming framework
CN106790332A (en) * 2015-11-24 2017-05-31 ***通信集团公司 A kind of resource regulating method, system and host node
CN107066332A (en) * 2017-01-25 2017-08-18 广东神马搜索科技有限公司 Distributed system and its dispatching method and dispatching device
CN107343023A (en) * 2017-05-25 2017-11-10 北京奇艺世纪科技有限公司 Resource allocation methods, device and electronic equipment in a kind of Mesos management cluster
CN108268318A (en) * 2016-12-30 2018-07-10 华为技术有限公司 A kind of method and apparatus of distributed system task distribution
CN108845884A (en) * 2018-06-15 2018-11-20 中国平安人寿保险股份有限公司 Physical source distributing method, apparatus, computer equipment and storage medium
KR20190061241A (en) * 2017-11-27 2019-06-05 주식회사 비디 Mesos process apparatus for unified management of resource and method for the same

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103365726B (en) * 2013-07-08 2016-05-25 华中科技大学 A kind of method for managing resource towards GPU cluster and system
CN105320559B (en) * 2014-07-30 2019-02-19 ***通信集团广东有限公司 A kind of dispatching method and device of cloud computing system
CN107590002A (en) * 2017-09-15 2018-01-16 东软集团股份有限公司 Method for allocating tasks, device, storage medium, equipment and distributed task scheduling system
CN108170530B (en) * 2017-12-26 2021-08-17 北京工业大学 Hadoop load balancing task scheduling method based on mixed element heuristic algorithm
CN109582447B (en) * 2018-10-15 2020-09-29 中盈优创资讯科技有限公司 Computing resource allocation method, task processing method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102866918A (en) * 2012-07-26 2013-01-09 中国科学院信息工程研究所 Resource management system for distributed programming framework
CN106790332A (en) * 2015-11-24 2017-05-31 ***通信集团公司 A kind of resource regulating method, system and host node
CN108268318A (en) * 2016-12-30 2018-07-10 华为技术有限公司 A kind of method and apparatus of distributed system task distribution
CN107066332A (en) * 2017-01-25 2017-08-18 广东神马搜索科技有限公司 Distributed system and its dispatching method and dispatching device
CN107343023A (en) * 2017-05-25 2017-11-10 北京奇艺世纪科技有限公司 Resource allocation methods, device and electronic equipment in a kind of Mesos management cluster
KR20190061241A (en) * 2017-11-27 2019-06-05 주식회사 비디 Mesos process apparatus for unified management of resource and method for the same
CN108845884A (en) * 2018-06-15 2018-11-20 中国平安人寿保险股份有限公司 Physical source distributing method, apparatus, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一种改进的DRF算法对BESIII集群资源管理的优化;霍菁等;《核电子学与探测技术》;20141015;第34卷(第10期);第1153-1158页 *
如何用curl来访问MESOS Scheduler HTTP API;高智芳;《www.uml.org.cn/yunjisuan/2016042810.asp?artid=17915》;20160428;第1-7页 *

Also Published As

Publication number Publication date
CN110275777A (en) 2019-09-24

Similar Documents

Publication Publication Date Title
CN108845884B (en) Physical resource allocation method, device, computer equipment and storage medium
CN107580023B (en) Stream processing job scheduling method and system for dynamically adjusting task allocation
CN110941481A (en) Resource scheduling method, device and system
CN103593242B (en) Resource sharing control system based on Yarn frameworks
EP3567829B1 (en) Resource management method and apparatus
CN106293893B (en) Job scheduling method and device and distributed system
CN107613025B (en) Message queue sequence reply-based implementation method and device
CN111625331B (en) Task scheduling method, device, platform, server and storage medium
CN110275777B (en) Resource scheduling system
WO2019134292A1 (en) Container allocation method and apparatus, server and medium
CN111258746B (en) Resource allocation method and service equipment
US10606650B2 (en) Methods and nodes for scheduling data processing
US20220283846A1 (en) Pod deployment method and apparatus
CN110659131A (en) Task processing method, electronic device, computer device, and storage medium
CN111580951A (en) Task allocation method and resource management platform
CN112948113A (en) Cluster resource management scheduling method, device, equipment and readable storage medium
CN109815087B (en) Task processing process monitoring method and device, computer equipment and storage medium
CN111506400A (en) Computing resource allocation system, method, device and computer equipment
CN111225007B (en) Database connection method, device and system
CN116263715A (en) Automatic scaling system and method for cloud native intelligent typesetting service
CN114500661A (en) Current limiting device, method and device and storage medium
CN114153604A (en) Container cluster control method and device
CN114172903A (en) Node capacity expansion method, device, equipment and medium of slarm scheduling system
CN112486502A (en) Distributed task deployment method and device, computer equipment and storage medium
CN116302456B (en) Meta universe computing resource scheduling system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 510000 room 803, No. 4, energy road, Tianhe District, Guangzhou, Guangdong Province (office only)

Patentee after: GUANGZHOU 9SKYCHINA INFORMATION TECHNOLOGY Co.,Ltd.

Address before: 510665 room 4016, No. 433, Yanling Road, Tianhe District, Guangzhou City, Guangdong Province

Patentee before: GUANGZHOU 9SKYCHINA INFORMATION TECHNOLOGY Co.,Ltd.