WO2016197716A1 - Task scheduling method and device - Google Patents

Task scheduling method and device Download PDF

Info

Publication number
WO2016197716A1
WO2016197716A1 PCT/CN2016/080057 CN2016080057W WO2016197716A1 WO 2016197716 A1 WO2016197716 A1 WO 2016197716A1 CN 2016080057 W CN2016080057 W CN 2016080057W WO 2016197716 A1 WO2016197716 A1 WO 2016197716A1
Authority
WO
WIPO (PCT)
Prior art keywords
job
queue
calculated
factor
priority
Prior art date
Application number
PCT/CN2016/080057
Other languages
French (fr)
Chinese (zh)
Inventor
郑鹏飞
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016197716A1 publication Critical patent/WO2016197716A1/en

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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence

Definitions

  • This document relates to, but is not limited to, the field of computer technology, and in particular, to a job scheduling method and apparatus.
  • MapReduce is a widely used distributed system processing framework for processing large-scale data.
  • the scheduler is a core component of MapReduce and has a critical impact on the performance of the entire system.
  • common schedulers are: fair scheduler, FIFO scheduler.
  • small jobs dominate the load. For example, in Facebook and Bing applications, jobs with less than 10 jobs accounted for 82% and 61% of the total number of jobs, respectively, while in Google, the average execution time for MapReduce jobs was 395 seconds, at Yahoo! In a production cluster, more than 80% of the job completion time is less than ten minutes.
  • the large increase in small jobs is because small jobs such as random queries are starting to run more and more in MapReduce clusters, where latency is a critical factor influencing the experience of small jobs.
  • the fair scheduler is currently the most widely used scheduler.
  • the core idea of the fair scheduler is to make all users and jobs as close as possible to the 'substantially equal' cluster resources. Since all users and jobs are emphasized to occupy resources fairly, The fair scheduler has a longer response time to interactive small jobs.
  • Many distributed systems use the FIFO scheduling scheduler by default, but the FIFO scheduler also has some problems, such as the operation is prone to "starvation", can not be applied to multi-user scenarios, etc., therefore, the scope of application is narrow.
  • a small job priority scheduling strategy is proposed.
  • the small job priority scheduling strategy is compared with the fair scheduling strategy.
  • the test results show that the average response time of the job using the small job priority scheduling strategy is shorter than the average response time of the job using the fair scheduling strategy, especially to a large extent. Shorten the response time of small jobs and have little impact on the response time of large jobs.
  • small job priority strategies may cause “hunger” in large jobs, such as having large jobs.
  • a large number of small jobs are continuously submitted to the MapReduce system. Due to the priority scheduling of short jobs, large jobs may not be scheduled for processing, resulting in "starvation.”
  • This paper provides a job scheduling method and device, which can shorten the response time of small jobs, prevent "starvation” in large jobs, and achieve the purpose of improving job scheduling efficiency.
  • An embodiment of the present invention provides a job scheduling method, where the method includes: when a free resource occurs, calculating the job queue according to a size factor of each job in the job queue and a waiting factor of each job in the job queue. a priority of each job, and sorting the jobs in the job queue according to the priority; scheduling the jobs in the job queue according to the order of the sorted job queues.
  • the priority of each job in the job queue is calculated according to the size factor of each job in the job queue and the waiting factor of each job in the job queue, and Sorting the jobs in the job queue according to the priority, including: when an idle resource occurs, calculating a size factor of each job in the job queue according to a task processing condition of each job in the job queue; Calculating a waiting factor of the job in the job queue in a time scheduled for each job in the job queue; calculating the job according to the calculated size factor of each job and the waiting factor of each job The priority of each job in the queue.
  • calculating a size factor of each job in the job queue according to a task processing condition of each job in the job queue including: when an idle resource occurs, determining the job queue separately Whether each job has been scheduled to be processed; if the job in the job queue has never been scheduled, the size factor of the job is calculated according to the input data amount of the job; if the job in the job queue Has been scheduled for processing, based on the job The size of the job is calculated by the time it takes to perform the remaining tasks.
  • calculating a size factor of the job according to a time required for the job to execute the remaining tasks including: calculating the job queue The current task progress of the middle job and the time used by the job in the job queue to reach the current progress; according to the calculated current task progress of the job and the time taken by the calculated job to reach the current progress, calculate the Calculating an execution rate of the job; calculating a remaining task quantity of the job according to the calculated current task progress of the job; calculating according to the calculated execution rate of the job and the remaining task quantity of the calculated job The time required for the job to execute the remaining tasks; and the size factor of the job is calculated according to the time required for the calculated job to execute the remaining tasks.
  • the priority of the job in the job queue is calculated according to the size factor of the job in the job queue and the waiting factor of the job in the job queue, and the job queue is The jobs are sorted according to the priority, including: when an idle resource occurs, each job in the job queue is calculated according to a size factor of each job in the job queue and a wait factor of each job in the job queue. a priority, and sorting the jobs in the job queue according to the priority; wherein the wait factor is positively related to the priority, and the size factor is negatively correlated with the priority.
  • An embodiment of the present invention provides a job scheduling apparatus, where the apparatus includes: a calculating unit, a sorting unit, and a processing unit; wherein the calculating unit is configured to, according to a size factor of each job in the job queue, when an idle resource occurs Calculating a priority of each job in the job queue with a wait factor of each job in the job queue; the sorting unit is configured to set the job in the job queue according to the priority calculated by the calculation unit The processing unit is configured to perform scheduling processing on the jobs in the job queue according to the order of the sorted job queues.
  • the calculating unit is configured to calculate a size factor of each job in the job queue according to a task processing condition of each job in the job queue when an idle resource occurs; according to each of the job queues Calculating the waiting factor of the job in the job queue before the job is scheduled; calculating each job in the job queue according to the calculated size factor of each job and the waiting factor of each job Priority.
  • the calculating unit is configured to determine, when an idle resource occurs, whether each job in the job queue has been scheduled for processing; if the job in the job queue has not been scheduled, Calculating a size factor of the job according to the input data of the job; if the job in the job queue has been scheduled, the size of the job is calculated according to a time required for the job to execute the remaining tasks factor.
  • the calculating unit is configured to calculate a current task progress of the job in the job queue and a time used to reach the current progress; according to the calculated current task progress of the job and the calculated Calculating the execution rate of the job when the job reaches the current progress; calculating the remaining task number of the job according to the calculated current task progress of the job; and calculating the execution rate of the job according to the calculated Calculating the remaining tasks of the job, calculating the time required for the job to execute the remaining tasks; and calculating the size factor of the job according to the time required for the calculated job to execute the remaining tasks.
  • the sorting unit is configured to calculate each of the job queues according to a size factor of each job in the job queue and a wait factor of each job in the job queue when an idle resource occurs a priority of the job, and sorting the jobs in the job queue according to the priority; wherein the wait factor is positively correlated with the priority; the size factor is negatively correlated with the priority.
  • the embodiment of the invention further provides a computer readable storage medium storing computer executable instructions, which are implemented when executed by a processor.
  • the embodiment of the invention provides a job scheduling method and device, which first calculates the priority of the job by the size factor and the waiting factor of the job, and then performs scheduling processing according to the priority of the job, so that the response time of the small job can be shortened. At the same time, it prevents "starvation" in large operations and achieves the technical effect of improving job scheduling efficiency.
  • FIG. 1 is a schematic flowchart of a job scheduling method according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a calculation of a job size factor according to an embodiment of the present invention
  • FIG. 3 is a schematic flowchart of a job scheduling method according to an embodiment of the present disclosure
  • FIG. 4 is a schematic flowchart of another job scheduling method according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a job scheduling apparatus according to an embodiment of the present invention.
  • a job scheduling method according to an embodiment of the present invention is shown, which may include:
  • the priority of the job is dynamically calculated. Whenever there is an idle resource, the priority of each job in the job queue needs to be recalculated. In the specific implementation process, the job queues can be sorted according to the order of priority from high to low.
  • step S101 may include:
  • the size factor of the job is calculated according to the input data amount of the job; wherein the input data amount of the job may specifically be the number of tasks of the job.
  • the size factor of the job is calculated according to the time required for the job to execute the remaining tasks.
  • the specific execution steps include:
  • S10111 Calculate the current task progress of the job in the job queue and the time used in the job queue to reach the current progress;
  • S10112 Calculate an execution rate of the job according to the calculated current task progress of the job and the calculated time used by the job to reach the current progress;
  • S10113 Calculate the remaining tasks of the job according to the calculated current task progress of the job
  • S10114 Calculate, according to the calculated execution rate of the job and the calculated remaining task amount of the job, a time required for the job to execute the remaining tasks;
  • S10115 Calculate the size factor of the job according to the calculated time required for the job to execute the remaining tasks.
  • S1012 Calculate a wait factor of the job in the job queue according to a time scheduled for each job in the job queue;
  • the waiting time refers to the time when the job was last allocated resources to the current time.
  • S1013 Calculate the priority of each job in the job queue according to the calculated size factor of each job and the waiting factor of each job.
  • S102 Perform scheduling processing on the jobs in the job queue according to the order of the job queues after sorting.
  • the data locality refers to the data that needs to be scheduled and processed on the node of the idle resource.
  • the data of the job needs to be transmitted to the node of the idle resource, which is time-consuming and resource-consuming. Therefore, if the job to be processed in the job queue does not satisfy the data locality, the next job is scheduled according to the order of the job queue; if the job queue under the current user name does not satisfy the data locality, then according to The order of the user queues is scheduled for the next user; if there is no job that satisfies the data locality in the job queue under all the user names in the user queue, the idle resources are directly allocated to the users who are to be executed the map task. The highest priority user, in turn, allocates idle resources to the first job in the job queue under the highest priority user name to be executed.
  • the current task progress of the job is calculated according to the number of tasks that have been completed in the job and the progress of the running task; wherein, the current task progress of the job can be calculated by using equation (1):
  • the job j is taken as an example for description
  • the parameter jobPS j represents the current task progress of the job j
  • the parameter c represents the number of tasks that have been completed in the job j
  • the parameters Indicates the progress of the task being run in job j
  • parameter R j represents the set of tasks running in job j
  • parameter r represents the number of tasks running in job j.
  • the job j is taken as an example for description
  • the parameter jobExT j represents the linear time used by the job j to reach the current progress
  • the parameter The sum of the time spent representing the currently completed task in job j
  • the parameter Represents the sum of the time taken by the running task in job j to complete the current progress
  • parameter C j is the set of tasks that job j has completed
  • parameter R j represents the set of tasks that are running in job j
  • parameter c is already in job j
  • the parameter time t is the time taken to complete the task t in the job j
  • the parameter r represents the number of tasks being run in the job j
  • the parameter curT is the current time
  • the parameter start t is the task t in the job j starts running. time.
  • Equation (2) The specific calculation method is: first subtract the time of the task from the current time of the task to get the time taken by the task to complete the current progress, and then accumulate the time taken by all the running tasks in the job j to complete the current progress, You can get the total time spent on the current progress of all running tasks in job j.
  • the execution rate of the job is calculated; wherein the execution rate of the job can be calculated by using the formula (3) :
  • jobExR j jobPS j /jobExT (3)
  • the job j is taken as an example.
  • the parameter jobExR j represents the execution rate of the job j
  • the parameter jobPS j represents the current task progress of the job j
  • the parameter jobExT j represents the time used by the job j to reach the current progress.
  • the remaining number of tasks of the job is calculated; wherein, the formula (4) can be used to calculate the remaining tasks of the job:
  • jobRS j N-jobPS j (4)
  • the job j is taken as an example.
  • the parameter jobRS j indicates the number of remaining tasks of the job j
  • the parameter jobPS j indicates the current task progress of the job j
  • the parameter N is the total number of tasks of the job j.
  • the time required for the job to execute the remaining tasks is calculated; wherein the job execution can be calculated by using the equation (5) Time required to complete the remaining tasks:
  • jobRT j jobRS j /jobExR j (5)
  • the job j is taken as an example for explanation.
  • the parameter jobRT j represents the remaining time required for the job j to complete all tasks
  • the parameter jobRS j represents the remaining task number of the job j
  • the parameter jobExR j represents the execution rate of the job j. .
  • the size factor of the job is calculated; wherein the size factor of the job can be calculated by using equation (6) or (7):
  • the job j is taken as an example.
  • the parameter jobSizeFactor j represents the size factor of the job j
  • the parameter jobRT j represents the time required for the job j to execute the remaining tasks
  • the parameter n represents the job queue in the current user name.
  • the parameter jobRTasksNum j represents the number of remaining tasks of job j
  • the parameter n represents the number of jobs in the job queue under the current user name.
  • the size factor of the job is calculated by equation (7) according to the number of tasks of the job;
  • the size factor of the job is calculated based on the time required to execute the remaining tasks.
  • the specific steps of calculating the size factor of the job are as shown in FIG. 2, including:
  • S202 Calculate, by formula (2), a time used by the job to reach a current progress
  • S203 calculating a current execution schedule of the job according to the current task schedule calculated by the formula (1) and a time calculated by the formula (2) to reach the current progress, and calculating an execution rate of the job by the formula (3);
  • S205 an execution rate of the job calculated according to the formula (3) and a remaining task amount of the job calculated by the formula (4), and calculating, by the formula (5), a time required for the job to execute the remaining tasks;
  • the present invention adds a wait factor to the calculation of job priorities to balance idle resources.
  • the allocation in order to shorten the response time of small operations, to avoid “starvation” in other operations.
  • the waiting time of the job is from the time when the job last obtained the idle resource to the current time. The larger the wait factor for a job, the longer the job waits for other jobs.
  • the waiting factor of the job can be calculated according to the waiting time of the job; wherein, the waiting time of the job can be calculated by using equation (8):
  • the job j is taken as an example.
  • the parameter jobWT j represents the waiting time of the job j
  • the parameter n represents the number of jobs in the job queue under the current user name.
  • the priority of the job can be calculated; where (9) can be used to calculate the priority of the job:
  • Priority j jobWaitFactor j +(1/jobSizeFactor j ) (9)
  • the job j is taken as an example.
  • the parameter jobWaitFactor j is the waiting factor of the job j obtained by the equation (8)
  • the parameter jobSizeFactor is the size factor of the job j obtained by the equation (6) or the equation (7).
  • the parameter priority j is the priority of the calculated job j.
  • the priority of the job is inversely proportional to the size factor of the job, and is proportional to the wait factor of the job.
  • the remaining time required for the job to complete all tasks and the waiting time of the job are converted into the priority of the job, taking into account the remaining time required for the job to complete all tasks and the waiting time of the job.
  • the priority of the small job is increased by the size factor of the job, so as to achieve the technical effect of shortening the response time of the small job; the priority of the large job is improved by the waiting factor of the job, so as to avoid the technical effect of avoiding "starvation” in the large operation.
  • This scheduling method can greatly shorten the response time of small jobs, prevent "starvation” in large jobs, improve the user experience, and achieve the technical effect of improving job scheduling efficiency.
  • the scheduling method of the present invention can not only shorten the homework response time of a small job, but also cause a big job "starvation" and improve the user experience.
  • S302 Select a first user in the user queue according to a sequence of user queues for scheduling processing
  • the specific process of calculating the priority includes:
  • the total number of tasks for the three jobs a, b, and c in the job queue is 10.
  • the waiting time for the a job, the b job, and the c job is 0 s.
  • S304 Sort the job queues under the current user name from high to low according to the priority, sort The result is: c, b, a;
  • S305 Determine, according to the order of the sorted job queues, that the jobs in the job queue under the current user name satisfy the data locality
  • S306 Perform scheduling processing on the first job c in the sorted job queue, that is, allocate idle resources to the c job in the job queue.
  • the technical solution of the present invention can preferentially schedule the small job, and considers the execution rate of the job, which not only shortens the response time of the small job to a large extent, but also improves the response time.
  • the efficiency of job scheduling has greatly improved the user experience of small jobs.
  • the scheduling process of the job is described in another embodiment.
  • the specific steps are as shown in FIG. 4, including:
  • S402 The first user in the user queue is selected for scheduling processing according to the sequence of the user queue, because the first user in the user queue has been scheduled to be processed.
  • S403 Calculate a priority of three jobs in the job queue under the current user name before the scheduling process
  • the specific process of calculating the priority includes:
  • S4034 Calculate the remaining tasks of three jobs a, b, and c in the job queue by equation (4) The quantity, wherein the total number of tasks of the first job, the second job, and the third job in the job queue are 100, 10, and 5, respectively, and the calculation results of a, b, and c are respectively: 50, 2, and 4;
  • S4035 Calculate the time required for the three tasks a, b, and c in the job queue to execute the remaining tasks by equation (5).
  • the calculation results of a, b, and c are: 90s, 5s, and 8s, respectively;
  • S404 Sort the job queues under the current user name from high to low according to the priority, and the sort result is: a, c, b.
  • S405 Determine, according to the order of the sorted job queues, that the jobs in the job queue under the current user name satisfy the data locality;
  • S406 Perform scheduling processing on the first job a in the job queue according to the order of the sorted job queues, that is, allocate idle resources to the a job in the job queue.
  • the technical solution of the present invention can use the waiting factor to influence the priority of the operation, so as to realize the processing of such operations as soon as possible, and to avoid the phenomenon of “starvation” to a large extent.
  • the apparatus 50 includes: a calculating unit 501, a sorting unit 502, and a processing unit 503;
  • the calculating unit 501 is configured to: when a free resource occurs, calculate a priority of each job in the job queue according to a size factor of each job in the job queue and a waiting factor of each job in the job queue;
  • the sorting unit 502 is configured to sort the jobs in the job queue according to the priorities calculated by the calculating unit 501;
  • the processing unit 503 is configured to perform scheduling processing on the jobs in the job queue according to the order of the sorted job queues.
  • the calculating unit 501 is configured to calculate, according to the task processing condition of each job in the job queue, a size factor of each job in the job queue when an idle resource occurs; according to the job queue Calculating a waiting factor of the job in the job queue at a time scheduled once before each job; calculating each of the job queues according to the calculated size factor of each job and the waiting factor of each job The priority of the job.
  • the calculating unit 501 is configured to determine, when an idle resource occurs, whether each job in the job queue has been scheduled to be processed; if the job in the job queue has not been scheduled, Calculating a size factor of the job according to the input data of the job; if the job in the job queue has been scheduled to be processed, calculating the job according to the time required for the job to execute the remaining tasks Size factor.
  • the calculating unit 501 is configured to calculate a current task progress of the job in the job queue and a time used to reach the current progress; and calculate the current task progress and the calculated according to the calculated job. Calculating the execution rate of the job when the job reaches the current progress; calculating the remaining task number of the job according to the calculated current task progress of the job; and calculating the execution rate of the job according to the calculated job And calculating, by the calculated number of remaining tasks of the job, a time required for the job to execute the remaining tasks; and calculating a size factor of the job according to the time required for the calculated job to execute the remaining tasks .
  • the sorting unit 502 is configured to calculate, when an idle resource occurs, each of the job queues according to a size factor of each job in the job queue and a wait factor of each job in the job queue.
  • the priority of the jobs, and the jobs in the job queue are sorted according to the priority; wherein the wait factor is positively related to the priority; the size factor is negatively correlated with the priority.
  • the instructions are related to hardware (eg, a processor) that can be stored in a computer readable storage medium, such as a read only memory, a magnetic disk, or an optical disk.
  • a computer readable storage medium such as a read only memory, a magnetic disk, or an optical disk.
  • all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits.
  • each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. Instructions to achieve their corresponding functions. This application is not limited to any specific combination of hardware and software.
  • a job scheduling method and apparatus provided by an embodiment of the present invention first calculates a priority of a job by a size factor and a wait factor of the job, and then performs scheduling processing according to the priority of the job, so that the response time of the small job can be shortened. At the same time, it prevents "starvation" in large operations and achieves the technical effect of improving job scheduling efficiency.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

