WO2020151177A1 - 基于大数据行为调度应用任务的方法、服务器及存储介质 - Google Patents

基于大数据行为调度应用任务的方法、服务器及存储介质 Download PDF

Info

Publication number
WO2020151177A1
WO2020151177A1 PCT/CN2019/092669 CN2019092669W WO2020151177A1 WO 2020151177 A1 WO2020151177 A1 WO 2020151177A1 CN 2019092669 W CN2019092669 W CN 2019092669W WO 2020151177 A1 WO2020151177 A1 WO 2020151177A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
tasks
execution
server
threads
Prior art date
Application number
PCT/CN2019/092669
Other languages
English (en)
French (fr)
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 WO2020151177A1 publication Critical patent/WO2020151177A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]

Definitions

  • This application relates to the technical field of big data processing, and in particular to a method, server and storage medium for scheduling application tasks based on big data behavior.
  • each process node (ie task program) in the business process needs to be set separately.
  • task programs are scheduled through timing.
  • a task needs to start at 0 o’clock and is estimated to execute for 30 minutes. Then if another program depends on this task, it will start execution at 0:40 and proceed according to the dependency. Tandem execution, artificially arrange the timing execution time of each task.
  • the main purpose of this application is to solve the problem of long business process execution time that exists between each process node in the existing mechanism, which is heavily dependent on the serial relationship between the previous and subsequent process nodes.
  • the present application provides a method for scheduling application tasks based on big data behaviors.
  • the method is executed by a server, and the server deploys multiple tasks.
  • the method includes:
  • the relationship includes at least one of the following items: the execution order of the tasks is sequential, the dependency relationship is triggered simultaneously, and the execution of a task depends on the execution of the previous task;
  • the execution sequence between tasks without dependencies is scheduled in real time, and all tasks in the multiple tasks are traversed until all tasks are executed.
  • the method also includes:
  • the multiple tasks are divided into at least one serial task and at least one task chain according to the dependency relationship.
  • the serial task refers to a task that does not have a dependency relationship with any one of the multiple tasks.
  • the task chain refers to a period of multiple tasks with a dependency relationship, and there is no dependency relationship between the serial task and the task chain.
  • the multiple tasks are stored in a task tree, and the task tree includes multiple nodes; when the multiple tasks include at least two task chains, the execution time of each task is The historical records of and the resource status information, real-time scheduling of the execution sequence between tasks that have no dependencies, including:
  • an identifier is set for the first task, and the node status of the first task in the task tree is correspondingly updated;
  • the tasks in the task chain are executed before the serial task, and the priority of the serial task is lower than the priority of the task chain.
  • the multiple tasks include at least two task chains, according to the historical record of the execution time of each task and the resource status information, the sequence of tasks that have no dependencies is scheduled in real time ,include:
  • the execution of the task chain including one unexecuted task includes more than two unexecuted tasks.
  • the task chain of the task is determined based on the resource status information that the current resources of the server are insufficient. If it is determined based on the resource status information that the current resources of the server are insufficient, then according to the historical record of the execution time of each task and the resource status information, the execution of the task chain including one unexecuted task includes more than two unexecuted tasks. The task chain of the task.
  • the method also includes:
  • the multiple threads include scheduling threads
  • the invoking the multiple threads to execute multiple tasks concurrently includes:
  • the initial execution time of each serial task and each task chain is the same.
  • the corresponding update of the node state of the first task in the task tree includes:
  • next hop task field If the next hop task field is empty, update the identifier of the node of the first task in the task tree to done.
  • the current resource status information of the collection server includes:
  • the current resource state information of the server is collected at a fixed or dynamically adjusted frequency.
  • a second aspect of the present application provides a server that deploys multiple tasks, and the server has a function of implementing the method for scheduling application tasks based on big data behaviors provided in the first aspect.
  • the functions can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions, and the modules may be software and/or hardware.
  • the server includes:
  • An acquisition module configured to collect current resource status information of the server, the resource status information including processor, memory, and storage usage rates;
  • the processing module is configured to, if it is determined that the current resources of the server are sufficient according to the resource status information, start multiple threads, call the multiple threads to execute multiple tasks concurrently, and the multiple tasks do not depend on each other Relationship;
  • the dependency relationship includes at least one of the following items: the execution order of the tasks has a sequence, a dependency relationship triggered in parallel at the same time, and a relationship that the execution of a task depends on the execution of the previous task;
  • the processing module is also used to schedule the execution sequence of tasks without dependencies in real time according to the historical record of the execution time of each task and the resource status information, and traverse all tasks in the multiple tasks until all tasks are executed. complete.
  • the processing module is also used to:
  • the multiple tasks are divided into at least one serial task and at least one task chain according to the dependency relationship.
  • the serial task refers to a task that does not have a dependency relationship with any one of the multiple tasks.
  • the task chain refers to a period of multiple tasks with a dependency relationship, and there is no dependency relationship between the serial task and the task chain.
  • the processing module is used to:
  • the tasks in the task chain are executed before the serial task, and the priority of the serial task is lower than the priority of the task chain.
  • the processing module is used to:
  • the execution of the task chain including one unexecuted task includes more than two unexecuted tasks.
  • the task chain of the task is determined based on the resource status information that the current resources of the server are insufficient. If it is determined based on the resource status information that the current resources of the server are insufficient, then according to the historical record of the execution time of each task and the resource status information, the execution of the task chain including one unexecuted task includes more than two unexecuted tasks. The task chain of the task.
  • the processing module is used to:
  • the multiple threads include scheduling threads
  • the initial execution time of each serial task and each task chain is the same.
  • a server which includes:
  • At least one connected processing module, memory, and transceiver wherein the memory is used to store program code, and the processing module is used to call the program code in the memory to perform the following operations:
  • the relationship includes at least one of the following items: the execution order of the tasks is sequential, the dependency relationship is triggered simultaneously, and the execution of a task depends on the execution of the previous task;
  • the processing module is configured to perform the following operations:
  • the tasks in the task chain are executed before the serial task, and the priority of the serial task is lower than the priority of the task chain.
  • the processor is also used to perform the following operations:
  • the multiple tasks are divided into at least one serial task and at least one task chain according to the dependency relationship.
  • the serial task refers to a task that does not have a dependency relationship with any one of the multiple tasks.
  • the task chain refers to a period of multiple tasks with a dependency relationship, and there is no dependency relationship between the serial task and the task chain.
  • the processor is configured to perform the following operations:
  • the tasks in the task chain are executed before the serial task, and the priority of the serial task is lower than the priority of the task chain.
  • the processor is configured to perform the following operations:
  • the execution of the task chain including one unexecuted task includes more than two unexecuted tasks.
  • the task chain of the task is determined based on the resource status information that the current resources of the server are insufficient. If it is determined based on the resource status information that the current resources of the server are insufficient, then according to the historical record of the execution time of each task and the resource status information, the execution of the task chain including one unexecuted task includes more than two unexecuted tasks. The task chain of the task.
  • the processor is used to perform the following operations:
  • the multiple threads include scheduling threads
  • the initial execution time of each serial task and each task chain is the same.
  • the processor is specifically configured to perform the following operations:
  • next hop task field If the next hop task field is empty, update the identifier of the node of the first task in the task tree to done.
  • Another aspect of the present application provides a non-volatile computer storage medium, which includes instructions, which when run on a computer, cause the computer to execute the methods described in the above aspects.
  • FIG. 1 is a schematic flowchart of a method for scheduling application tasks based on big data behaviors in an embodiment of the application
  • Figure 2 is a schematic diagram of a task queue in an embodiment of the application
  • FIG. 3 is a schematic diagram of task execution time in an embodiment of the application.
  • FIG. 4 is another schematic diagram of the task queue in the embodiment of the application.
  • FIG. 5 is another schematic diagram of task execution time in an embodiment of this application.
  • FIG. 6 is a schematic diagram of a structure of a server in an embodiment of the application.
  • FIG. 7 is a schematic diagram of another structure of a server in an embodiment of the application.
  • This application provides a method, server and storage medium for scheduling application tasks based on big data behaviors, which can be used for task scheduling, and can solve the business that exists between the process nodes in the existing mechanism that rely heavily on the serial relationship between the front and back process nodes Long process execution time.
  • a series of serial tasks are divided into at least one serial task and at least one parallel task chain.
  • Each task chain can be regarded as "a segment of multiple tasks with dependencies.”
  • serial tasks without dependencies and at least one task chain are executed in parallel, and there is no dependency relationship between each task chain, that is, tasks without dependencies can be executed in parallel, making full use of server resources.
  • paralleling tasks without dependencies the processing time between tasks without dependencies can be shortened locally, the execution efficiency of tasks can be improved, and the business impact caused by unfinished tasks can be reduced.
  • the server executes the server deployment multiple tasks, and the method includes:
  • the current resource status information of the server can be collected at a fixed or dynamically adjusted frequency (for example, 5s). While not affecting the performance of the server, it can also ensure that the various usage conditions currently based on it will not affect the server. Robustness and timeliness of current concurrent execution tasks.
  • the usage rate of the processor, memory, and storage can be monitored through a hook mechanism.
  • hook is a very important part of the Windows message processing mechanism.
  • the application can intercept and process Window messages or other specific events through the hook mechanism. When an event occurs, the application can set multiple hook subroutines on the corresponding hook (multiple hook subroutines can monitor the task execution status), which form a list of pointers to hook functions associated with the hook ( For example, a hook linked list, the hook linked list represents a task queue, and it is determined that the task queue can determine the execution order of tasks).
  • the system sends the monitored message to the first hook function pointed to in the call linked list (for example, the first task in the task queue), and the hook function will be based on their respective functions Monitor, modify and control the message, and pass the message to the next hook function after the processing is completed until the end of the hook list is reached.
  • the hook function surrenders control, the intercepted message will eventually be returned to the window processing function.
  • the dependency relationship includes at least one of the following items: the execution order of the tasks is sequential, the dependency relationship is triggered in parallel at the same time, and the execution of a task depends on the execution of the previous task.
  • the dependency relationship may include an upstream dependency relationship and a downstream dependency relationship
  • the dependency relationship between tasks may be rendered to a task tree representation
  • the task tree can represent the local relationships, global relationships, and node states of task nodes among all tasks.
  • the node status includes: running, running successfully, and running failed.
  • This application does not distinguish between task nodes and nodes, and nodes represent tasks.
  • the task tree can facilitate unified management or view the deployed tasks. For example, in the task tree, taking the task node 6 as a starting point, recursively search upstream and downstream of the task node 6 respectively, and search for the upstream dependent node and the downstream dependent node of the task node 6.
  • the upstream dependency of task node 6 is: task node 6 depends on task node 3 and task node 4, and task node 3 depends on task node 0.
  • the downstream dependencies of task node 6 are: task node 6 depends on task node 8 and task node 9, and task node 8 depends on task node 12.
  • the traversal in this application refers to traversing each task in a complete task flow until all tasks are executed. Only the complete task flow needs to be executed once, without looping.
  • the method further includes:
  • the multiple tasks are divided into at least one serial task and at least one task chain according to the dependency relationship.
  • the serial task refers to a task that does not have a dependency relationship with any one of the multiple tasks.
  • the task chain refers to a period of multiple tasks with a dependency relationship, and there is no dependency relationship between the serial task and the task chain.
  • the multiple tasks are stored in a task tree, and the task tree includes multiple nodes; when the multiple tasks include at least two task chains, the According to the historical record of the execution time of each task and the resource status information, real-time scheduling of the execution sequence between tasks without dependencies includes:
  • an identifier is set for the first task, and the node status of the first task in the task tree is correspondingly updated;
  • the tasks in the task chain are executed before the serial task, and the priority of the serial task is lower than the priority of the task chain.
  • the task queue includes task 1, task 2, ... task 20.
  • task 1, task 2, and task 3 constitute task chain 1
  • task 6, task 7...task 12 constitute task chain 2.
  • the tasks in the task queue shown in FIG. 2 are concurrently executed at time t1 (as shown in FIG. 3).
  • multiple concurrently executed task queues that are not dependent on each other include task 1 and task 4, which exist between task 1 and other tasks in the task queue (that is, task 2 and task 3 in task chain 1)
  • Dependency the execution of task 4 will not trigger other tasks (that is, tasks other than task 4 in the task queue shown in route 2), and there is no dependency relationship with other tasks, so the priority of task 1 It is higher than task 4. Therefore, when tasks in the task queue are executed concurrently, tasks such as task 1 will be executed first.
  • a hash table can also be used to process tasks.
  • the corresponding update of the node status of the first task in the task tree includes:
  • the procedure of calling the processing task determines whether the next hop task field of the first task is empty, if not, replace the current task name with the task name of the next hop task, and update the first task in the task
  • the identifier of the node in the tree is has_next, and the task object is inserted into the task queue corresponding to the next hop task; if the next hop task field is empty, the node of the first task in the task tree The identifier of is updated to done.
  • the real-time scheduling has no dependency relationship based on the historical record of the execution time of each task and the resource status information
  • the sequence of tasks includes:
  • the execution of the task chain including one unexecuted task includes more than two unexecuted tasks.
  • the task chain of the task is determined based on the resource status information that the current resources of the server are insufficient. If it is determined based on the resource status information that the current resources of the server are insufficient, then according to the historical record of the execution time of each task and the resource status information, the execution of the task chain including one unexecuted task includes more than two unexecuted tasks. The task chain of the task.
  • each task in the task queue can be regarded as a task chain, where each task chain can be multiple tasks with dependencies. That is to say, the initial execution time of each task chain is the same.
  • the "prioritized execution of dependent tasks" in the present invention refers to the priority execution of task chains with multiple tasks. If the cpu resources are sufficient, then A task chain that executes one task at the same time means that while executing a "task chain with multiple tasks", the "task chain with only one task” can be executed in parallel. If the cpu resources are insufficient, the dependent task chain is executed first.
  • the method before the invoking the multiple threads to execute multiple tasks concurrently, the method further includes:
  • the multiple threads include scheduling threads
  • the invoking the multiple threads to execute multiple tasks concurrently includes:
  • multiple concurrently executed task queues that are not dependent on each other include task 1, task 2, and task 3.
  • Task 1, task 2, and task 3 belong to the same task chain and are dependent on each other Relationship, the execution of task 2 will trigger task 3. Therefore, when the priority of task 2 is higher than task 3. Therefore, when tasks in the task queue are executed concurrently, task 1, task 2, and task 3 will be executed in sequence.
  • the initial execution time of each serial task and each task chain is the same.
  • the above describes a method for scheduling application tasks based on big data behaviors in the present application, and the following describes a server that executes the above method for scheduling application tasks based on big data behaviors.
  • Fig. 6 shows a schematic structural diagram of a server.
  • the server in the embodiment of the present application can implement steps corresponding to the method for scheduling application tasks based on big data behaviors performed in the embodiment corresponding to Fig. 1 above.
  • the functions implemented by the server can be implemented by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions, and the modules may be software and/or hardware.
  • the server may include an acquisition module and a processing module, and the functional implementation of the processing module and the acquisition module may refer to the operations performed in the embodiment corresponding to FIG. 1, which will not be repeated here.
  • the processing module can be used to control the receiving and sending operations of the acquiring module.
  • the server deploys multiple tasks, and the server has a function of implementing the method for scheduling application tasks based on big data behaviors provided in the embodiments corresponding to FIGS. 1 to 5 above.
  • the functions can be realized by hardware, or by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above-mentioned functions, and the modules may be software and/or hardware.
  • the acquisition module may be used to collect current resource status information of the server, and the resource status information includes usage rates of the processor, memory, and storage.
  • the processing module may be configured to, if it is determined that the current resources of the server are sufficient according to the resource status information, start multiple threads, call the multiple threads to execute multiple tasks concurrently, and the multiple tasks do not exist among each other Dependency relationship; the dependency relationship includes at least one of the following items: the execution order of the tasks is sequential, the dependency relationship is triggered in parallel at the same time, and the execution of a task depends on the execution of the previous task.
  • the processing module is also used to schedule the execution sequence of tasks without dependencies in real time according to the historical record of the execution time of each task and the resource status information, and traverse all tasks in the multiple tasks until all tasks are executed. complete.
  • the processing module starts multiple threads when the current resources of the server are sufficient according to the resource state information collected by the acquisition module, and calls multiple threads to execute multiple tasks concurrently. Since these multiple tasks do not have a dependency relationship with each other, by parallelizing tasks without a dependency relationship, the processing time between tasks without a dependency relationship can be shortened locally, so the execution efficiency of the task can be improved.
  • the execution sequence between the tasks without dependencies is scheduled in real time, and all tasks in the multiple tasks are traversed until all tasks are executed. Through real-time scheduling, the efficiency of task execution can be improved and the business impact caused by unfinished tasks can be reduced.
  • the processing module is further configured to:
  • the multiple tasks are divided into at least one serial task and at least one task chain according to the dependency relationship.
  • the serial task refers to a task that does not have a dependency relationship with any one of the multiple tasks.
  • the task chain refers to a period of multiple tasks with a dependency relationship, and there is no dependency relationship between the serial task and the task chain.
  • the processing module is configured to:
  • the tasks in the task chain are executed before the serial task, and the priority of the serial task is lower than the priority of the task chain.
  • the processing module is configured to:
  • the execution of the task chain including one unexecuted task includes more than two unexecuted tasks.
  • the task chain of the task is determined based on the resource status information that the current resources of the server are insufficient. If it is determined based on the resource status information that the current resources of the server are insufficient, then according to the historical record of the execution time of each task and the resource status information, the execution of the task chain including one unexecuted task includes more than two unexecuted tasks. The task chain of the task.
  • the processing module is used to:
  • the multiple threads include scheduling threads
  • the initial execution time of each serial task and each task chain is the same.
  • the server in the embodiment of the present application is introduced separately from the perspective of modular functional entities above.
  • the following introduces a server from the perspective of hardware, as shown in FIG. 7, which includes: a processor, a memory, a transceiver (also an input/output Unit, not identified in FIG. 7) and a computer program stored in the memory and running on the processor.
  • the computer program may be a program corresponding to the method of scheduling application tasks based on big data behavior in the embodiment corresponding to FIG. 1.
  • the server implements the function of the server as shown in FIG. 6, when the processor executes the computer program, it can implement the scheduling of application tasks based on big data behavior executed by the server in the embodiment corresponding to FIG.
  • the computer program may be a program corresponding to the method of scheduling application tasks based on big data behavior in the embodiment corresponding to FIG. 1.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请公开了一种基于大数据行为调度应用任务的方法、服务器及存储介质,该方法包括:采集服务器当前的资源状态信息,若根据资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用多个线程并发执行多个任务,所述多个任务相互之间不存在依赖关系;依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关系;根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。能够提升任务的执行效率,以及减少任务未执行完带来的业务影响。