A task scheduling method, comprising: when free resources appear, calculating a priority of each task within a task queue according to a size factor of each task within the task queue and a waiting factor of each task within the task queue, and sorting the tasks within the task queue according to the priorities (S101); performing scheduling processing on the tasks within the task queue according to the order of the task queue after sorting (S102).

Description

一种作业调度方法和装置Job scheduling method and device 技术领域Technical field
本文涉及但不限于计算机技术领域,尤其涉及的是一种作业调度方法和装置。This document relates to, but is not limited to, the field of computer technology, and in particular, to a job scheduling method and apparatus.
背景技术Background technique
MapReduce是目前使用十分广泛的一个分布式系统处理框架,用来处理大规模数据。调度器是MapReduce的一个核心组件,对于整个系统的性能有着非常关键的影响。目前,常见的调度器有:公平调度器、FIFO调度器。MapReduce is a widely used distributed system processing framework for processing large-scale data. The scheduler is a core component of MapReduce and has a critical impact on the performance of the entire system. Currently, common schedulers are: fair scheduler, FIFO scheduler.
根据目前的情况来看,小作业在负载中占据主导地位。比如,在Facebook和Bing的应用中,任务数量小于10的作业分别占到了作业总数的82%和61%,而在Google,MapReduce作业的平均执行时间为395秒,在Yahoo!的生产型集群中,有超过80%的作业完成时间小于十分钟。小作业的大量增加是因为例如随机查询这类小作业开始越来越多地在MapReduce集群中运行,其中,时延是影响小作业使用体验至关重要的因素。According to the current situation, small jobs dominate the load. For example, in Facebook and Bing applications, jobs with less than 10 jobs accounted for 82% and 61% of the total number of jobs, respectively, while in Google, the average execution time for MapReduce jobs was 395 seconds, at Yahoo! In a production cluster, more than 80% of the job completion time is less than ten minutes. The large increase in small jobs is because small jobs such as random queries are starting to run more and more in MapReduce clusters, where latency is a critical factor influencing the experience of small jobs.
公平调度器是目前使用最为广泛的调度器,公平调度器的核心思想是尽量使所有用户和作业都能够尽可能获得‘大致相等’的集群资源份额,由于强调所有用户和作业公平占有资源,所以公平调度器对交互式小作业的响应时间较长。很多分布式系统都默认采用FIFO调度调度器,但是FIFO调度器也存在一些问题,比如作业容易产生“饥饿现象”、不能适用于多用户场景等,因此,适用范围较窄。The fair scheduler is currently the most widely used scheduler. The core idea of the fair scheduler is to make all users and jobs as close as possible to the 'substantially equal' cluster resources. Since all users and jobs are emphasized to occupy resources fairly, The fair scheduler has a longer response time to interactive small jobs. Many distributed systems use the FIFO scheduling scheduler by default, but the FIFO scheduler also has some problems, such as the operation is prone to "starvation", can not be applied to multi-user scenarios, etc., therefore, the scope of application is narrow.
针对公平调度器对小作业的响应时间较长的问题,又提出了小作业优先调度策略。将小作业优先调度策略与公平调度策略进行对比测试,由测试结果可知:采用小作业优先调度策略的作业平均响应时间比使用公平调度策略的作业平均响应时间要短,特别是在较大程度上缩短了小作业的响应时间,并且对大作业的响应时间几乎没有什么影响。但是,还需要考虑在实际应用中,小作业优先策略可能会造成大作业产生“饥饿现象”,比如在有大作业 存在的情况下,不断有大量小作业被提交到MapReduce系统,由于优先调度短作业,可能会导致大作业一直不能被调度处理,从而出现“饥饿现象”。Aiming at the problem that the fair scheduler has a long response time to small jobs, a small job priority scheduling strategy is proposed. The small job priority scheduling strategy is compared with the fair scheduling strategy. The test results show that the average response time of the job using the small job priority scheduling strategy is shorter than the average response time of the job using the fair scheduling strategy, especially to a large extent. Shorten the response time of small jobs and have little impact on the response time of large jobs. However, it is also necessary to consider that in practical applications, small job priority strategies may cause “hunger” in large jobs, such as having large jobs. In the case of existence, a large number of small jobs are continuously submitted to the MapReduce system. Due to the priority scheduling of short jobs, large jobs may not be scheduled for processing, resulting in "starvation."
综上所述,在分布式系统的调度处理中,如何能在较大程度上缩短小作业的响应时间,同时防止大作业产生“饥饿现象”是目前待解决的问题In summary, in the scheduling process of distributed systems, how to shorten the response time of small jobs to a large extent, and prevent "starvation" in large jobs is the problem to be solved.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本文提供一种作业调度方法和装置,能够缩短小作业的响应时间,同时防止大作业产生“饥饿现象”,实现提高作业调度效率的目的。This paper provides a job scheduling method and device, which can shorten the response time of small jobs, prevent "starvation" in large jobs, and achieve the purpose of improving job scheduling efficiency.
本发明实施例提供一种作业调度方法,所述方法包括:当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序;按照所述排序后的作业队列的顺序,对所述作业队列中的作业进行调度处理。An embodiment of the present invention provides a job scheduling method, where the method includes: when a free resource occurs, calculating the job queue according to a size factor of each job in the job queue and a waiting factor of each job in the job queue. a priority of each job, and sorting the jobs in the job queue according to the priority; scheduling the jobs in the job queue according to the order of the sorted job queues.
在上述方案中,所述当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序,包括:当出现空闲资源时,按照作业队列中每个作业的任务处理情况计算所述作业队列中每个作业的大小因子;按照所述作业队列中每个作业前一次调度的时间计算所述作业队列中作业的等待因子;根据计算出的所述每个作业的大小因子和所述每个作业的等待因子,计算出所述作业队列中每个作业的优先级。In the above solution, when the idle resource occurs, the priority of each job in the job queue is calculated according to the size factor of each job in the job queue and the waiting factor of each job in the job queue, and Sorting the jobs in the job queue according to the priority, including: when an idle resource occurs, calculating a size factor of each job in the job queue according to a task processing condition of each job in the job queue; Calculating a waiting factor of the job in the job queue in a time scheduled for each job in the job queue; calculating the job according to the calculated size factor of each job and the waiting factor of each job The priority of each job in the queue.
在上述方案中,所述当出现空闲资源时,按照作业队列中每个作业的任务处理情况计算所述作业队列中每个作业的大小因子,包括:当出现空闲资源时,分别确定作业队列中每个作业是否已经被调度处理过;若所述作业队列中的作业从未被调度处理过,则根据所述作业的输入数据量计算所述作业的大小因子;若所述作业队列中的作业已经被调度处理过,则根据所述作业 执行完剩余任务所需的时间计算所述作业的大小因子。In the above solution, when an idle resource occurs, calculating a size factor of each job in the job queue according to a task processing condition of each job in the job queue, including: when an idle resource occurs, determining the job queue separately Whether each job has been scheduled to be processed; if the job in the job queue has never been scheduled, the size factor of the job is calculated according to the input data amount of the job; if the job in the job queue Has been scheduled for processing, based on the job The size of the job is calculated by the time it takes to perform the remaining tasks.
在上述方案中,所述若所述作业队列中的作业已经被调度处理过,则根据所述作业执行完剩余任务所需的时间计算出所述作业的大小因子,包括:计算所述作业队列中作业当前的任务进度和所述作业队列中作业达到当前进度所使用的时间;根据所述计算出的作业当前的任务进度和所述计算出的作业达到当前进度所使用的时间,计算出所述作业的执行率;根据所述计算出的作业当前的任务进度,计算所述作业的剩余任务数量;根据所述计算出的作业的执行率和所述计算出的作业的剩余任务数量,计算出所述作业执行完剩余任务所需的时间;根据所述计算出的作业执行完剩余任务所需的时间,计算出所述作业的大小因子。In the above solution, if the job in the job queue has been scheduled to be processed, calculating a size factor of the job according to a time required for the job to execute the remaining tasks, including: calculating the job queue The current task progress of the middle job and the time used by the job in the job queue to reach the current progress; according to the calculated current task progress of the job and the time taken by the calculated job to reach the current progress, calculate the Calculating an execution rate of the job; calculating a remaining task quantity of the job according to the calculated current task progress of the job; calculating according to the calculated execution rate of the job and the remaining task quantity of the calculated job The time required for the job to execute the remaining tasks; and the size factor of the job is calculated according to the time required for the calculated job to execute the remaining tasks.
在上述方案中,所述当出现空闲资源时,根据作业队列中作业的大小因子和所述作业队列中作业的等待因子计算出所述作业队列中作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序,包括:当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序;其中,所述等待因子与所述优先级正相关,所述大小因子与所述优先级负相关。In the above solution, when the idle resource occurs, the priority of the job in the job queue is calculated according to the size factor of the job in the job queue and the waiting factor of the job in the job queue, and the job queue is The jobs are sorted according to the priority, including: when an idle resource occurs, each job in the job queue is calculated according to a size factor of each job in the job queue and a wait factor of each job in the job queue. a priority, and sorting the jobs in the job queue according to the priority; wherein the wait factor is positively related to the priority, and the size factor is negatively correlated with the priority.
本发明实施例提供一种作业调度装置,所述装置包括:计算单元、排序单元和处理单元;其中,所述计算单元,设置为当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级;所述排序单元,设置为将所述作业队列中的作业按照计算单元计算出的所述优先级进行排序;所述处理单元,设置为按照所述排序后的作业队列的顺序,对所述作业队列中的作业进行调度处理。An embodiment of the present invention provides a job scheduling apparatus, where the apparatus includes: a calculating unit, a sorting unit, and a processing unit; wherein the calculating unit is configured to, according to a size factor of each job in the job queue, when an idle resource occurs Calculating a priority of each job in the job queue with a wait factor of each job in the job queue; the sorting unit is configured to set the job in the job queue according to the priority calculated by the calculation unit The processing unit is configured to perform scheduling processing on the jobs in the job queue according to the order of the sorted job queues.
在上述方案中,所述计算单元,是设置为当出现空闲资源时,按照作业队列中每个作业的任务处理情况计算所述作业队列中每个作业的大小因子;按照所述作业队列中每个作业前一次调度的时间计算所述作业队列中作业的等待因子;根据计算出的所述每个作业的大小因子和所述每个作业的等待因子,计算出所述作业队列中每个作业的优先级。 In the above solution, the calculating unit is configured to calculate a size factor of each job in the job queue according to a task processing condition of each job in the job queue when an idle resource occurs; according to each of the job queues Calculating the waiting factor of the job in the job queue before the job is scheduled; calculating each job in the job queue according to the calculated size factor of each job and the waiting factor of each job Priority.
在上述方案中,所述计算单元,是设置为当出现空闲资源时,分别确定作业队列中每个作业是否已经被调度处理过;若所述作业队列中的作业从未被调度处理过,则根据所述作业的输入数据计算出所述作业的大小因子;若所述作业队列中的作业已经被调度处理过,则根据所述作业执行完剩余任务所需的时间计算出所述作业的大小因子。In the above solution, the calculating unit is configured to determine, when an idle resource occurs, whether each job in the job queue has been scheduled for processing; if the job in the job queue has not been scheduled, Calculating a size factor of the job according to the input data of the job; if the job in the job queue has been scheduled, the size of the job is calculated according to a time required for the job to execute the remaining tasks factor.
在上述方案中,所述计算单元,是设置为计算所述作业队列中作业当前的任务进度和达到当前进度所使用的时间;根据所述计算出的作业当前的任务进度和所述计算出的作业达到当前进度所使用的时间,计算出所述作业的执行率;根据所述计算出的作业当前的任务进度,计算所述作业的剩余任务数量;根据所述计算出的作业的执行率和所述计算出的作业的剩余任务数量,计算出所述作业执行完剩余任务所需的时间;根据所述计算出的作业执行完剩余任务所需的时间,计算出所述作业的大小因子。In the above solution, the calculating unit is configured to calculate a current task progress of the job in the job queue and a time used to reach the current progress; according to the calculated current task progress of the job and the calculated Calculating the execution rate of the job when the job reaches the current progress; calculating the remaining task number of the job according to the calculated current task progress of the job; and calculating the execution rate of the job according to the calculated Calculating the remaining tasks of the job, calculating the time required for the job to execute the remaining tasks; and calculating the size factor of the job according to the time required for the calculated job to execute the remaining tasks.
在上述方案中,所述排序单元,是设置为当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序;其中,所述等待因子与所述优先级正相关;所述大小因子与所述优先级负相关。In the above solution, the sorting unit is configured to calculate each of the job queues according to a size factor of each job in the job queue and a wait factor of each job in the job queue when an idle resource occurs a priority of the job, and sorting the jobs in the job queue according to the priority; wherein the wait factor is positively correlated with the priority; the size factor is negatively correlated with the priority.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被处理器执行时实现上述方法。The embodiment of the invention further provides a computer readable storage medium storing computer executable instructions, which are implemented when executed by a processor.
本发明实施例提供了一种作业调度方法和装置,先由作业的大小因子和等待因子计算出作业的优先级,再根据作业的优先级进行调度处理,这样,能够缩短小作业的响应时间,同时防止大作业产生“饥饿现象”,实现提高作业调度效率的技术效果。The embodiment of the invention provides a job scheduling method and device, which first calculates the priority of the job by the size factor and the waiting factor of the job, and then performs scheduling processing according to the priority of the job, so that the response time of the small job can be shortened. At the same time, it prevents "starvation" in large operations and achieves the technical effect of improving job scheduling efficiency.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述 BRIEF abstract
图1为本发明实施例提供的一种作业调度方法的流程示意图;1 is a schematic flowchart of a job scheduling method according to an embodiment of the present invention;
图2为本发明实施例提供的一种计算作业大小因子的具体流程示意图;2 is a schematic flowchart of a calculation of a job size factor according to an embodiment of the present invention;
图3为本发明实施例提供的一种作业调度方法的具体流程示意图;FIG. 3 is a schematic flowchart of a job scheduling method according to an embodiment of the present disclosure;
图4为本发明实施例提供的另一种作业调度方法的具体流程示意图;4 is a schematic flowchart of another job scheduling method according to an embodiment of the present invention;
图5为本发明实施例提供的一种作业调度装置的结构示意图。FIG. 5 is a schematic structural diagram of a job scheduling apparatus according to an embodiment of the present invention.
本发明的实施方式Embodiments of the invention
下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, in the case of no conflict, the features in the embodiments and the embodiments in the present application may be arbitrarily combined with each other.
实施例一Embodiment 1
参见图1,其示出了本发明实施例提供的一种作业调度方法,该方法可以包括:Referring to FIG. 1 , a job scheduling method according to an embodiment of the present invention is shown, which may include:
S101:当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序;S101: When an idle resource occurs, calculate a priority of each job in the job queue according to a size factor of each job in the job queue and a waiting factor of each job in the job queue, and queue the job The jobs in the order are sorted according to the priority;
需要说明的是,作业的优先级是动态计算的,每当出现空闲资源时,都需要重新计算作业队列中每个作业的优先级。在具体实施过程中,可以根据优先级从高到低的顺序对作业队列进行排序。It should be noted that the priority of the job is dynamically calculated. Whenever there is an idle resource, the priority of each job in the job queue needs to be recalculated. In the specific implementation process, the job queues can be sorted according to the order of priority from high to low.
在具体实施过程中,当出现空闲资源时,将所有用户按照公平性排列成用户队列,并按照用户队列的顺序从队首开始,依次对用户名下的作业队列进行调度处理;每次在对用户名下作业队列进行调度处理之前,都需要根据当前用户名下作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子重新计算当前用户名下的作业队列中每个作业的优先级,并按照所述每个作业的优先级对当前用户名下作业队列中的作业进行排序;在对当前 用户名下的作业队列的调度处理完成后,再对用户队列中下一个用户名下的作业队列进行调度处理。In the specific implementation process, when idle resources appear, all users are arranged into user queues according to fairness, and the job queues under the user name are scheduled and processed in sequence according to the order of the user queues; Before scheduling the processing queue under the user name, it is necessary to recalculate each of the job queues under the current user name according to the size factor of each job in the job queue under the current user name and the waiting factor of each job in the job queue. The priority of the job, and sort the jobs in the job queue under the current user name according to the priority of each job; After the scheduling process of the job queue under the user name is completed, the job queue under the next user name in the user queue is scheduled.
步骤S101的实现过程可以包括:The implementation process of step S101 may include:
S1011:当出现空闲资源时,按照作业队列中每个作业的任务处理情况计算所述作业队列中每个作业的大小因子;S1011: When an idle resource occurs, calculating a size factor of each job in the job queue according to a task processing condition of each job in the job queue;
在具体实施过程中,需要先分别确定作业队列中的作业是否已经被调度处理过。In the specific implementation process, it is necessary to separately determine whether the job in the job queue has been scheduled and processed.
若该作业队列中的作业从未被调度处理过,则根据该作业的输入数据量计算该作业的大小因子;其中,作业的输入数据量,具体可以是作业的任务数量。If the job in the job queue has not been scheduled, the size factor of the job is calculated according to the input data amount of the job; wherein the input data amount of the job may specifically be the number of tasks of the job.
若该作业队列中的作业已经被调度处理过,则根据该作业执行完剩余任务所需的时间计算该作业的大小因子,具体执行步骤包括:If the job in the job queue has been scheduled, the size factor of the job is calculated according to the time required for the job to execute the remaining tasks. The specific execution steps include:
S10111:计算该作业队列中作业当前的任务进度和该作业队列中达到当前进度所使用的时间;S10111: Calculate the current task progress of the job in the job queue and the time used in the job queue to reach the current progress;
S10112:根据计算出的该作业当前的任务进度和计算出的该作业达到当前进度所使用的时间,计算出该作业的执行率;S10112: Calculate an execution rate of the job according to the calculated current task progress of the job and the calculated time used by the job to reach the current progress;
S10113:根据计算出的该作业当前的任务进度,计算该作业的剩余任务数量;S10113: Calculate the remaining tasks of the job according to the calculated current task progress of the job;
S10114:根据计算出的该作业的执行率和计算出的该作业的剩余任务量,计算出该作业执行完剩余任务所需的时间;S10114: Calculate, according to the calculated execution rate of the job and the calculated remaining task amount of the job, a time required for the job to execute the remaining tasks;
S10115:根据计算出的该作业执行完剩余任务所需的时间,计算出该作业的大小因子。S10115: Calculate the size factor of the job according to the calculated time required for the job to execute the remaining tasks.
需要说明的是,作业执行完剩余任务所需的时间与大小因子正相关。It should be noted that the time required for the job to perform the remaining tasks is positively related to the size factor.
S1012:按照该作业队列中每个作业前一次调度的时间计算该作业队列中作业的等待因子;S1012: Calculate a wait factor of the job in the job queue according to a time scheduled for each job in the job queue;
在具体实施过程中,等待时间是指该作业上一次被分配资源到当前的这段时间。 In the specific implementation process, the waiting time refers to the time when the job was last allocated resources to the current time.
需要说明的是,作业的等待时间越长与等待因子成正比。It should be noted that the longer the waiting time of the job is proportional to the waiting factor.
S1013:根据计算出的每个作业的大小因子和每个作业的等待因子,计算出该作业队列中每个作业的优先级。S1013: Calculate the priority of each job in the job queue according to the calculated size factor of each job and the waiting factor of each job.
S102:按照排序后所述作业队列的顺序,对所述作业队列中的作业进行调度处理。S102: Perform scheduling processing on the jobs in the job queue according to the order of the job queues after sorting.
在具体实施过程中,需要按照排序后作业队列的顺序,依次确定该作业队列中的作业是否满足数据本地性,并对第一个满足数据本地性的作业进行调度处理,也就是说,将空闲资源分配给第一个满足数据本地性的作业进行调度处理。In the specific implementation process, it is necessary to sequentially determine whether the job in the job queue satisfies the data locality according to the order of the sorted job queues, and perform scheduling processing on the first job satisfying data locality, that is, idle Resource allocation is scheduled for the first job that satisfies data locality.
需要说明的是,数据本地性是指需要调度处理的数据位于空闲资源的节点上,当作业不满足数据本地性时,需要将作业的数据传送到空闲资源的节点上,不仅费时而且占用资源。因此,若作业队列中待处理的作业不满足数据本地性,则按照作业队列的顺序,对下一个作业进行调度处理;若当前用户名下的作业队列中没有满足数据本地性的作业,则按照用户队列的顺序,对下一个用户进行调度处理;若该用户队列中所有用户名下的作业队列中都没有满足数据本地性的作业,则直接将空闲资源分配给有待执行map任务的用户中的最高优先级用户,进而将空闲资源分配给该最高优先级用户名下作业队列中第一个有待执行map任务的作业。It should be noted that the data locality refers to the data that needs to be scheduled and processed on the node of the idle resource. When the job does not satisfy the data locality, the data of the job needs to be transmitted to the node of the idle resource, which is time-consuming and resource-consuming. Therefore, if the job to be processed in the job queue does not satisfy the data locality, the next job is scheduled according to the order of the job queue; if the job queue under the current user name does not satisfy the data locality, then according to The order of the user queues is scheduled for the next user; if there is no job that satisfies the data locality in the job queue under all the user names in the user queue, the idle resources are directly allocated to the users who are to be executed the map task. The highest priority user, in turn, allocates idle resources to the first job in the job queue under the highest priority user name to be executed.
下面针对作业的大小因子进行进一步地说明:The following is a further description of the size factor of the job:
首先,根据作业中已经完成的任务数量和正在运行的任务的进度,计算作业当前的任务进度;其中,可以利用式(1)来计算作业当前的任务进度:First, the current task progress of the job is calculated according to the number of tasks that have been completed in the job and the progress of the running task; wherein, the current task progress of the job can be calculated by using equation (1):
Figure PCTCN2016080057-appb-000001
Figure PCTCN2016080057-appb-000001
在式(1)中,以作业j为例进行说明,参数jobPSj表示作业j当前的任务进度,参数c表示作业j中已经完成的任务数量,参数
Figure PCTCN2016080057-appb-000002
表示作业j中正在运行的任务的进度,参数Rj表示作业j中正在运行的任务的集合,参数r表示作业j中正在运行的任务数量。
In the formula (1), the job j is taken as an example for description, the parameter jobPS j represents the current task progress of the job j, and the parameter c represents the number of tasks that have been completed in the job j, and the parameters
Figure PCTCN2016080057-appb-000002
Indicates the progress of the task being run in job j, parameter R j represents the set of tasks running in job j, and parameter r represents the number of tasks running in job j.
接下来,根据作业中当前已完成的任务所花费的总时间和正在运行的任 务完成当前进度所花费的总时间,计算作业达到当前进度所使用的时间;其中,可以利用式(2)来计算作业达到当前进度所使用的时间:Next, based on the total time spent on the currently completed tasks in the job and the running tasks The total time spent completing the current progress, calculating the time taken for the job to reach the current progress; where equation (2) can be used to calculate the time taken by the job to reach the current progress:
Figure PCTCN2016080057-appb-000003
Figure PCTCN2016080057-appb-000003
在式(2)中,以作业j为例进行说明,参数jobExTj表示作业j达到当前进度所使用的线性时间,参数
Figure PCTCN2016080057-appb-000004
表示作业j中当前已完成的任务所花费的时间总和,参数
Figure PCTCN2016080057-appb-000005
表示作业j中正在运行的任务完成当前进度所花费的时间总和,参数Cj是作业j已完成任务的集合,参数Rj表示作业j中正在运行的任务的集合,参数c表示作业j中已经完成的任务数量,参数timet是完成作业j中的任务t所花费的时间,参数r表示作业j中正在运行任务数量,参数curT是当前时间,参数startt是作业j中任务t开始运行的时间。
In the formula (2), the job j is taken as an example for description, and the parameter jobExT j represents the linear time used by the job j to reach the current progress, and the parameter
Figure PCTCN2016080057-appb-000004
The sum of the time spent representing the currently completed task in job j, the parameter
Figure PCTCN2016080057-appb-000005
Represents the sum of the time taken by the running task in job j to complete the current progress, parameter C j is the set of tasks that job j has completed, parameter R j represents the set of tasks that are running in job j, and parameter c is already in job j The number of completed tasks, the parameter time t is the time taken to complete the task t in the job j, the parameter r represents the number of tasks being run in the job j, the parameter curT is the current time, and the parameter start t is the task t in the job j starts running. time.
需要说明的是,式(2)中参数
Figure PCTCN2016080057-appb-000006
的具体计算方法是:先将任务的当前时间减去任务的开始时间来得到该任务完成当前进度花费的时间,然后再将作业j中所有正在运行的任务完成当前进度花费的时间累加起来,就可以得到作业j中所有正在运行的任务完成当前进度花费的总时间。
It should be noted that the parameters in equation (2)
Figure PCTCN2016080057-appb-000006
The specific calculation method is: first subtract the time of the task from the current time of the task to get the time taken by the task to complete the current progress, and then accumulate the time taken by all the running tasks in the job j to complete the current progress, You can get the total time spent on the current progress of all running tasks in job j.
然后,根据式(1)得到的作业当前的任务进度和式(2)得到的作业达到当前进度所使用的时间,计算作业的执行率;其中,可以利用式(3)来计算作业的执行率:Then, according to the current task progress of the job obtained by the formula (1) and the time taken by the job obtained by the formula (2) to reach the current progress, the execution rate of the job is calculated; wherein the execution rate of the job can be calculated by using the formula (3) :
jobExRj=jobPSj/jobExT        (3)jobExR j =jobPS j /jobExT (3)
在式(3)中,以作业j为例进行说明,参数jobExRj表示作业j的执行率,参数jobPSj表示作业j当前的任务进度,参数jobExTj表示作业j达到当前进度所使用的时间。In the formula (3), the job j is taken as an example. The parameter jobExR j represents the execution rate of the job j, the parameter jobPS j represents the current task progress of the job j, and the parameter jobExT j represents the time used by the job j to reach the current progress.
接下来,根据作业的总任务数量和式(1)得到的作业当前的任务进度,计算作业的剩余任务数量;其中,可以利用式(4)来计算作业的剩余任务数量:Next, according to the total number of tasks of the job and the current task progress of the job obtained by the formula (1), the remaining number of tasks of the job is calculated; wherein, the formula (4) can be used to calculate the remaining tasks of the job:
jobRSj=N-jobPSj      (4)jobRS j =N-jobPS j (4)
式(4)中,以作业j为例进行说明,参数jobRSj表示作业j的剩余任务 数量,参数jobPSj表示作业j当前的任务进度,参数N是作业j的总任务数量。In the equation (4), the job j is taken as an example. The parameter jobRS j indicates the number of remaining tasks of the job j, the parameter jobPS j indicates the current task progress of the job j, and the parameter N is the total number of tasks of the job j.
进一步地,根据式(3)得到的作业的执行率和式(4)得到的作业的剩余任务数量,计算作业执行完剩余任务所需的时间;其中,可以利用式(5)来计算作业执行完剩余任务所需的时间:Further, according to the execution rate of the job obtained by the equation (3) and the remaining task number of the job obtained by the equation (4), the time required for the job to execute the remaining tasks is calculated; wherein the job execution can be calculated by using the equation (5) Time required to complete the remaining tasks:
jobRTj=jobRSj/jobExRj      (5)jobRT j =jobRS j /jobExR j (5)
在式(5)中,以作业j为例进行说明,参数jobRTj表示作业j完成所有任务所需的剩余时间,参数jobRSj表示作业j的剩余任务数量,参数jobExRj表示作业j的执行率。In the formula (5), the job j is taken as an example for explanation. The parameter jobRT j represents the remaining time required for the job j to complete all tasks, the parameter jobRS j represents the remaining task number of the job j, and the parameter jobExR j represents the execution rate of the job j. .
最后,根据式(5)得到的作业执行完剩余任务所需的时间或作业的任务数量,计算作业的大小因子;其中,可以利用式(6)或式(7)来计算作业的大小因子:Finally, according to the time required for the job obtained by the formula (5) to execute the remaining tasks or the number of tasks of the job, the size factor of the job is calculated; wherein the size factor of the job can be calculated by using equation (6) or (7):
Figure PCTCN2016080057-appb-000007
Figure PCTCN2016080057-appb-000007
Figure PCTCN2016080057-appb-000008
Figure PCTCN2016080057-appb-000008
在式(6)中,以作业j为例进行说明,参数jobSizeFactorj表示作业j的大小因子,参数jobRTj表示作业j执行完剩余任务所需的时间,参数n表示当前用户名下作业队列中的作业数量;在式(7)中,参数jobSizeFactorj表示作业j的大小因子,参数jobRTasksNumj表示作业j的剩余任务数量,参数n表示当前用户名下作业队列中的作业数量。In the formula (6), the job j is taken as an example. The parameter jobSizeFactor j represents the size factor of the job j, the parameter jobRT j represents the time required for the job j to execute the remaining tasks, and the parameter n represents the job queue in the current user name. The number of jobs; in equation (7), the parameter jobSizeFactor j represents the size factor of job j, the parameter jobRTasksNum j represents the number of remaining tasks of job j, and the parameter n represents the number of jobs in the job queue under the current user name.
在具体实施过程中,对于刚刚提交到系统且还没有被调度处理过的作业,由于还没有任务执行的历史信息,无法预测该作业的执行时间。因此,使用作业的输入数据大小,具体可以是作业的任务数量来确定作业的大小因子,如式(7)所示,但是这种情况只是在最开始会发生,当作业获得调度后的下一次资源分配时,就改用式(6)来计算该作业的大小因子。In the specific implementation process, for a job that has just been submitted to the system and has not been scheduled for processing, since the history information of the task execution is not yet available, the execution time of the job cannot be predicted. Therefore, using the input data size of the job, specifically the number of tasks of the job to determine the size factor of the job, as shown in equation (7), but this situation only occurs at the very beginning, the next time after the job is scheduled When the resource is allocated, the formula (6) is used instead to calculate the size factor of the job.
接下来,以一具体实施例对作业的大小因子的计算方法进行说明:Next, a calculation method of the size factor of the job will be described in a specific embodiment:
首先,确定作业是否已经被调度处理过;First, determine if the job has been scheduled for processing;
若作业从未被调度处理过,则根据作业的任务数量,由式(7)计算出该作业的大小因子; If the job has never been scheduled, the size factor of the job is calculated by equation (7) according to the number of tasks of the job;
若作业已经被调度处理过,则根据执行完剩余任务所需的时间计算该作业的大小因子。在作业已经被调度处理过的情况下,计算作业的大小因子的具体步骤如图2所示,包括:If the job has been scheduled for processing, the size factor of the job is calculated based on the time required to execute the remaining tasks. In the case that the job has been scheduled to be processed, the specific steps of calculating the size factor of the job are as shown in FIG. 2, including:
S201:由式(1)计算出该作业当前的任务进度;S201: Calculate the current task progress of the job by using equation (1);
S202:由式(2)计算出该作业达到当前进度所使用的时间;S202: Calculate, by formula (2), a time used by the job to reach a current progress;
S203:根据式(1)计算出的该作业的当前的任务进度和式(2)计算出的该作业达到当前进度所使用的时间,由式(3)计算出该作业的执行率;S203: calculating a current execution schedule of the job according to the current task schedule calculated by the formula (1) and a time calculated by the formula (2) to reach the current progress, and calculating an execution rate of the job by the formula (3);
S204:根据作业的总任务量,由式(4)计算出该作业的剩余任务数量;S204: Calculate the remaining number of tasks of the job according to the total task amount of the job, by using equation (4);
S205:根据式(3)计算出的该作业的执行率和式(4)计算出的该作业的剩余任务量,由式(5)计算出该作业执行完剩余任务所需的时间;S205: an execution rate of the job calculated according to the formula (3) and a remaining task amount of the job calculated by the formula (4), and calculating, by the formula (5), a time required for the job to execute the remaining tasks;
S206:根据式(5)计算出该作业执行完剩余任务所需的时间,由式(6)计算出该作业的大小因子。S206: Calculate the time required for the job to execute the remaining tasks according to the formula (5), and calculate the size factor of the job by the formula (6).
进一步地,为了防止个别作业垄断集群资源而使得其他作业等待获取资源的时间过长,即产生所谓的“饥饿现象”,本发明将等待因子也加入到作业优先级的计算中,以平衡空闲资源的分配,在缩短小作业的响应时长的前提下,避免其他作业产生“饥饿现象”。需要说明的是,作业的等待时间是从作业上次获得空闲资源到当前的这段时间。作业的等待因子越大,表示该作业相对于其他作业等待的时间越长。Further, in order to prevent individual jobs from monopolizing cluster resources and causing other jobs to wait for acquisition of resources for too long, that is, a so-called "starvation phenomenon" occurs, the present invention adds a wait factor to the calculation of job priorities to balance idle resources. The allocation, in order to shorten the response time of small operations, to avoid "starvation" in other operations. It should be noted that the waiting time of the job is from the time when the job last obtained the idle resource to the current time. The larger the wait factor for a job, the longer the job waits for other jobs.
针对等待因子,需要进一步说明的是,可以根据作业的等待时间计算出该作业的等待因子;其中,可以利用式(8)来计算作业的等待时长:For the waiting factor, it should be further explained that the waiting factor of the job can be calculated according to the waiting time of the job; wherein, the waiting time of the job can be calculated by using equation (8):
Figure PCTCN2016080057-appb-000009
Figure PCTCN2016080057-appb-000009
在式(8)中,以作业j为例进行说明,参数jobWTj表示作业j的等待时间,参数n表示当前用户名下作业队列中的作业数量。In the equation (8), the job j is taken as an example. The parameter jobWT j represents the waiting time of the job j, and the parameter n represents the number of jobs in the job queue under the current user name.
最终,根据作业的大小因子和等待因子,就可以计算出作业的优先级;其中,可以利用式(9)来计算作业的优先级:Finally, based on the size factor and wait factor of the job, the priority of the job can be calculated; where (9) can be used to calculate the priority of the job:
priorityj=jobWaitFactorj+(1/jobSizeFactorj)      (9)Priority j =jobWaitFactor j +(1/jobSizeFactor j ) (9)
在式(9)中,以作业j为例进行说明,参数jobWaitFactorj为式(8)得到 的作业j的等待因子,参数jobSizeFactor为式(6)或式(7)得到的作业j的大小因子,参数priorityj为计算得到的作业j的优先级。In the formula (9), the job j is taken as an example. The parameter jobWaitFactor j is the waiting factor of the job j obtained by the equation (8), and the parameter jobSizeFactor is the size factor of the job j obtained by the equation (6) or the equation (7). The parameter priority j is the priority of the calculated job j.
由式(9)可以看出,作业的优先级与作业的大小因子成反比,同时,与作业的等待因子成正比。作业执行完所有任务所需的剩余时间越短,等待的时间越长,该作业对应的优先级就越高;反之,作业执行完所有任务所需的剩余时间越长,等待的时间越短,该作业对应优先级就越低。As can be seen from equation (9), the priority of the job is inversely proportional to the size factor of the job, and is proportional to the wait factor of the job. The shorter the remaining time required for the job to complete all tasks, the longer the waiting time, the higher the priority of the job; on the contrary, the longer the remaining time required for the job to complete all tasks, the shorter the waiting time. The lower the priority of the job.
这样,在作业调度时,将作业执行完所有任务所需的剩余时间和作业的等待时间转化成作业的优先级,综合考虑了作业执行完所有任务所需的剩余时间和作业的等待时间这两个重要因素,同时,由于作业执行完所有任务所需的剩余执行时间和作业的等待时间是动态变化的,所以作业的优先级也是动态变化的。空闲资源能够根据作业的优先级进行分配,优先级高的作业会优先获取空闲资源。这样,通过作业的大小因子提高小作业的优先级,以实现缩短小作业响应时间的技术效果;通过作业的等待因子提高大作业的优先级,以实现避免大作业产生“饥饿现象”的技术效果。这种调度方法可以在很大程度上缩短小作业的响应时间,同时防止大作业产生“饥饿现象”,提高了用户体验,实现提高作业调度效率的技术效果。In this way, during job scheduling, the remaining time required for the job to complete all tasks and the waiting time of the job are converted into the priority of the job, taking into account the remaining time required for the job to complete all tasks and the waiting time of the job. An important factor, at the same time, because the remaining execution time and job waiting time required for the job to perform all tasks are dynamically changed, the priority of the job is also dynamically changed. Idle resources can be allocated according to the priority of the job, and jobs with higher priority will get the idle resources first. In this way, the priority of the small job is increased by the size factor of the job, so as to achieve the technical effect of shortening the response time of the small job; the priority of the large job is improved by the waiting factor of the job, so as to avoid the technical effect of avoiding "starvation" in the large operation. . This scheduling method can greatly shorten the response time of small jobs, prevent "starvation" in large jobs, improve the user experience, and achieve the technical effect of improving job scheduling efficiency.
比如,在某社交网站上,用户每天都有大量的搜索查询,这些搜索查询一般都是类似的sql检索,这种作业需要系统很快给出结果,类似于sql这种作业一般都是小作业。另外,该社交网站的后台系统需要分析每个用户和其他用户的关系网,从而向用户推荐好友,这样的作业就属于大作业,需要很长的时间计算而且这种作业对响应时间要求不高。在这种场景下,使用本发明的调度方法不仅可以缩短小作业的作业响应时间,又不会造成大作业“饥饿现象”,提升了用户体验。For example, on a social networking site, users have a large number of search queries every day. These search queries are generally similar to sql retrieval. This kind of job requires the system to give results quickly. Similar to sql, such jobs are generally small jobs. . In addition, the back-end system of the social networking site needs to analyze the network of each user and other users, so as to recommend friends to the user, such a job is a big job, it takes a long time to calculate and the response time of the job is not high. . In this scenario, the scheduling method of the present invention can not only shorten the homework response time of a small job, but also cause a big job "starvation" and improve the user experience.
下面以另一具体实施例对作业的调度过程进行说明,具体步骤如图3所示,包括:The following describes the scheduling process of the job in another specific embodiment. The specific steps are as shown in FIG. 3, including:
S301:当出现空闲资源时,将所有用户按照公平性排列成用户队列;S301: When idle resources appear, all users are arranged into a user queue according to fairness;
S302:按照用户队列的顺序选择用户队列中的第一个用户进行调度处理; S302: Select a first user in the user queue according to a sequence of user queues for scheduling processing;
S303:在调度处理之前,计算出当前用户名下作业队列中每个作业的优先级;S303: Calculate a priority of each job in the job queue under the current user name before the scheduling process;
其中,计算优先级的具体过程包括:Among them, the specific process of calculating the priority includes:
需要说明的是,当前用户名下作业队列中共有3个作业,其中,a作业和b作业均已经被调度处理过,c作业是刚刚提交的所以还未被调度处理过,所以计算a作业和b作业的大小因子使用式(1)~(6),而计算c作业的大小因子使用式(7)。It should be noted that there are 3 jobs in the job queue under the current user name. Among them, a job and b job have been scheduled, c job is just submitted, so it has not been scheduled, so calculate a job and b The size factor of the job uses equations (1) to (6), and the size factor of the c job is calculated using equation (7).
S3031:由式(1)分别计算出作业队列中a、b两个作业当前的任务进度,a、b的计算结果均为5;S3031: Calculate the current task progress of the two jobs a and b in the job queue by the formula (1), and the calculation results of a and b are all 5;
S3032:由式(2)分别计算出作业队列中a和b两个作业达到当前进度所使用的时间,a作业和b作业的计算结果分别为100s和5s;S3032: Calculate the time used by the two jobs a and b in the job queue to reach the current progress by the formula (2), and the calculation results of the a job and the b job are 100s and 5s, respectively;
S3033:由式(3)分别计算出作业队列中a和b两个作业的执行率,a作业和b作业的计算结果分别为0.05和1;S3033: The execution rates of two jobs a and b in the job queue are respectively calculated by the formula (3), and the calculation results of the a job and the b job are 0.05 and 1, respectively;
S3034:由式(4)分别计算出作业队列中a和b两个作业的剩余任务数量,a作业和b作业的计算结果均为5;S3034: Calculate the remaining tasks of the two jobs a and b in the job queue by the formula (4), and the calculation results of both the a job and the b job are 5;
需要说明的是,作业队列中a、b、c三个作业的总任务数量均为10。It should be noted that the total number of tasks for the three jobs a, b, and c in the job queue is 10.
S3035:由式(5)分别计算出作业队列中a和b两个作业执行完剩余任务所需的时间,a作业和b作业的计算结果分别为100s和5s;S3035: Calculate the time required for the two tasks a and b in the job queue to execute the remaining tasks by the formula (5), and the calculation results of the a job and the b job are 100s and 5s, respectively;
S3036:由式(6)分别计算出作业队列中a、b两个作业的大小因子,a作业和b作业的计算结果分别为19.05和0.95;S3036: Calculate the size factors of two jobs a and b in the job queue by equation (6), and the calculation results of a job and b job are 19.05 and 0.95, respectively;
S3037:根据式(7)计算出c作业的大小因子,计算结果为1;S3037: Calculate the size factor of the c job according to the formula (7), and the calculation result is 1;
S3038:由式(8)分别计算出作业队列中a、b、c三个作业的等待因子,a作业、b作业和c作业的计算结果均为0s;S3038: The waiting factors of three jobs a, b, and c in the job queue are respectively calculated by the formula (8), and the calculation results of the a job, the b job, and the c job are all 0s;
需要说明的是,a作业、b作业和c作业的等待时间均为0s。It should be noted that the waiting time for the a job, the b job, and the c job is 0 s.
S3039:由式(9)分别计算出作业队列中a、b、c三个作业的优先级,a作业、b作业和c作业的计算结果分别为:0.05、1.05和1;S3039: The priority of three jobs a, b, and c in the job queue is calculated by the formula (9), and the calculation results of the a job, the b job, and the c job are respectively: 0.05, 1.05, and 1;
S304:将当前用户名下的作业队列按照优先级从高到底进行排序,排序 结果是:c、b、a;S304: Sort the job queues under the current user name from high to low according to the priority, sort The result is: c, b, a;
S305:按照排序后作业队列的顺序,确定当前用户名下作业队列中的作业均满足数据本地性;S305: Determine, according to the order of the sorted job queues, that the jobs in the job queue under the current user name satisfy the data locality;
S306:对排序后的作业队列中第一个作业c进行调度处理,也就是说,向作业队列中的c作业分配空闲资源。S306: Perform scheduling processing on the first job c in the sorted job queue, that is, allocate idle resources to the c job in the job queue.
可见,当用户名下的作业的等待时间均等时,本发明的技术方案能够优先调度小作业,同时考虑作业的执行率,不仅在较大程度上缩短了小作业的响应时间,同时,提高了作业调度的效率,在较大程度上提升了小作业的用户感受。It can be seen that when the waiting time of the job under the user name is equal, the technical solution of the present invention can preferentially schedule the small job, and considers the execution rate of the job, which not only shortens the response time of the small job to a large extent, but also improves the response time. The efficiency of job scheduling has greatly improved the user experience of small jobs.
下面以又一实施例对作业的调度过程进行说明,具体步骤如图4所示,包括:The scheduling process of the job is described in another embodiment. The specific steps are as shown in FIG. 4, including:
S401:当出现空闲资源时,将所有用户按照公平性排列成用户队列;S401: When idle resources are present, all users are arranged into a user queue according to fairness;
S402:由于用户队列中第一个用户已经调度处理完毕,按照用户队列的顺序选择用户队列中的第二个用户进行调度处理;S402: The first user in the user queue is selected for scheduling processing according to the sequence of the user queue, because the first user in the user queue has been scheduled to be processed.
S403:在调度处理之前,计算出当前用户名下作业队列中3个作业的优先级;S403: Calculate a priority of three jobs in the job queue under the current user name before the scheduling process;
其中,计算优先级的具体过程包括:Among them, the specific process of calculating the priority includes:
需要说明的是,当前用户名下作业队列中共有3个作业,且3个作业均已经被调度处理过。It should be noted that there are 3 jobs in the job queue under the current user name, and all 3 jobs have been scheduled for processing.
S4031:由式(1)分别计算出作业队列中a、b、c三个作业当前的任务进度,a、b、c的计算结果分别为:50、8、1;S4031: The current task progress of the three jobs a, b, and c in the job queue is calculated by the formula (1), and the calculation results of a, b, and c are respectively: 50, 8, and 1;
S4032:由式(2)分别计算出作业队列中a、b、c三个作业达到当前进度所使用的时间,a、b、c的计算结果分别为:90s、20s、2s;S4032: Calculate the time used by the three jobs a, b, and c in the job queue to reach the current progress by the formula (2), and the calculation results of a, b, and c are respectively: 90s, 20s, 2s;
S4033:由式(3)分别计算出作业队列中a、b、c三个作业的执行率,a、b、c的计算结果分别为:0.6、0.4、0.5;S4033: The execution rates of three jobs a, b, and c in the job queue are calculated by equation (3), and the calculation results of a, b, and c are respectively: 0.6, 0.4, and 0.5;
S4034:由式(4)分别计算出作业队列中a、b、c三个作业的剩余任务 数量,其中,作业队列中第1个作业、第2个作业和第3个作业的总任务数量分别为100、10、5,a、b、c的计算结果分别为:50、2、4;S4034: Calculate the remaining tasks of three jobs a, b, and c in the job queue by equation (4) The quantity, wherein the total number of tasks of the first job, the second job, and the third job in the job queue are 100, 10, and 5, respectively, and the calculation results of a, b, and c are respectively: 50, 2, and 4;
S4035:由式(5)分别计算出作业队列中a、b、c三个作业执行完剩余任务所需的时间,a、b、c的计算结果分别为:90s、5s、8s;S4035: Calculate the time required for the three tasks a, b, and c in the job queue to execute the remaining tasks by equation (5). The calculation results of a, b, and c are: 90s, 5s, and 8s, respectively;
S4036:由式(6)分别计算出作业队列中a、b、c三个作业的大小因子,a、b、c的计算结果分别为:100、5.6、8.9;S4036: The size factors of three jobs a, b, and c in the job queue are calculated by equation (6), and the calculation results of a, b, and c are respectively: 100, 5.6, and 8.9;
S4037:由式(8)分别计算出作业队列中a、b、c三个作业的等待因子,其中,a、b、c的等待时间分别为:300s、0s、2s,a、b、c的计算结果分别为:115、0、0.77;S4037: The waiting factors of three jobs a, b, and c in the job queue are calculated by equation (8), wherein the waiting times of a, b, and c are respectively: 300s, 0s, 2s, a, b, c The calculation results are: 115, 0, 0.77;
S4038:由式(9)分别计算出作业队列中a、b、c三个作业的优先级,a、b、c的计算结果分别为:115.01、0.18、0.89;S4038: The priority of three jobs a, b, and c in the job queue is calculated by equation (9), and the calculation results of a, b, and c are: 115.01, 0.18, and 0.89, respectively;
S404:将当前用户名下的作业队列按照优先级从高到底进行排序,排序结果是:a、c、b。S404: Sort the job queues under the current user name from high to low according to the priority, and the sort result is: a, c, b.
S405:按照排序后作业队列的顺序,确定当前用户名下作业队列中的作业均满足数据本地性;S405: Determine, according to the order of the sorted job queues, that the jobs in the job queue under the current user name satisfy the data locality;
S406:按照排序后作业队列的顺序,对作业队列中第一个作业a进行调度处理,也就是说,向作业队列中的a作业分配空闲资源。S406: Perform scheduling processing on the first job a in the job queue according to the order of the sorted job queues, that is, allocate idle resources to the a job in the job queue.
可见,当大作业的等待时间较长时,本发明的技术方案能够使用等待因子影响作业的优先级,以实现对这类作业的尽快处理,在较大程度上避免出现“饥饿现象”。It can be seen that when the waiting time of the large operation is long, the technical solution of the present invention can use the waiting factor to influence the priority of the operation, so as to realize the processing of such operations as soon as possible, and to avoid the phenomenon of “starvation” to a large extent.
实施例二Embodiment 2
基于上述实施例相同的技术构思,参见图5,其示出了本发明实施例提供的一种作业调度装置50,该装置50包括:计算单元501、排序单元502以及处理单元503;其中,Based on the same technical concept of the above embodiment, referring to FIG. 5, a job scheduling apparatus 50 according to an embodiment of the present invention is shown. The apparatus 50 includes: a calculating unit 501, a sorting unit 502, and a processing unit 503;
所述计算单元501,设置为当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级; The calculating unit 501 is configured to: when a free resource occurs, calculate a priority of each job in the job queue according to a size factor of each job in the job queue and a waiting factor of each job in the job queue;
所述排序单元502,设置为将所述作业队列中的作业按照计算单元501计算出的所述优先级进行排序;The sorting unit 502 is configured to sort the jobs in the job queue according to the priorities calculated by the calculating unit 501;
所述处理单元503,用于按照所述排序后的作业队列的顺序,对所述作业队列中的作业进行调度处理。The processing unit 503 is configured to perform scheduling processing on the jobs in the job queue according to the order of the sorted job queues.
在上述方案中,所述计算单元501,是设置为当出现空闲资源时,按照作业队列中每个作业的任务处理情况计算所述作业队列中每个作业的大小因子;按照所述作业队列中每个作业前一次调度的时间计算所述作业队列中作业的等待因子;根据计算出的所述每个作业的大小因子和所述每个作业的等待因子,计算出所述作业队列中每个作业的优先级。In the above solution, the calculating unit 501 is configured to calculate, according to the task processing condition of each job in the job queue, a size factor of each job in the job queue when an idle resource occurs; according to the job queue Calculating a waiting factor of the job in the job queue at a time scheduled once before each job; calculating each of the job queues according to the calculated size factor of each job and the waiting factor of each job The priority of the job.
在上述方案中,所述计算单元501,是设置为当出现空闲资源时,分别确定作业队列中每个作业是否已经被调度处理过;若所述作业队列中的作业从未被调度处理过,则根据所述作业的输入数据计算出所述作业的大小因子;若所述作业队列中的作业已经被调度处理过,则根据所述作业执行完剩余任务所需的时间计算出所述作业的大小因子。In the above solution, the calculating unit 501 is configured to determine, when an idle resource occurs, whether each job in the job queue has been scheduled to be processed; if the job in the job queue has not been scheduled, Calculating a size factor of the job according to the input data of the job; if the job in the job queue has been scheduled to be processed, calculating the job according to the time required for the job to execute the remaining tasks Size factor.
在上述方案中,所述计算单元501,是设置为计算所述作业队列中作业当前的任务进度和达到当前进度所使用的时间;根据所述计算出的作业当前的任务进度和所述计算出的作业达到当前进度所使用的时间,计算出所述作业的执行率;根据所述计算出的作业当前的任务进度,计算所述作业的剩余任务数量;根据所述计算出的作业的执行率和所述计算出的作业的剩余任务数量,计算出所述作业执行完剩余任务所需的时间;根据所述计算出的作业执行完剩余任务所需的时间,计算出所述作业的大小因子。In the above solution, the calculating unit 501 is configured to calculate a current task progress of the job in the job queue and a time used to reach the current progress; and calculate the current task progress and the calculated according to the calculated job. Calculating the execution rate of the job when the job reaches the current progress; calculating the remaining task number of the job according to the calculated current task progress of the job; and calculating the execution rate of the job according to the calculated job And calculating, by the calculated number of remaining tasks of the job, a time required for the job to execute the remaining tasks; and calculating a size factor of the job according to the time required for the calculated job to execute the remaining tasks .
在上述方案中,所述排序单元502,是设置为当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序;其中,所述等待因子与所述优先级正相关;所述大小因子与所述优先级负相关。In the above solution, the sorting unit 502 is configured to calculate, when an idle resource occurs, each of the job queues according to a size factor of each job in the job queue and a wait factor of each job in the job queue. The priority of the jobs, and the jobs in the job queue are sorted according to the priority; wherein the wait factor is positively related to the priority; the size factor is negatively correlated with the priority.
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序 来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的程序指令来实现其相应功能。本申请不限制于任何特定形式的硬件和软件的结合。One of ordinary skill in the art will appreciate that all or part of the steps in the above methods may be passed through the program. The instructions are related to hardware (eg, a processor) that can be stored in a computer readable storage medium, such as a read only memory, a magnetic disk, or an optical disk. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. Instructions to achieve their corresponding functions. This application is not limited to any specific combination of hardware and software.
需要说明的是,本申请还可有其他多种实施例,在不背离本申请精神及其实质的情况下,熟悉本领域的技术人员可根据本申请作出各种相应的改变和变形,但这些相应的改变和变形都应属于本申请所附的权利要求的保护范围。It should be noted that various other embodiments and modifications may be made by those skilled in the art without departing from the spirit and scope of the application, Corresponding changes and modifications are intended to fall within the scope of the appended claims.
工业实用性Industrial applicability
本发明实施例提供的一种作业调度方法和装置,先由作业的大小因子和等待因子计算出作业的优先级,再根据作业的优先级进行调度处理,这样,能够缩短小作业的响应时间,同时防止大作业产生“饥饿现象”,实现提高作业调度效率的技术效果。 A job scheduling method and apparatus provided by an embodiment of the present invention first calculates a priority of a job by a size factor and a wait factor of the job, and then performs scheduling processing according to the priority of the job, so that the response time of the small job can be shortened. At the same time, it prevents "starvation" in large operations and achieves the technical effect of improving job scheduling efficiency.

Claims (10)

  1. 一种作业调度方法,所述方法包括:A job scheduling method, the method comprising:
    当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序;When an idle resource occurs, the priority of each job in the job queue is calculated according to the size factor of each job in the job queue and the waiting factor of each job in the job queue, and the job queue is Jobs are sorted according to the priority;
    按照所述排序后的作业队列的顺序,对所述作业队列中的作业进行调度处理。Scheduling processing of jobs in the job queue according to the order of the sorted job queues.
  2. 根据权利要求1所述的方法,其中:The method of claim 1 wherein:
    所述当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序,包括:When the idle resource occurs, calculating a priority of each job in the job queue according to a size factor of each job in the job queue and a waiting factor of each job in the job queue, and scheduling the job The jobs in are sorted according to the priority, including:
    当出现空闲资源时,按照作业队列中每个作业的任务处理情况计算所述作业队列中每个作业的大小因子;When an idle resource occurs, the size factor of each job in the job queue is calculated according to the task processing condition of each job in the job queue;
    按照所述作业队列中每个作业前一次调度的时间计算所述作业队列中作业的等待因子;Calculating a wait factor of the job in the job queue according to a time scheduled for each job in the job queue;
    根据计算出的所述每个作业的大小因子和所述每个作业的等待因子,计算出所述作业队列中每个作业的优先级。A priority of each job in the job queue is calculated based on the calculated size factor of each job and the wait factor of each job.
  3. 根据权利要求2所述的方法,其中:The method of claim 2 wherein:
    所述当出现空闲资源时,按照作业队列中每个作业的任务处理情况计算所述作业队列中每个作业的大小因子,包括:When the idle resource occurs, calculating a size factor of each job in the job queue according to the task processing condition of each job in the job queue, including:
    当出现空闲资源时,分别确定作业队列中每个作业是否已经被调度处理过;When an idle resource occurs, it is determined whether each job in the job queue has been scheduled for processing;
    若所述作业队列中的作业从未被调度处理过,则根据所述作业的输入数据量计算所述作业的大小因子;If the job in the job queue has never been scheduled, the size factor of the job is calculated according to the input data amount of the job;
    若所述作业队列中的作业已经被调度处理过,则根据所述作业执行完剩余任务所需的时间计算所述作业的大小因子。 If the job in the job queue has been scheduled to be processed, the size factor of the job is calculated according to the time required for the job to execute the remaining tasks.
  4. 根据权利要求3所述的方法,其中:The method of claim 3 wherein:
    所述若所述作业队列中的作业已经被调度处理过,则根据所述作业执行完剩余任务所需的时间计算出所述作业的大小因子,包括:If the job in the job queue has been scheduled, the size factor of the job is calculated according to the time required for the job to execute the remaining tasks, including:
    计算所述作业队列中作业当前的任务进度和所述作业队列中作业达到当前进度所使用的时间;Calculating a current task progress of the job in the job queue and a time used by the job in the job queue to reach a current progress;
    根据所述计算出的作业当前的任务进度和所述计算出的作业达到当前进度所使用的时间,计算出所述作业的执行率;Calculating an execution rate of the job according to the calculated current task progress of the job and the time taken by the calculated job to reach the current progress;
    根据所述计算出的作业当前的任务进度,计算所述作业的剩余任务数量;Calculating a remaining number of tasks of the job according to the calculated current task progress of the job;
    根据所述计算出的作业的执行率和所述计算出的作业的剩余任务数量,计算出所述作业执行完剩余任务所需的时间;Calculating, according to the calculated execution rate of the job and the remaining number of tasks of the calculated job, a time required for the job to execute the remaining tasks;
    根据所述计算出的作业执行完剩余任务所需的时间,计算出所述作业的大小因子。The size factor of the job is calculated according to the time required for the calculated job to execute the remaining tasks.
  5. 根据权利要求1所述的方法,其中:The method of claim 1 wherein:
    所述当出现空闲资源时,根据作业队列中作业的大小因子和所述作业队列中作业的等待因子计算出所述作业队列中作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序,包括:When the idle resource occurs, calculating a priority of the job in the job queue according to a size factor of the job in the job queue and a wait factor of the job in the job queue, and the job in the job queue is as described Prioritize, including:
    当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序;其中,所述等待因子与所述优先级正相关,所述大小因子与所述优先级负相关。When an idle resource occurs, the priority of each job in the job queue is calculated according to the size factor of each job in the job queue and the waiting factor of each job in the job queue, and the job queue is The jobs are ordered according to the priority; wherein the wait factor is positively correlated with the priority, the size factor being negatively correlated with the priority.
  6. 一种作业调度装置,所述装置包括:计算单元、排序单元和处理单元;其中,A job scheduling device, the device comprising: a computing unit, a sorting unit, and a processing unit; wherein
    所述计算单元,设置为当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级;The calculating unit is configured to: when a free resource occurs, calculate a priority of each job in the job queue according to a size factor of each job in the job queue and a waiting factor of each job in the job queue;
    所述排序单元,设置为将所述作业队列中的作业按照计算单元计算出的所述优先级进行排序; The sorting unit is configured to sort the jobs in the job queue according to the priority calculated by the calculating unit;
    所述处理单元,设置为按照所述排序后的作业队列的顺序,对所述作业队列中的作业进行调度处理。The processing unit is configured to perform scheduling processing on the jobs in the job queue in accordance with the order of the sorted job queues.
  7. 根据权利要求6所述的装置,其中:The device of claim 6 wherein:
    所述计算单元,是设置为当出现空闲资源时,按照作业队列中每个作业的任务处理情况计算所述作业队列中每个作业的大小因子;按照所述作业队列中每个作业前一次调度的时间计算所述作业队列中作业的等待因子;根据计算出的所述每个作业的大小因子和所述每个作业的等待因子,计算出所述作业队列中每个作业的优先级。The calculating unit is configured to calculate, according to a task processing condition of each job in the job queue, a size factor of each job in the job queue when an idle resource occurs; according to the previous scheduling of each job in the job queue The time is calculated as a waiting factor of the job in the job queue; and the priority of each job in the job queue is calculated according to the calculated size factor of each job and the waiting factor of each job.
  8. 根据权利要求7所述的装置,其中:The device of claim 7 wherein:
    所述计算单元,是设置为当出现空闲资源时,分别确定作业队列中每个作业是否已经被调度处理过;若所述作业队列中的作业从未被调度处理过,则根据所述作业的输入数据计算出所述作业的大小因子;若所述作业队列中的作业已经被调度处理过,则根据所述作业执行完剩余任务所需的时间计算出所述作业的大小因子。The calculating unit is configured to determine, when an idle resource occurs, whether each job in the job queue has been scheduled to be processed; if the job in the job queue has not been scheduled, according to the job The input data calculates a size factor of the job; if the job in the job queue has been scheduled to be processed, the size factor of the job is calculated according to the time required for the job to execute the remaining tasks.
  9. 根据权利要求8所述的装置,其中:The device of claim 8 wherein:
    所述计算单元,是设置为计算所述作业队列中作业当前的任务进度和达到当前进度所使用的时间;根据所述计算出的作业当前的任务进度和所述计算出的作业达到当前进度所使用的时间,计算出所述作业的执行率;根据所述计算出的作业当前的任务进度,计算所述作业的剩余任务数量;根据所述计算出的作业的执行率和所述计算出的作业的剩余任务数量,计算出所述作业执行完剩余任务所需的时间;根据所述计算出的作业执行完剩余任务所需的时间,计算出所述作业的大小因子。The calculating unit is configured to calculate a current task progress of the job in the job queue and a time used to reach the current progress; according to the calculated current task progress of the job and the calculated job reaching the current progress Calculating the execution rate of the job according to the time of use; calculating the remaining task number of the job according to the calculated current task progress of the job; calculating the execution rate of the job according to the calculation and the calculated The number of remaining tasks of the job, calculating the time required for the job to execute the remaining tasks; calculating the size factor of the job according to the time required for the calculated job to execute the remaining tasks.
  10. 根据权利要求6所述的装置,其中:The device of claim 6 wherein:
    所述排序单元,是设置为当出现空闲资源时,根据作业队列中每个作业的大小因子和所述作业队列中每个作业的等待因子计算出所述作业队列中每个作业的优先级,并将所述作业队列中的作业按照所述优先级进行排序;其中,所述等待因子与所述优先级正相关;所述大小因子与所述优先级负相关。 The sorting unit is configured to calculate a priority of each job in the job queue according to a size factor of each job in the job queue and a wait factor of each job in the job queue when an idle resource occurs, And sorting the jobs in the job queue according to the priority; wherein the wait factor is positively related to the priority; the size factor is negatively correlated with the priority.