Description

基于大数据行为调度应用任务的方法、服务器及存储介质
本申请要求于2019-01-25提交中国专利局、申请号为201910070469.5、发明名称为“基于大数据行为调度应用任务的方法、服务器及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及大数据处理技术领域,特别涉及一种基于大数据行为调度应用任务的方法、服务器及存储介质。
背景技术
在设置业务流程中,需要对业务流程中的各流程节点(即任务程序)分别进行设置。例如,任务程序都是通过定时进行调度的,比如某个任务需要0点开始,预估执行30分钟,然后如果另一个程序依赖这个任务时,则选择0点40分开始执行,按照依赖关系进行串联执行,人为的安排各个任务的定时执行时间。
但是,发明人发现,流程节点较多(即任务较多)时,如果继续采用这种方式,由于各流程节点之间存在严重依赖前后流程节点的串行关系,如果对某个定时任务的执行时间估计不够准确的话,则会导致执行完整个业务流程需要非常长的时间,甚至导致第二天可能需要的报表或数据无法完成,严重影响工作流程。
发明内容
本申请的主要目的在于解决现有机制中各流程节点之间存在严重依赖前后流程节点的串行关系所存在的业务流程执行时间较长的问题。
第一方面,本申请提供了一种基于大数据行为调度应用任务的方法,所述方法由服务器执行,所述服务器部署多个任务,所述方法包括:
采集服务器当前的资源状态信息,所述资源状态信息包括处理器、内存和存储器的使用率;
若根据所述资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用所述多个线程并发执行多个任务,所述多个任务相互之间不存在依赖关系;所述依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关 系;
根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。
在一些可能的设计中,所述方法还包括:
按照依赖关系将所述多个任务分割为至少一个串行任务和至少一个任务链,所述串行任务是指与所述多个任务中的任一任务之间不存在依赖关系的任务,每个所述任务链是指一段具有依赖关系的多个任务,串行任务与任务链之间不存在依赖关系。
在一些可能的设计中,所述多个任务由任务树的方式存储,所述任务树包括多个节点;当所述多个任务包括至少两个任务链时,所述根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,包括:
对所述任务树中各节点的执行状态进行监控,采用异步方式判断所述任务树中各节点的执行状态;
当正在执行的任务中的第一任务完成后,为所述第一任务设置标识符,对应更新所述第一任务在任务树中的节点状态;
根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
在一些可能的设计中,当所述多个任务包括至少两个任务链时,所述根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的顺序,包括:
若根据所述资源状态信息确定所述服务器当前的资源不足,则根据各个任务的执行时长的历史记录及所述资源状态信息,先于包含一个未执行任务的任务链执行包含两个以上未执行任务的任务链。
在一些可能的设计中,所述方法还包括:
设置所述多个线程的任务最大数量、任务最小数量和线程的最长空闲时间;所述多个线程包括调度线程;
所述调用所述多个线程并发执行多个任务,包括:
启动所述多个线程执行任务,当存在当前执行的任务量趋近于所述任务最 大数量的线程,或存在当前执行的任务量趋于所述任务最小数量的线程,或存在空闲的线程时,调用所述调度线程根据当前执行的任务量和带执行的任务量动态调整各线程的任务数量;
执行所述任务链中的一个任务后,顺序执行所述任务链中的顺序排列的下一个任务。
在一些可能的设计中,每个所述串行任务、以及每个所述任务链的起始执行时间相同。
在一些可能的设计中,所述对应更新所述第一任务在任务树中的节点状态,包括:
调用处理任务的程判断所述第一任务的下一跳任务字段是否为空;
若不为空,则使用所述下一跳任务的任务名称替换当前任务名称,更新所述第一任务在任务树中的节点的标识符为has_next,并将任务对象插入所述下一跳任务对应的任务队列;
若所述下一跳任务字段为空,则将所述第一任务在任务树中的节点的标识符更新为done。
在一些可能的设计中,所述采集服务器当前的资源状态信息,包括:
通过挂钩hook程序监听处理器、内存和存储器的使用率;
当通过所述hook程序监听到所述处理器、内存和存储器的使用率发生变化时,以固定或动态调整的频率采集所述服务器当前的资源状态信息。
本申请第二方面提供一种服务器,所述服务器部署多个任务,所述服务器具有实现对应于上述第一方面提供的基于大数据行为调度应用任务的方法的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块,所述模块可以是软件和/或硬件。
一种可能的设计中,所述服务器包括:
获取模块,用于采集服务器当前的资源状态信息,所述资源状态信息包括处理器、内存和存储器的使用率;
处理模块,用于若根据所述资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用所述多个线程并发执行多个任务,所述多个任务相 互之间不存在依赖关系;所述依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关系;
所述处理模块还用于根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。
一种可能的设计中,所述处理模块还用于:
按照依赖关系将所述多个任务分割为至少一个串行任务和至少一个任务链,所述串行任务是指与所述多个任务中的任一任务之间不存在依赖关系的任务,每个所述任务链是指一段具有依赖关系的多个任务,串行任务与任务链之间不存在依赖关系。
一种可能的设计中,当所述多个任务包括至少两个任务链时,所述处理模块用于:
根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
在一些可能的设计中,当所述多个任务包括至少两个任务链时,所述处理模块用于:
若根据所述资源状态信息确定所述服务器当前的资源不足,则根据各个任务的执行时长的历史记录及所述资源状态信息,先于包含一个未执行任务的任务链执行包含两个以上未执行任务的任务链。
在一些可能的设计中,所述处理模块用于:
设置所述多个线程的任务最大数量、任务最小数量和线程的最长空闲时间;所述多个线程包括调度线程;
启动所述多个线程执行任务,当存在当前执行的任务量趋近于所述任务最大数量的线程,或存在当前执行的任务量趋于所述任务最小数量的线程,或存在空闲的线程时,调用所述调度线程根据当前执行的任务量和带执行的任务量动态调整各线程的任务数量;
执行所述任务链中的一个任务后,顺序执行所述任务链中的顺序排列的下一个任务。
在一些可能的设计中,每个所述串行任务、以及每个所述任务链的起始执 行时间相同。
本申请又一方面提供了一种服务器,其包括:
至少一个连接的处理模块、存储器和收发器,其中,所述存储器用于存储程序代码,所述处理模块用于调用所述存储器中的程序代码来执行以下操作:
采集服务器当前的资源状态信息,所述资源状态信息包括处理器、内存和存储器的使用率;
若根据所述资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用所述多个线程并发执行多个任务,所述多个任务相互之间不存在依赖关系;所述依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关系;
根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕;
当所述多个任务包括至少两个任务链时,所述处理模块用于执行以下操作:
根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
在一些可能的设计中,所述处理器还用于执行以下操作:
按照依赖关系将所述多个任务分割为至少一个串行任务和至少一个任务链,所述串行任务是指与所述多个任务中的任一任务之间不存在依赖关系的任务,每个所述任务链是指一段具有依赖关系的多个任务,串行任务与任务链之间不存在依赖关系。
在一些可能的设计中,当所述多个任务包括至少两个任务链时,所述处理器用于执行以下操作:
根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
在一些可能的设计中,当所述多个任务包括至少两个任务链时,所述处理器用于执行以下操作:
若根据所述资源状态信息确定所述服务器当前的资源不足,则根据各个任务的执行时长的历史记录及所述资源状态信息,先于包含一个未执行任务的任务链执行包含两个以上未执行任务的任务链。
在一些可能的设计中,所述处理器用于执行以下操作:
设置所述多个线程的任务最大数量、任务最小数量和线程的最长空闲时间;所述多个线程包括调度线程;
启动所述多个线程执行任务,当存在当前执行的任务量趋近于所述任务最大数量的线程,或存在当前执行的任务量趋于所述任务最小数量的线程,或存在空闲的线程时,调用所述调度线程根据当前执行的任务量和带执行的任务量动态调整各线程的任务数量;
执行所述任务链中的一个任务后,顺序执行所述任务链中的顺序排列的下一个任务。
在一些可能的设计中,每个所述串行任务、以及每个所述任务链的起始执行时间相同。
在一些可能的设计中,所述处理器具体用于执行以下操作:
调用处理任务的程判断所述第一任务的下一跳任务字段是否为空;
若不为空,则使用所述下一跳任务的任务名称替换当前任务名称,更新所述第一任务在任务树中的节点的标识符为has_next,并将任务对象插入所述下一跳任务对应的任务队列;
若所述下一跳任务字段为空,则将所述第一任务在任务树中的节点的标识符更新为done。
本申请又一方面提供了一种非易失性计算机存储介质,其包括指令,当其在计算机上运行时,使得计算机执行上述各方面所述的方法。
与现有机制相比,本申请中,根据采集的资源状态信息确定所述服务器当前的资源充足时启动多个线程,调用多个线程并发执行多个任务。由于这多个任务相互之间不存在依赖关系,通过并行没有依赖关系的任务,实现从局部缩短没有依赖关系的任务之间的处理时间,故能够提升任务的执行效率。此外,根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执 行完毕。通过实时调度,能够提升任务的执行效率以及减少任务未执行完带来的业务影响。
附图说明
图1为本申请实施例中基于大数据行为调度应用任务的方法的一种流程示意图;
图2为本申请实施例中任务队列的一种示意图;
图3为本申请实施例中任务执行时间的一种示意图;
图4为本申请实施例中任务队列的另一种示意图;
图5为本申请实施例中任务执行时间的另一种示意图;
图6为本申请实施例中服务器的一种结构示意图;
图7为本申请实施例中服务器的另一种结构示意图。
具体实施方式
下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能解释为对本发明的限制。
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本发明的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作。
本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本发明所属领域中的普通技术人员的一般理解相同的意义。还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非像这里一样被特定定义,否则不会用理想化或过于正式的含义来解释。
本领域技术人员应当理解,本发明所称的“应用”、“应用程序”、“应用软件”以及类似表述的概念,是业内技术人员所公知的相同概念,是指由一系列计算机指令及相关数据资源有机构造的适于电子运行的计算机软件。除非特别指定,这种命名本身不受编程语言种类、级别,也不受其赖以运行的操作系 统或平台所限制。理所当然地,此类概念也不受任何形式的终端所限制。
本领域技术人员应当理解,本发明所称的“应用”、“应用程序”、“应用软件”以及类似表述的概念,是业内技术人员所公知的相同概念,是指由一系列计算机指令及相关数据资源有机构造的适于电子运行的计算机软件。除非特别指定,这种命名本身不受编程语言种类、级别,也不受其赖以运行的操作系统或平台所限制。理所当然地,此类概念也不受任何形式的终端所限制。
本申请提供一种基于大数据行为调度应用任务的方法、服务器及存储介质,可用于任务调度,能够解决现有机制中各流程节点之间存在严重依赖前后流程节点的串行关系所存在的业务流程执行时间较长的问题。
现有机制中在针对具有串行依赖关系的多个任务是无法并行的,显然现有机制是所有任务为串行执行的。为解决上述技术问题,本申请主要提供以下技术方案:
将一连串的串行任务分割为至少一个串行任务和至少一个并行的任务链,每一条任务链都可以看作“一段具有依赖关系的多个任务”。从局部来看,各无依赖性的串行任务、至少一条任务链之间并行执行,每条任务链之间不存在依赖关系,即没有依赖的任务可以并行执行,充分利用服务器资源。通过并行没有依赖关系的任务,实现从局部缩短没有依赖关系的任务之间的处理时间,能够提升任务的执行效率,减少任务未执行完带来的业务影响。
参照图1,以下对本申请提供一种基于大数据行为调度应用任务的方法进行举例说明,所述方法由服务器执行所述服务器部署多个任务,所述方法包括:
101、采集服务器当前的资源状态信息,所述资源状态信息包括处理器、内存和存储器的使用率。
一些实施方式中,可以以固定或动态调整的频率(例如5s)去采集服务器当前的资源状态信息,在不影响服务器的性能的同时,还能保证当前依据的各类使用情况不会影响到服务器当前并发执行任务的和鲁棒性和时效性。
一些实施方式中,采集这些使用情况,可以通过挂钩(hook)机制监听处理器、内存和存储器的使用率。其中,hook是Windows消息处理机制的一个很重要的内容,应用程序可以通过hook机制截获处理Window消息或是其他一些特定事件。当事件发生时,应用程序可以在相应的hook上设置多个hook子程序(多个hook子程可对任务执行状态进行监控),由其组成一个与hook 相关联的指向hook函数的指针列表(例如hook链表,该hook链表表示任务队列,确定该任务队列能够确定任务的执行顺序)。当hook所监视的消息出现时,系统将该监听到的消息送到调用链表中所指向的第一个hook函数中(例如任务队列中的第一个任务),钩子函数将根据其各自的功能对消息进行监视、修改和控制,并在处理完成后把消息传递给下一个hook函数直至到达hook链表的末尾。在hook函数交出控制权后,被拦截的消息最终仍将交还给窗口处理函数。
102、若根据所述资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用所述多个线程并发执行多个任务。
其中,所述多个任务相互之间不存在依赖关系。
一些实施方式中,所述依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关系。
例如,依赖关系可包括上游依赖关系和下游依赖关系,任务之间的依赖关系可渲染到任务树表示,任务树能够表示所有任务之间的局部关系、全局关系和任务节点的节点状态。其中,节点状态包括:正在运行、运行成功、运行失败,本申请不对任务节点和节点作区分,节点即表示任务。可见,通过任务树的方式能够便于统一管理或查看所部署的任务。举例来说,在任务树中,以任务节点6为起点,分别向所述任务节点6的上游和下游递归搜索,搜索任务节点6的上游依赖节点和下游依赖节点。任务节点6的上游依赖为:任务节点6依赖任务节点3和任务节点4,任务节点3依赖任务节点0。任务节点6的下游依赖为:任务节点6依赖任务节点8和任务节点9,任务节点8依赖任务节点12。
103、根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。
一些实施方式中,本申请中的遍历是指遍历一个完整的任务流程中的每个任务,直至所有任务执行完,只需要执行一遍完整的任务流程即可,无需循环。
本申请实施例中,根据采集的资源状态信息确定所述服务器当前的资源充足时启动多个线程,调用多个线程并发执行多个任务。由于这多个任务相互之 间不存在依赖关系,通过并行没有依赖关系的任务,实现从局部缩短没有依赖关系的任务之间的处理时间,故能够提升任务的执行效率。此外,根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。通过实时调度,能够提升任务的执行效率以及减少任务未执行完带来的业务影响。
可选的,在本申请的一些实施例中,所述方法还包括:
按照依赖关系将所述多个任务分割为至少一个串行任务和至少一个任务链,所述串行任务是指与所述多个任务中的任一任务之间不存在依赖关系的任务,每个所述任务链是指一段具有依赖关系的多个任务,串行任务与任务链之间不存在依赖关系。
可选的,在本申请的一些实施例中,所述多个任务由任务树的方式存储,所述任务树包括多个节点;当所述多个任务包括至少两个任务链时,所述根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,包括:
对所述任务树中各节点的执行状态进行监控,采用异步方式判断所述任务树中各节点的执行状态;
当正在执行的任务中的第一任务完成后,为所述第一任务设置标识符,对应更新所述第一任务在任务树中的节点状态;
根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
举例来说,如图2所示的一种任务队列示意图,任务队列包括任务1、任务2、…任务20。其中,任务1、任务2和任务3组成任务链1,任务6、任务7…任务12组成任务链2。基于图2所示的任务队列,启动线程后,在t1时刻并发执行图2所示的任务队列中的任务(如图3所示)。其中,并发执行的多个相互之间没有依赖关系的任务队列中包括任务1和任务4,该任务1与任务队列中的其它任务(即任务链1中的任务2和任务3)之间存在依赖关系,任务4的执行不会对其他任务(即途2所示的任务队列中除任务4之外的任务)带来触发,也与其它任务没有依赖关系,所以任务1这类的优先级是要高于任务4这类的。因此,并发执行任务队列中的任务时,会先执行任务1这类的任 务。
一些实施方式中,还可以采用哈希(hash)表的方式来处理任务,所述对应更新所述第一任务在任务树中的节点状态,包括:
调用处理任务的程判断所述第一任务的下一跳任务字段是否为空,若不为空,则使用所述下一跳任务的任务名称替换当前任务名称,更新所述第一任务在任务树中的节点的标识符为has_next,并将任务对象插入所述下一跳任务对应的任务队列;若所述下一跳任务字段为空,则将所述第一任务在任务树中的节点的标识符更新为done。
可选的,在本申请的一些实施例中,当所述多个任务包括至少两个任务链时,所述根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的顺序,包括:
若根据所述资源状态信息确定所述服务器当前的资源不足,则根据各个任务的执行时长的历史记录及所述资源状态信息,先于包含一个未执行任务的任务链执行包含两个以上未执行任务的任务链。
举例来说,并发执行这些相互无依赖关系的任务时,针对任务队列的每个任务可以看作一段任务链,其中,每条任务链可以是有依赖关系的多个任务。也就是说,每条任务链的起始执行时间都是相同的,那本发明的“优先执行有依赖的任务”又是指优先执行具有多个任务的任务链,如果cpu资源足够,那么可以同时执行一个任务的任务链,即在执行“具有多个任务的任务链”的同时,可以并行执行“仅具有一个任务的任务链”。如果cpu资源不足,则优先执行有依赖关系的任务链。
如图4和图5所示,待图2和图3所示的任务启动一段时间后,到达图4所示的t2时刻的任务队列。此时检测到任务链1中只存在一个未执行的任务,且当前服务器的资源不足,那么,为了合理的使用服务器的资源,可以将除任务链2之外的其他任务全部延迟或者暂停,或者将任务链1总的任务3的执行时间延迟到t3。如果当前服务器的资源充足,那么,在执行任务链2中剩余的任务的同时,还可以并行执行任务链2之外的其他任务。
可选的,在本申请的一些实施例中,所述调用所述多个线程并发执行多个任务之前,所述方法还包括:
设置所述多个线程的任务最大数量、任务最小数量和线程的最长空闲时 间;所述多个线程包括调度线程;
相应的,所述调用所述多个线程并发执行多个任务,包括:
启动所述多个线程执行任务,当存在当前执行的任务量趋近于所述任务最大数量的线程,或存在当前执行的任务量趋于所述任务最小数量的线程,或存在空闲的线程时,调用所述调度线程根据当前执行的任务量和带执行的任务量动态调整各线程的任务数量;
执行所述任务链中的一个任务后,顺序执行所述任务链中的顺序排列的下一个任务。
举例来说,并发执行的多个相互之间没有依赖关系的任务队列中包括任务1、任务2和任务3,任务1、任务2和任务3三者属于同一个任务链且相互之间存在依赖关系,任务2的执行会对触发任务3。所以,当任务2的优先级是要高于任务3。因此,并发执行任务队列中的任务时,会依次执行任务1、任务2和任务3。
可选的,在本申请的一些实施例中,每个所述串行任务、以及每个所述任务链的起始执行时间相同。
上述实施例中所提及的各项技术特征也同样适用于本申请中的图6和图7所对应的实施例,后续类似之处不再赘述。
以上对本申请中一种基于大数据行为调度应用任务的方法进行说明,以下对执行上述基于大数据行为调度应用任务的方法的服务器进行描述。
如图6所示的一种服务器的结构示意图,本申请实施例中的服务器能够实现对应于上述图1所对应的实施例中所执行的基于大数据行为调度应用任务的方法的步骤。服务器实现的功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块,所述模块可以是软件和/或硬件。所述服务器可包括获取模块和处理模块,所述处理模块和获取模块的功能实现可参考图1所对应的实施例中所执行的操作,此处不作赘述。处理模块可用于控制所述获取模块的收发操作。所述服务器部署多个任务,所述服务器具有实现对应于上述图1-图5所对应的实施例中提供的基于大数据行为调度应用任务的方法的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块,所述模块可以是软件和/或硬件。
一些实施方式中,所述获取模块可用于采集服务器当前的资源状态信息,所述资源状态信息包括处理器、内存和存储器的使用率。
所述处理模块可用于若根据所述资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用所述多个线程并发执行多个任务,所述多个任务相互之间不存在依赖关系;所述依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关系。
所述处理模块还用于根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。
本申请实施例中,所述处理模块根据所述获取模块采集的资源状态信息确定所述服务器当前的资源充足时启动多个线程,调用多个线程并发执行多个任务。由于这多个任务相互之间不存在依赖关系,通过并行没有依赖关系的任务,实现从局部缩短没有依赖关系的任务之间的处理时间,故能够提升任务的执行效率。此外,根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。通过实时调度,能够提升任务的执行效率以及减少任务未执行完带来的业务影响。
可选的,在本申请的一些实施例中,所述处理模块还用于:
按照依赖关系将所述多个任务分割为至少一个串行任务和至少一个任务链,所述串行任务是指与所述多个任务中的任一任务之间不存在依赖关系的任务,每个所述任务链是指一段具有依赖关系的多个任务,串行任务与任务链之间不存在依赖关系。
可选的,在本申请的一些实施例中,当所述多个任务包括至少两个任务链时,所述处理模块用于:
根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
可选的,在本申请的一些实施例中,当所述多个任务包括至少两个任务链时,所述处理模块用于:
若根据所述资源状态信息确定所述服务器当前的资源不足,则根据各个任 务的执行时长的历史记录及所述资源状态信息,先于包含一个未执行任务的任务链执行包含两个以上未执行任务的任务链。
可选的,在本申请的一些实施例中,所述处理模块用于:
设置所述多个线程的任务最大数量、任务最小数量和线程的最长空闲时间;所述多个线程包括调度线程;
启动所述多个线程执行任务,当存在当前执行的任务量趋近于所述任务最大数量的线程,或存在当前执行的任务量趋于所述任务最小数量的线程,或存在空闲的线程时,调用所述调度线程根据当前执行的任务量和带执行的任务量动态调整各线程的任务数量;
执行所述任务链中的一个任务后,顺序执行所述任务链中的顺序排列的下一个任务。
可选的,在本申请的一些实施例中,每个所述串行任务、以及每个所述任务链的起始执行时间相同。
上面从模块化功能实体的角度分别介绍了本申请实施例中的服务器,以下从硬件角度介绍一种服务器,如图7所示,其包括:处理器、存储器、收发器(也可以是输入输出单元,图7中未标识出)以及存储在所述存储器中并可在所述处理器上运行的计算机程序。例如,该计算机程序可以为图1所对应的实施例中基于大数据行为调度应用任务的方法对应的程序。例如,当服务器实现如图6所示的服务器的功能时,所述处理器执行所述计算机程序时,能够实现上述图6所对应的实施例中由服务器执行的基于大数据行为调度应用任务的方法中的各步骤;或者,所述处理器执行所述计算机程序时实现上述图6所对应的实施例的服务器中处理模块的功能。又例如,该计算机程序可以为图1所对应的实施例中基于大数据行为调度应用任务的方法对应的程序。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器或者网络设备等)执行本申请各个实施例所述的方法。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,这些均属于本申请的保护之内。