PCT/CN2016/080057 2016-01-18 2016-04-22 Task scheduling method and device WO2016197716A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610031403.1 2016-01-18
CN201610031403.1A CN106980532A (en) 2016-01-18 2016-01-18 A kind of job scheduling method and device

Publications (1)

Publication Number Publication Date
WO2016197716A1 true WO2016197716A1 (en) 2016-12-15

Family

ID=57503252

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/080057 WO2016197716A1 (en) 2016-01-18 2016-04-22 Task scheduling method and device

Country Status (2)

Country Link
CN (1) CN106980532A (en)
WO (1) WO2016197716A1 (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108345501A (en) * 2017-01-24 2018-07-31 全球能源互联网研究院 A kind of distributed resource scheduling method and system
CN111045810A (en) * 2019-12-17 2020-04-21 浙江大华技术股份有限公司 Task scheduling processing method and device
CN111221645A (en) * 2019-11-14 2020-06-02 中国民航信息网络股份有限公司 Aviation operation processing method and system
US10705761B2 (en) 2018-09-14 2020-07-07 Yandex Europe Ag Method of and system for scheduling transmission of I/O operations
CN111813553A (en) * 2020-07-17 2020-10-23 华侨大学 Low-energy-consumption method based on selectable factor period task dynamic priority
US10908982B2 (en) 2018-10-09 2021-02-02 Yandex Europe Ag Method and system for processing data
US10996986B2 (en) 2018-12-13 2021-05-04 Yandex Europe Ag Method and system for scheduling i/o operations for execution
US11003600B2 (en) 2018-12-21 2021-05-11 Yandex Europe Ag Method and system for scheduling I/O operations for processing
US11010090B2 (en) 2018-12-29 2021-05-18 Yandex Europe Ag Method and distributed computer system for processing data
US11048547B2 (en) 2018-10-09 2021-06-29 Yandex Europe Ag Method and system for routing and executing transactions
US11055160B2 (en) 2018-09-14 2021-07-06 Yandex Europe Ag Method of determining potential anomaly of memory device
US11061720B2 (en) 2018-09-14 2021-07-13 Yandex Europe Ag Processing system and method of detecting congestion in processing system
CN113379308A (en) * 2021-06-30 2021-09-10 北京斯年智驾科技有限公司 Task distribution method and device, electronic equipment and storage medium
CN113448705A (en) * 2021-06-25 2021-09-28 皖西学院 Unbalanced job scheduling algorithm
US11184745B2 (en) 2019-02-06 2021-11-23 Yandex Europe Ag Actor system and method for transmitting a message from a first actor to a second actor
US11288254B2 (en) 2018-10-15 2022-03-29 Yandex Europe Ag Method of and system for processing request in distributed database

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108052443A (en) * 2017-10-30 2018-05-18 北京奇虎科技有限公司 A kind of test assignment dispatching method, device, server and storage medium
CN109189581B (en) * 2018-09-20 2021-08-31 郑州云海信息技术有限公司 Job scheduling method and device
CN110287015A (en) * 2019-06-27 2019-09-27 四川中电启明星信息技术有限公司 The passive dispatching method of PC automated job
CN111949408A (en) * 2020-08-16 2020-11-17 广东奥飞数据科技股份有限公司 Dynamic allocation method for edge computing resources
CN111930514B (en) * 2020-09-14 2021-09-10 四川中电启明星信息技术有限公司 Resource optimization allocation method and system
CN112181645A (en) * 2020-09-21 2021-01-05 中国建设银行股份有限公司 Resource scheduling method, device, equipment and storage medium
CN113568725A (en) * 2021-07-14 2021-10-29 中国科学院计算技术研究所 Deep learning job priority scheduling method and deep learning job system
CN113946430B (en) * 2021-12-20 2022-05-06 北京并行科技股份有限公司 Job scheduling method, computing device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101770402A (en) * 2008-12-29 2010-07-07 中国移动通信集团公司 Map task scheduling method, equipment and system in MapReduce system
CN103336714A (en) * 2013-06-20 2013-10-02 北京奇虎科技有限公司 Operation scheduling method and device
CN104102794A (en) * 2014-08-06 2014-10-15 浪潮电子信息产业股份有限公司 Optimizing method of HADOOP scheduling method
CN104281492A (en) * 2013-07-08 2015-01-14 无锡南理工科技发展有限公司 Fair Hadoop task scheduling method in heterogeneous environment
WO2015152871A1 (en) * 2014-03-31 2015-10-08 Hewlett-Packard Development Company, L.P. Prioritization of network traffic in a distributed processing system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101770402A (en) * 2008-12-29 2010-07-07 中国移动通信集团公司 Map task scheduling method, equipment and system in MapReduce system
CN103336714A (en) * 2013-06-20 2013-10-02 北京奇虎科技有限公司 Operation scheduling method and device
CN104281492A (en) * 2013-07-08 2015-01-14 无锡南理工科技发展有限公司 Fair Hadoop task scheduling method in heterogeneous environment
WO2015152871A1 (en) * 2014-03-31 2015-10-08 Hewlett-Packard Development Company, L.P. Prioritization of network traffic in a distributed processing system
CN104102794A (en) * 2014-08-06 2014-10-15 浪潮电子信息产业股份有限公司 Optimizing method of HADOOP scheduling method

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108345501B (en) * 2017-01-24 2021-10-29 全球能源互联网研究院有限公司 Distributed resource scheduling method and system
CN108345501A (en) * 2017-01-24 2018-07-31 全球能源互联网研究院 A kind of distributed resource scheduling method and system
US11055160B2 (en) 2018-09-14 2021-07-06 Yandex Europe Ag Method of determining potential anomaly of memory device
US11449376B2 (en) 2018-09-14 2022-09-20 Yandex Europe Ag Method of determining potential anomaly of memory device
US10705761B2 (en) 2018-09-14 2020-07-07 Yandex Europe Ag Method of and system for scheduling transmission of I/O operations
US11061720B2 (en) 2018-09-14 2021-07-13 Yandex Europe Ag Processing system and method of detecting congestion in processing system
US10908982B2 (en) 2018-10-09 2021-02-02 Yandex Europe Ag Method and system for processing data
US11048547B2 (en) 2018-10-09 2021-06-29 Yandex Europe Ag Method and system for routing and executing transactions
US11288254B2 (en) 2018-10-15 2022-03-29 Yandex Europe Ag Method of and system for processing request in distributed database
US10996986B2 (en) 2018-12-13 2021-05-04 Yandex Europe Ag Method and system for scheduling i/o operations for execution
US11003600B2 (en) 2018-12-21 2021-05-11 Yandex Europe Ag Method and system for scheduling I/O operations for processing
US11010090B2 (en) 2018-12-29 2021-05-18 Yandex Europe Ag Method and distributed computer system for processing data
US11184745B2 (en) 2019-02-06 2021-11-23 Yandex Europe Ag Actor system and method for transmitting a message from a first actor to a second actor
CN111221645A (en) * 2019-11-14 2020-06-02 中国民航信息网络股份有限公司 Aviation operation processing method and system
CN111221645B (en) * 2019-11-14 2023-06-16 中国民航信息网络股份有限公司 Aviation operation processing method and system
CN111045810A (en) * 2019-12-17 2020-04-21 浙江大华技术股份有限公司 Task scheduling processing method and device
CN111045810B (en) * 2019-12-17 2023-08-29 浙江大华技术股份有限公司 Task scheduling processing method and device
CN111813553A (en) * 2020-07-17 2020-10-23 华侨大学 Low-energy-consumption method based on selectable factor period task dynamic priority
CN111813553B (en) * 2020-07-17 2023-05-26 华侨大学 Task dynamic priority low-energy consumption method based on selectable factor period
CN113448705A (en) * 2021-06-25 2021-09-28 皖西学院 Unbalanced job scheduling algorithm
CN113379308A (en) * 2021-06-30 2021-09-10 北京斯年智驾科技有限公司 Task distribution method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN106980532A (en) 2017-07-25

Similar Documents

Publication Publication Date Title
WO2016197716A1 (en) Task scheduling method and device
US20220027202A1 (en) Stream-based accelerator processing of computational graphs
CN113535367B (en) Task scheduling method and related device
US11010199B2 (en) Efficient critical thread scheduling for non-privileged thread requests
US9342355B2 (en) Joint optimization of multiple phases in large data processing
WO2017016421A1 (en) Method of executing tasks in a cluster and device utilizing same
US20130339966A1 (en) Sequential cooperation between map and reduce phases to improve data locality
US20130139172A1 (en) Controlling the use of computing resources in a database as a service
KR101350755B1 (en) Cost Based Scheduling Algorithm for Multiple Workflow in Cloud Computing and System of The Same
JP2012511204A (en) How to reorganize tasks to optimize resources
US9947068B2 (en) System and method for GPU scheduling
KR20110080735A (en) Computing system and method
US11995016B2 (en) Input/output command rebalancing in a virtualized computer system
CN106775948B (en) Cloud task scheduling method and device based on priority
KR101770191B1 (en) Resource allocation and apparatus
CN112925616A (en) Task allocation method and device, storage medium and electronic equipment
CN116881003A (en) Resource allocation method, device, service equipment and storage medium
CN112685158A (en) Task scheduling method and device, electronic equipment and storage medium
CN110532099A (en) Resource isolation method and apparatus and electronic equipment and medium
US20240118920A1 (en) Workload scheduling using queues with different priorities
CN112433841B (en) Resource pool scheduling method, system, server and storage medium
Ullah et al. Notice of Violation of IEEE Publication Principles: Hadoop Preemptive Deadline Constraint Scheduler
CN116610422A (en) Task scheduling method, device and system
Huo et al. Dynamic Throughput Allocation among Multiple Servers for Heterogeneous Storage System
CN113138909A (en) Load statistical method, device, storage medium and electronic equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16806614

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16806614

Country of ref document: EP

Kind code of ref document: A1