Claims (20)

  1. 一种基于大数据行为调度应用任务的方法,所述方法由服务器执行,所述服务器部署多个任务,所述方法包括:
    采集服务器当前的资源状态信息,所述资源状态信息包括处理器、内存和存储器的使用率;
    若根据所述资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用所述多个线程并发执行多个任务,所述多个任务相互之间不存在依赖关系;所述依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关系;
    根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。
  2. 根据权利要求1所述的方法,所述方法还包括:
    按照依赖关系将所述多个任务分割为至少一个串行任务和至少一个任务链,所述串行任务是指与所述多个任务中的任一任务之间不存在依赖关系的任务,每个所述任务链是指一段具有依赖关系的多个任务,串行任务与任务链之间不存在依赖关系。
  3. 根据权利要求2所述的方法,所述多个任务由任务树的方式存储,所述任务树包括多个节点;当所述多个任务包括至少两个任务链时,所述根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,包括:
    对所述任务树中各节点的执行状态进行监控,采用异步方式判断所述任务树中各节点的执行状态;
    当正在执行的任务中的第一任务完成后,为所述第一任务设置标识符,对应更新所述第一任务在任务树中的节点状态;
    根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
  4. 根据权利要求2所述的方法,当所述多个任务包括至少两个任务链时,所述根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有 依赖关系的任务之间的顺序,包括:
    若根据所述资源状态信息确定所述服务器当前的资源不足,则根据各个任务的执行时长的历史记录及所述资源状态信息,先于包含一个未执行任务的任务链执行包含两个以上未执行任务的任务链。
  5. 根据权利要求2-4中任一项所述的方法,所述调用所述多个线程并发执行多个任务之前,所述方法还包括:
    设置所述多个线程的任务最大数量、任务最小数量和线程的最长空闲时间;所述多个线程包括调度线程;
    所述调用所述多个线程并发执行多个任务,包括:
    启动所述多个线程执行任务,当存在当前执行的任务量趋近于所述任务最大数量的线程,或存在当前执行的任务量趋于所述任务最小数量的线程,或存在空闲的线程时,调用所述调度线程根据当前执行的任务量和带执行的任务量动态调整各线程的任务数量;
    执行所述任务链中的一个任务后,顺序执行所述任务链中的顺序排列的下一个任务。
  6. 根据权利要求2-4中任一项所述的方法,每个所述串行任务、以及每个所述任务链的起始执行时间相同。
  7. 根据权利要求1-6中任一项所述的方法,,所述对应更新所述第一任务在任务树中的节点状态,包括:
    调用处理任务的程判断所述第一任务的下一跳任务字段是否为空;
    若不为空,则使用所述下一跳任务的任务名称替换当前任务名称,更新所述第一任务在任务树中的节点的标识符为has_next,并将任务对象插入所述下一跳任务对应的任务队列;
    若所述下一跳任务字段为空,则将所述第一任务在任务树中的节点的标识符更新为done。
  8. 一种服务器,所述服务器部署多个任务,所述服务器包括:
    获取模块,用于采集服务器当前的资源状态信息,所述资源状态信息包括处理器、内存和存储器的使用率;
    处理模块,用于若根据所述资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用所述多个线程并发执行多个任务,所述多个任务相 互之间不存在依赖关系;所述依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关系;
    所述处理模块还用于根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕。
  9. 根据权利要求8所述的服务器,所述处理模块还用于:
    按照依赖关系将所述多个任务分割为至少一个串行任务和至少一个任务链,所述串行任务是指与所述多个任务中的任一任务之间不存在依赖关系的任务,每个所述任务链是指一段具有依赖关系的多个任务,串行任务与任务链之间不存在依赖关系。
  10. 根据权利要求9所述的服务器,当所述多个任务包括至少两个任务链时,所述处理模块用于:
    根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
  11. 根据权利要求9所述的服务器,当所述多个任务包括至少两个任务链时,所述处理模块用于:
    若根据所述资源状态信息确定所述服务器当前的资源不足,则根据各个任务的执行时长的历史记录及所述资源状态信息,先于包含一个未执行任务的任务链执行包含两个以上未执行任务的任务链。
  12. 根据权利要求9-11中任一项所述的服务器,所述处理模块用于:
    设置所述多个线程的任务最大数量、任务最小数量和线程的最长空闲时间;所述多个线程包括调度线程;
    启动所述多个线程执行任务,当存在当前执行的任务量趋近于所述任务最大数量的线程,或存在当前执行的任务量趋于所述任务最小数量的线程,或存在空闲的线程时,调用所述调度线程根据当前执行的任务量和带执行的任务量动态调整各线程的任务数量;
    执行所述任务链中的一个任务后,顺序执行所述任务链中的顺序排列的下一个任务。
  13. 一种服务器,所述服务器包括:
    至少一个处理器、存储器和收发器;
    其中,所述存储器用于存储程序代码,所述处理器用于调用所述存储器中存储的程序代码来执行以下操作:
    采集服务器当前的资源状态信息,所述资源状态信息包括处理器、内存和存储器的使用率;
    若根据所述资源状态信息确定所述服务器当前的资源充足,则启动多个线程,调用所述多个线程并发执行多个任务,所述多个任务相互之间不存在依赖关系;所述依赖关系至少包括以下项之一:任务的执行顺序存在先后顺序、同时并行触发的依赖关系、以及一个任务的执行依赖在先任务已执行完成的关系;
    根据各个任务的执行时长的历史记录及所述资源状态信息,实时调度没有依赖关系的任务之间的执行顺序,遍历所述多个任务中的所有任务直至所有任务执行完毕;
    当所述多个任务包括至少两个任务链时,所述处理模块用于:
    根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
  14. 根据权利要求13所述的服务器,所述处理器还用于执行以下操作:
    按照依赖关系将所述多个任务分割为至少一个串行任务和至少一个任务链,所述串行任务是指与所述多个任务中的任一任务之间不存在依赖关系的任务,每个所述任务链是指一段具有依赖关系的多个任务,串行任务与任务链之间不存在依赖关系。
  15. 根据权利要求14所述的服务器,当所述多个任务包括至少两个任务链时,所述处理器用于执行以下操作:
    根据各个任务的执行时长的历史记录及所述资源状态信息,先于串行任务执行任务链中的任务,串行任务的优先级低于任务链的优先级。
  16. 根据权利要求14所述的服务器,当所述多个任务包括至少两个任务链时,所述处理器用于执行以下操作:
    若根据所述资源状态信息确定所述服务器当前的资源不足,则根据各个任务的执行时长的历史记录及所述资源状态信息,先于包含一个未执行任务的任务链执行包含两个以上未执行任务的任务链。
  17. 根据权利要求14-16中任一项所述的服务器,所述处理器用于执行以下操作:
    设置所述多个线程的任务最大数量、任务最小数量和线程的最长空闲时间;所述多个线程包括调度线程;
    启动所述多个线程执行任务,当存在当前执行的任务量趋近于所述任务最大数量的线程,或存在当前执行的任务量趋于所述任务最小数量的线程,或存在空闲的线程时,调用所述调度线程根据当前执行的任务量和带执行的任务量动态调整各线程的任务数量;
    执行所述任务链中的一个任务后,顺序执行所述任务链中的顺序排列的下一个任务。
  18. 根据权利要求14-16中任一项所述的服务器,每个所述串行任务、以及每个所述任务链的起始执行时间相同。
  19. 根据权利要求14-16中任一项所述的服务器,所述处理器具体用于执行以下操作:
    调用处理任务的程判断所述第一任务的下一跳任务字段是否为空;
    若不为空,则使用所述下一跳任务的任务名称替换当前任务名称,更新所述第一任务在任务树中的节点的标识符为has_next,并将任务对象插入所述下一跳任务对应的任务队列;
    若所述下一跳任务字段为空,则将所述第一任务在任务树中的节点的标识符更新为done。
  20. 一种非易失性计算机存储介质,其包括指令,当其在计算机上运行时,使得计算机执行如权利要求1-7中任一项所述的方法。
PCT/CN2019/092669 2019-01-25 2019-06-25 基于大数据行为调度应用任务的方法、服务器及存储介质 WO2020151177A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910070469.5A CN109901926A (zh) 2019-01-25 2019-01-25 基于大数据行为调度应用任务的方法、服务器及存储介质
CN201910070469.5 2019-01-25

Publications (1)

Publication Number Publication Date
WO2020151177A1 true WO2020151177A1 (zh) 2020-07-30

Family

ID=66944222

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/092669 WO2020151177A1 (zh) 2019-01-25 2019-06-25 基于大数据行为调度应用任务的方法、服务器及存储介质

Country Status (2)

Country Link
CN (1) CN109901926A (zh)
WO (1) WO2020151177A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112235396A (zh) * 2020-10-13 2021-01-15 腾讯科技(深圳)有限公司 内容处理链路调整方法、装置、计算机设备和存储介质
CN114116066A (zh) * 2021-11-30 2022-03-01 湖南麒麟信安科技股份有限公司 一种云平台集群控制方法、系统及存储介质

Families Citing this family (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109901926A (zh) * 2019-01-25 2019-06-18 平安科技(深圳)有限公司 基于大数据行为调度应用任务的方法、服务器及存储介质
CN110502294B (zh) * 2019-07-20 2021-08-20 华为技术有限公司 数据处理的方法、装置及电子设备
CN111190725A (zh) * 2019-08-09 2020-05-22 腾讯科技(深圳)有限公司 任务处理方法、装置、存储介质及服务器
CN110569118A (zh) * 2019-08-29 2019-12-13 贝壳技术有限公司 任务调度方法、装置、电子设备及存储介质
CN110716943B (zh) * 2019-09-06 2023-10-27 中国平安财产保险股份有限公司 缺失数据补录方法、装置、计算机设备及存储介质
CN110704170A (zh) * 2019-09-09 2020-01-17 深圳壹账通智能科技有限公司 批量任务处理方法、装置、计算机设备和存储介质
CN110673939B (zh) * 2019-09-23 2021-12-28 汉纳森(厦门)数据股份有限公司 一种基于airflow和yarn的任务调度方法、装置及介质
CN112748961A (zh) * 2019-10-30 2021-05-04 腾讯科技(深圳)有限公司 启动任务的执行方法和装置
CN112748993A (zh) * 2019-10-31 2021-05-04 北京国双科技有限公司 任务执行方法、装置、存储介质及电子设备
CN110825391B (zh) * 2019-10-31 2023-10-13 北京金山云网络技术有限公司 服务管理方法、装置、电子设备及存储介质
CN112783634B (zh) * 2019-11-06 2022-04-26 长鑫存储技术有限公司 任务处理系统、方法及计算机可读存储介质
US11573823B2 (en) * 2019-11-18 2023-02-07 International Business Machines Corporation Parallel execution of applications
CN111258740A (zh) * 2020-02-03 2020-06-09 北京无限光场科技有限公司 一种用于启动应用程序的方法、装置和电子设备
CN111866013B (zh) * 2020-07-29 2023-04-18 杭州安恒信息技术股份有限公司 一种云安全产品管理平台部署方法、装置、设备及介质
CN111966477A (zh) * 2020-08-18 2020-11-20 浙江知水信息技术有限公司 一种在多个服务器环境下预警任务分配的方法
CN112463397B (zh) * 2020-12-10 2023-02-10 中国科学院深圳先进技术研究院 lock-free的分布式死锁避免方法及装置、计算机设备及可读存储介质
CN112783622A (zh) * 2021-01-13 2021-05-11 上海百胜软件股份有限公司 一种基于jira系统的任务管理方法、系统、设备和存储介质
CN113760529A (zh) * 2021-01-15 2021-12-07 北京沃东天骏信息技术有限公司 接口执行方法、装置、设备和可读存储介质
CN113031870A (zh) * 2021-03-26 2021-06-25 山东英信计算机技术有限公司 一种集群系统动态管理方法、装置、存储介质及设备
CN112988362B (zh) * 2021-05-14 2022-12-30 南京蓝洋智能科技有限公司 一种任务处理方法、装置、电子设备及存储介质
CN113283983A (zh) * 2021-06-11 2021-08-20 中国农业银行股份有限公司 业务处理方法、装置及设备
CN113694536A (zh) * 2021-09-07 2021-11-26 北京蔚领时代科技有限公司 一种面向云游戏的场景管理方法、装置、设备及介质
CN113885956B (zh) * 2021-09-29 2023-08-29 北京百度网讯科技有限公司 服务部署方法及装置、电子设备和存储介质
CN114116068B (zh) * 2021-12-02 2023-06-02 重庆紫光华山智安科技有限公司 服务启动优化方法、装置、电子设备和可读存储介质
CN117411876A (zh) * 2022-07-08 2024-01-16 中国电信股份有限公司 云资源池的服务控制方法、控制器及服务系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103207810A (zh) * 2011-11-09 2013-07-17 辉达公司 计算任务状态封装
US8990820B2 (en) * 2008-12-19 2015-03-24 Microsoft Corporation Runtime task with inherited dependencies for batch processing
CN108804240A (zh) * 2018-04-25 2018-11-13 天津卓易云科技有限公司 一种队列数据的分发和处理算法
CN109901926A (zh) * 2019-01-25 2019-06-18 平安科技(深圳)有限公司 基于大数据行为调度应用任务的方法、服务器及存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467532A (zh) * 2010-11-12 2012-05-23 中国移动通信集团山东有限公司 一种任务处理方法以及任务处理装置
JP6241144B2 (ja) * 2013-08-30 2017-12-06 富士通株式会社 制御プログラム、制御方法および制御装置
CN105589748A (zh) * 2014-10-22 2016-05-18 阿里巴巴集团控股有限公司 一种业务请求处理方法及装置
CN106325984B (zh) * 2015-06-30 2020-04-07 上海喜马拉雅科技有限公司 一种大数据任务调度装置
CN108733464B (zh) * 2017-04-18 2021-09-14 华为技术有限公司 一种确定计算任务的调度方案的方法及装置
CN108920261B (zh) * 2018-05-23 2020-03-24 中国航天系统科学与工程研究院 一种适于大规模并行数据处理任务的两级自适应调度方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8990820B2 (en) * 2008-12-19 2015-03-24 Microsoft Corporation Runtime task with inherited dependencies for batch processing
CN103207810A (zh) * 2011-11-09 2013-07-17 辉达公司 计算任务状态封装
CN108804240A (zh) * 2018-04-25 2018-11-13 天津卓易云科技有限公司 一种队列数据的分发和处理算法
CN109901926A (zh) * 2019-01-25 2019-06-18 平安科技(深圳)有限公司 基于大数据行为调度应用任务的方法、服务器及存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112235396A (zh) * 2020-10-13 2021-01-15 腾讯科技(深圳)有限公司 内容处理链路调整方法、装置、计算机设备和存储介质
CN112235396B (zh) * 2020-10-13 2022-03-01 腾讯科技(深圳)有限公司 内容处理链路调整方法、装置、计算机设备和存储介质
CN114116066A (zh) * 2021-11-30 2022-03-01 湖南麒麟信安科技股份有限公司 一种云平台集群控制方法、系统及存储介质
CN114116066B (zh) * 2021-11-30 2024-05-07 湖南麒麟信安科技股份有限公司 一种云平台集群控制方法、系统及存储介质

Also Published As

Publication number Publication date
CN109901926A (zh) 2019-06-18

Similar Documents

Publication Publication Date Title
WO2020151177A1 (zh) 基于大数据行为调度应用任务的方法、服务器及存储介质
Babcock et al. Operator scheduling in data stream systems
CN106802826B (zh) 一种基于线程池的业务处理方法及装置
US10659316B1 (en) State machine controlled dynamic distributed computing
US11190618B2 (en) Scheduling method, scheduler, storage medium, and system
EP1623319B1 (en) Monitoring operational data in data processing systems
US20050015773A1 (en) Monitoring operational data in data processing systems
Meng et al. State monitoring in cloud datacenters
CN110647387B (zh) 一种教育云大数据任务调度方法与系统
CN110489217A (zh) 一种任务调度方法及系统
Wu et al. Zeno: Diagnosing performance problems with temporal provenance
US10498817B1 (en) Performance tuning in distributed computing systems
CN110233802A (zh) 一种构建一主链多侧链的区块链架构的方法
CN106325984A (zh) 一种大数据任务调度装置
Petrov et al. Adaptive performance model for dynamic scaling Apache Spark Streaming
CN112181621A (zh) 一种任务调度系统、方法、设备及存储介质
Mencagli et al. Parallel continuous preference queries over out-of-order and bursty data streams
Iannaccone Fast prototyping of network data mining applications
CN100525211C (zh) 一种在网元管理系统中实现集中调度的系统
CN112365239A (zh) 一种基于事件的云服务管理处置方法及系统
CN107621975B (zh) 基于java timer高可用性的定时器逻辑实现方法
Safaei et al. Dispatching stream operators in parallel execution of continuous queries
CN111382199A (zh) 一种数据库同步复制的方法和装置
Kumar et al. An algorithm for online reconfiguration of resource reservations for hard real-time systems
US20240168828A1 (en) Adaptively optimizing function call performance

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: 19911602

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: 19911602

Country of ref document: EP

Kind code of ref document: A1