CN103761148A - Control method for cluster timing scheduling tasks - Google Patents

Control method for cluster timing scheduling tasks Download PDF

Info

Publication number
CN103761148A
CN103761148A CN201410037858.5A CN201410037858A CN103761148A CN 103761148 A CN103761148 A CN 103761148A CN 201410037858 A CN201410037858 A CN 201410037858A CN 103761148 A CN103761148 A CN 103761148A
Authority
CN
China
Prior art keywords
timer
scheduler task
triggered scheduler
task
database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201410037858.5A
Other languages
Chinese (zh)
Other versions
CN103761148B (en
Inventor
张世彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201410037858.5A priority Critical patent/CN103761148B/en
Publication of CN103761148A publication Critical patent/CN103761148A/en
Application granted granted Critical
Publication of CN103761148B publication Critical patent/CN103761148B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Bus Control (AREA)

Abstract

The invention discloses a control method for cluster timing scheduling tasks. According to the control method, the time intervals of executing the tasks are controlled within a certain scope in the task scheduling process, a database only needs to maintain information like scheduling time and locking states of each timing scheduling task, and the timing scheduling tasks are executed without the limitation of nodes. According to the control method, the problem that the timing scheduling tasks are executed repeatedly due to desynchrony of machine time can be avoided, and the control method brings advantages of high concurrency and high stability of a cluster system into full play and can greatly reduce application embeddedness.

Description

The control method of cluster timer-triggered scheduler task
Technical field
The present invention relates to the task scheduling technology of group system, particularly relate to a kind of control method of cluster timer-triggered scheduler task.
Background technology
Along with the development of computer technology, more and more serve and apply and need to be deployed in server cluster, that is to say that an application can be deployed on many machines or a machine is disposed a plurality of same application examples (being called again node).And on the other hand, in application, usually need to carry out timer-triggered scheduler processing, as bank's 1:00 AM every day carries out interest clearing, or electric quotient system system was added up merchandise sales every several hours.
Above two scenes are in conjunction with just occurring such problem: timer-triggered scheduler task (for example can only be carried out once in the scheduling time of an appointment conventionally, interest clearing scheduler task need to be carried out interest clearing at 1:00 AM), but if each application node does not have task locking mechanism, to fixed time point, all can trigger the execution of timer-triggered scheduler task.Task is repeatedly carried out not only wastes performance, but also likely causes error in data.
For the problems referred to above, in group system, adopt at present the control method of following two kinds of timer-triggered scheduler tasks, a kind of is to pass through parameter configuration, only on a node, start timer-triggered scheduler task, another kind is to adopt the own cluster control program of Quartz timer-triggered scheduler service, in this scheme, QUARTZ is for realizing under multinode deployment, the single of timer-triggered scheduler task is carried out, need to be by the java object of program operation, with binary form, be saved in database, database supplies a plurality of nodes to carry out data communication as a data sharing center.The task of QUARTZ (TASK) with the form instantiation of 12 tables (each table function table 1 specific as follows shown in) in database, the QUARTZ of the strategy based on database engine and High-Available (a kind of strategy of cluster) each node of automatic synchronization, when the QUARTZ of an arbitrary node is improper when closing or makeing mistakes, the QUARTZ of another several nodes can start automatically.
Figure BDA0000462216700000011
Figure BDA0000462216700000021
Table 1
Above-mentioned the first timer-triggered scheduler method can only start on a node, and this node need to be disposed personnel and specifically specify; When this single node goes wrong, do not have other node can substitute execution, cannot bring into play the high stability advantage of group system.
Above-mentioned the second timer-triggered scheduler method can guarantee the concurrent and stability of the height of group system with respect to first method, but this scheme has following shortcoming:
1, the control of the colony dispatching of quartz need to create 12 tables in database, larger to application embedding, although powerful, configuration is also quite complicated, and data are with binary storage, can not direct reading understanding check ruuning situation.
If the task of 2 timer-triggered schedulers can be finished in the very short time, in the situation that the asynchronism(-nization) of each machine of cluster step, the problem that can cause timer-triggered scheduler task repeatedly to be carried out.For example, as shown in Figure 1, in subgraph A1,0. 30 minutes mornings, node 1 locking timer-triggered scheduler Mission Success, carried out interest and calculates; In subgraph A2, in 0. 30 minutes and 30 seconds morning, node 1 calculates complete, discharges locking; In subgraph A3, in 0. 31 minutes mornings, node 2 obtains and locks successfully, again carries out interest and calculates; In subgraph A4, in 0. 31 minutes and 30 seconds morning, node 2 calculates complete, discharges locking.Visible, due to the Time Inconsistency of node 1 and node 2, and the execution time of timer-triggered scheduler task very short (only having 30 seconds) causes node 1 when obtaining task lock, and node 2 does not go to compete to obtain to lock and reaches mutual exclusion simultaneously.When node 1 executes task, process and discharge after locking, node 2 has also got task locking, thereby causes the secondary of timer-triggered scheduler task to carry out.
As can be seen here, the control method of existing cluster timer-triggered scheduler task exists and cannot bring into play the high stability advantage of group system or application embedding degree is high, the problems such as repeatedly execution of timer-triggered scheduler task.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of control method of cluster timer-triggered scheduler task, and the method can effectively be avoided the problems such as the repeatedly execution, application embedding degree height of timer-triggered scheduler task, and can bring into play the stability advantages of group system.
In order to achieve the above object, the technical scheme that the present invention proposes is:
A control method for cluster timer-triggered scheduler task, comprising:
When the execution of the timer-triggered scheduler task that a, clustered node are disposed in self arrives constantly, to database request, carry out described timer-triggered scheduler task; The clustered node quantity of wherein, simultaneously disposing described timer-triggered scheduler task is greater than one;
B, described database root, according to described request, judge whether described timer-triggered scheduler task is current locked, if so, performs step e, otherwise, execution step c;
C, described database judge whether the time interval between the relevant moment that current time and described timer-triggered scheduler task the last time be performed be less than default minimum interval threshold value, if so, perform step e, otherwise execution step d;
Timer-triggered scheduler task described in d, described database lock, and trigger described clustered node and carry out described timer-triggered scheduler task; When the execution of described timer-triggered scheduler task finishes, described clustered node triggers described database and discharges described locking; Finish described method;
E, described database reject said request.
In sum, the control method of the cluster timer-triggered scheduler task that the present invention proposes, when carrying out the scheduling of task, consider the execution time Separation control of task in certain scope, thereby can avoid because the timer-triggered scheduler task of machine time due to asynchronous is repeatedly performed problem.In addition, only need to be to information such as each timer-triggered scheduler task maintenance schedule time, lock-out state letters in database, the information of safeguarding is few, can significantly reduce the embedding degree of application, and because timer-triggered scheduler task has ubiquity, be not limited to carry out timer-triggered scheduler task by certain node, can meet the needs that timer-triggered scheduler task multinode is disposed, the height that therefore can bring into play group system is concurrent, the advantage of stability.
Accompanying drawing explanation
Fig. 1 is the asynchronous schematic diagram that causes timer-triggered scheduler task repeatedly to carry out of machine time;
Fig. 2 is the schematic flow sheet of the embodiment of the present invention one;
Fig. 3 is for adopting the schematic diagram of the timer-triggered scheduler tasks carrying of embodiment mono-realization.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, the present invention is described in further detail below in conjunction with the accompanying drawings and the specific embodiments.
Core concept of the present invention is: clustered node is when the execution of timer-triggered scheduler task arrives constantly, database determines whether this task is current locked, if no locking, mistiming between the time being only performed in current time and this task the last time, while being greater than minimum interval, is just triggered the execution of this timer-triggered scheduler task.So, can guarantee the repeatedly executive problem that cluster timer-triggered scheduler task can not cause due to the asynchronism(-nization) step of different nodes, in addition, only need to be to information such as each timer-triggered scheduler task maintenance schedule time, lock-out state letters in database, like this, because safeguarded information is few, can reduce to a great extent the embedding degree of application, and because timer-triggered scheduler task has ubiquity, be not limited to carry out timer-triggered scheduler task by certain node, the height that therefore can bring into play group system is concurrent, the advantage of stability.
Fig. 2 is the schematic flow sheet of the embodiment of the present invention one, and as shown in Figure 1, this embodiment mainly comprises:
When the execution of the timer-triggered scheduler task that step 201, clustered node are disposed in self arrives constantly, to database request, carry out described timer-triggered scheduler task; Wherein, the clustered node quantity that is simultaneously deployed with described timer-triggered scheduler task is greater than one.
Here, timer-triggered scheduler task needs at least in plural clustered node, to dispose simultaneously, guarantees that timer-triggered scheduler, after a node breaks down, has other node to substitute and to process at once, with this, guarantees the stability of application.
Step 202, described database root, according to described request, judge whether described timer-triggered scheduler task is current locked, if so, performs step 205, otherwise, execution step 203.
Preferably, in actual applications, for each timer-triggered scheduler task, database needs the schedule information of this task of real-time servicing.Concrete, described schedule information comprises scheduler task identification information, the last initial time of carrying out and/or completes time information and be used to indicate current whether blocked task status information.These information, than 12 tables in existing scheme, obviously greatly reduce the quantity of information that system need to be safeguarded, thereby can obtain system embedment littlely, configure technique effect simply and easily.
Concrete, in this step, judge that described timer-triggered scheduler task is current whether lockedly can adopt following method to realize:
The schedule information of the described timer-triggered scheduler task of the current maintenance of data base querying, if the task status information in this schedule information is designated as lock-out state, judges that timer-triggered scheduler task is current locked, otherwise, be judged to be not locked.
Step 203, described database judge whether the time interval between the relevant moment that current time and described timer-triggered scheduler task the last time be performed be less than default minimum interval threshold value, if so, perform step 205, otherwise execution step 204.
In this step, for unblocked task, need further to judge again whether the time interval that this task is performed can be less than minimum interval threshold value, if, need to refuse this and carry out request, like this, even a plurality of machinery compartment asynchronism(-nization) step, also can guarantee within the scope of this minimum time interval, task Exactly-once, thus can avoid because the timer-triggered scheduler task of machine time due to asynchronous is repeatedly performed problem, thus guarantee the high reliability of timer-triggered scheduler task in cluster.
In actual applications; those skilled in the art can according to system maximum time difference between patient clustered node described minimum interval threshold value is set; make this minimum interval threshold value be greater than this maximum time difference, to guarantee that the asynchronous timer-triggered scheduler task that can not cause of machine time is repeatedly performed.
Preferably, described minimum interval threshold value should meet:
The minimum period of the maximum time difference < minimum interval threshold value < task scheduling between node device.
Concrete, the relevant moment that described the last time is performed is the initial time being performed described timer-triggered scheduler task the last time.
Timer-triggered scheduler task described in step 204, described database lock, and trigger described clustered node and carry out described timer-triggered scheduler task; When the execution of described timer-triggered scheduler task finishes, described clustered node triggers described database and discharges described locking.
Here, when the execution of described timer-triggered scheduler task finishes, described clustered node need to trigger described database and discharge the locking about this task, and the status information that is about to this task is set to the sign of non-locking, for carrying out next time, uses.
Step 205, described database reject said request.
Concrete, described refusal can be that database is not done task operating, or also notifies this request of clustered node to be rejected simultaneously.
From technique scheme, can find out that the present invention can effectively avoid, because the timer-triggered scheduler task of machine time due to asynchronous is repeatedly performed problem, utilizing Fig. 3 to further illustrate this effect below.
As shown in Figure 3, in B1,0. 30 minutes mornings, node 1 locked Mission Success, and node 1 is carried out interest and calculated; In B2,0. 30 minutes and 30 seconds morning, node 1 calculated complete, and node 1 discharges locking; In B3,0. 31 minutes mornings, node 2 obtained and locks unsuccessfully, did not carry out and calculated; In B4,0. 40 minutes mornings, locking finished.Visible, adopt the present invention, timer-triggered scheduler task has only been performed once, has effectively avoided the execution again of 2 pairs of these tasks of node.
In sum, these are only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.

Claims (4)

1. a control method for cluster timer-triggered scheduler task, is characterized in that, comprising:
When the execution of the timer-triggered scheduler task that a, clustered node are disposed in self arrives constantly, to database request, carry out described timer-triggered scheduler task; The clustered node quantity of wherein, simultaneously disposing described timer-triggered scheduler task is greater than one;
B, described database root, according to described request, judge whether described timer-triggered scheduler task is current locked, if so, performs step e, otherwise, execution step c;
C, described database judge whether the time interval between the relevant moment that current time and described timer-triggered scheduler task the last time be performed be less than default minimum interval threshold value, if so, perform step e, otherwise execution step d;
Timer-triggered scheduler task described in d, described database lock, and trigger described clustered node and carry out described timer-triggered scheduler task; When the execution of described timer-triggered scheduler task finishes, described clustered node triggers described database and discharges described locking; Finish described method;
E, described database reject said request.
2. method according to claim 1, is characterized in that, the relevant moment that described the last time is performed is the initial time being performed described timer-triggered scheduler task the last time.
3. method according to claim 1, is characterized in that, described method further comprises: for described timer-triggered scheduler task, and the schedule information of described this task of database real-time servicing; Described schedule information comprises scheduler task identification information, the last initial time of carrying out and/or completes time information and be used to indicate current whether blocked task status information.
4. method according to claim 3, is characterized in that, judges described timer-triggered scheduler task current whether locked comprising in step b:
The schedule information of the described timer-triggered scheduler task of the current maintenance of described data base querying, if the task status information in this schedule information is designated as lock-out state, judges that described timer-triggered scheduler task is current locked, otherwise, be judged to be not locked.
CN201410037858.5A 2014-01-26 2014-01-26 The control method of cluster timer-triggered scheduler task Active CN103761148B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410037858.5A CN103761148B (en) 2014-01-26 2014-01-26 The control method of cluster timer-triggered scheduler task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410037858.5A CN103761148B (en) 2014-01-26 2014-01-26 The control method of cluster timer-triggered scheduler task

Publications (2)

Publication Number Publication Date
CN103761148A true CN103761148A (en) 2014-04-30
CN103761148B CN103761148B (en) 2017-04-05

Family

ID=50528391

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410037858.5A Active CN103761148B (en) 2014-01-26 2014-01-26 The control method of cluster timer-triggered scheduler task

Country Status (1)

Country Link
CN (1) CN103761148B (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636878A (en) * 2015-02-17 2015-05-20 交通银行股份有限公司 Dispatching method and device of bank automatic processing task
CN104731900A (en) * 2015-03-19 2015-06-24 浪潮集团有限公司 Hive scheduling method and device
CN106155816A (en) * 2015-04-22 2016-11-23 Tcl集团股份有限公司 The mutual exclusion processing method and processing device of task
CN107766131A (en) * 2016-08-22 2018-03-06 平安科技(深圳)有限公司 Method for scheduling task and device
CN108182108A (en) * 2017-12-19 2018-06-19 山东浪潮商用系统有限公司 A kind of timed task cluster and its execution method
CN108710541A (en) * 2018-05-22 2018-10-26 泰康保险集团股份有限公司 A kind of execution method and device of timed task
CN108733459A (en) * 2017-04-13 2018-11-02 腾讯科技(深圳)有限公司 A kind of method of distributed timing, server and system
CN109144704A (en) * 2018-09-26 2019-01-04 浙江万朋教育科技股份有限公司 A kind of method of Automatic dispatching timed task under distributed environment
CN109543988A (en) * 2018-11-16 2019-03-29 中国银行股份有限公司 The method, apparatus and storage medium of optimization transaction overtime threshold
CN109918187A (en) * 2019-03-12 2019-06-21 北京同城必应科技有限公司 Method for scheduling task, device, equipment and storage medium
CN110019494A (en) * 2017-07-26 2019-07-16 北京国双科技有限公司 Media data processing method and device, storage medium and processor
WO2020082563A1 (en) * 2018-10-25 2020-04-30 平安科技(深圳)有限公司 Scheduled task processing method, apparatus, device, and storage medium
CN111416839A (en) * 2020-02-26 2020-07-14 平安科技(深圳)有限公司 Cluster environment timed task processing method, system, device and storage medium
CN107291558B (en) * 2016-03-30 2020-11-24 阿里巴巴集团控股有限公司 Application program interface deadlock monitoring method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101140528B (en) * 2007-08-31 2013-03-20 中兴通讯股份有限公司 Method and device for realizing timing tasks load in cluster
CN102096602A (en) * 2009-12-15 2011-06-15 中国移动通信集团公司 Task scheduling method, and system and equipment thereof
CN101853182A (en) * 2010-05-05 2010-10-06 中兴通讯股份有限公司 Task execution method and device based on database
CN102981904B (en) * 2011-09-02 2016-08-03 阿里巴巴集团控股有限公司 A kind of method for scheduling task and system
CN103365708B (en) * 2012-04-06 2017-03-22 阿里巴巴集团控股有限公司 Method and device for scheduling tasks

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636878B (en) * 2015-02-17 2018-02-27 交通银行股份有限公司 A kind of bank automatically processes the dispatching method and device of task
CN104636878A (en) * 2015-02-17 2015-05-20 交通银行股份有限公司 Dispatching method and device of bank automatic processing task
CN104731900A (en) * 2015-03-19 2015-06-24 浪潮集团有限公司 Hive scheduling method and device
CN106155816A (en) * 2015-04-22 2016-11-23 Tcl集团股份有限公司 The mutual exclusion processing method and processing device of task
CN106155816B (en) * 2015-04-22 2019-08-02 Tcl集团股份有限公司 The mutual exclusion processing method and processing device of task
CN107291558B (en) * 2016-03-30 2020-11-24 阿里巴巴集团控股有限公司 Application program interface deadlock monitoring method and device
CN107766131A (en) * 2016-08-22 2018-03-06 平安科技(深圳)有限公司 Method for scheduling task and device
CN107766131B (en) * 2016-08-22 2020-09-22 平安科技(深圳)有限公司 Task scheduling method and device
CN108733459A (en) * 2017-04-13 2018-11-02 腾讯科技(深圳)有限公司 A kind of method of distributed timing, server and system
CN110019494A (en) * 2017-07-26 2019-07-16 北京国双科技有限公司 Media data processing method and device, storage medium and processor
CN110019494B (en) * 2017-07-26 2021-09-07 北京国双科技有限公司 Media data processing method and device, storage medium and processor
CN108182108A (en) * 2017-12-19 2018-06-19 山东浪潮商用系统有限公司 A kind of timed task cluster and its execution method
CN108710541A (en) * 2018-05-22 2018-10-26 泰康保险集团股份有限公司 A kind of execution method and device of timed task
CN108710541B (en) * 2018-05-22 2022-02-01 泰康保险集团股份有限公司 Timed task execution method and device
CN109144704A (en) * 2018-09-26 2019-01-04 浙江万朋教育科技股份有限公司 A kind of method of Automatic dispatching timed task under distributed environment
CN109144704B (en) * 2018-09-26 2021-04-20 浙江万朋教育科技股份有限公司 Method for automatically scheduling timed tasks in distributed environment
WO2020082563A1 (en) * 2018-10-25 2020-04-30 平安科技(深圳)有限公司 Scheduled task processing method, apparatus, device, and storage medium
CN109543988A (en) * 2018-11-16 2019-03-29 中国银行股份有限公司 The method, apparatus and storage medium of optimization transaction overtime threshold
CN109918187A (en) * 2019-03-12 2019-06-21 北京同城必应科技有限公司 Method for scheduling task, device, equipment and storage medium
CN111416839A (en) * 2020-02-26 2020-07-14 平安科技(深圳)有限公司 Cluster environment timed task processing method, system, device and storage medium
CN111416839B (en) * 2020-02-26 2022-09-23 平安科技(深圳)有限公司 Cluster environment timing task processing method, system, device and storage medium

Also Published As

Publication number Publication date
CN103761148B (en) 2017-04-05

Similar Documents

Publication Publication Date Title
CN103761148A (en) Control method for cluster timing scheduling tasks
US8930584B2 (en) System and method for providing a linearizable request manager
CN110018893A (en) A kind of method for scheduling task and relevant device based on data processing
CN104793992A (en) Parallel task processing method based on task decomposition
CN102081554A (en) Cloud computing operating system as well as kernel control system and method thereof
CN106648897B (en) A kind of SOLR cluster expansion method and system for supporting balanced resource
CN106302709B (en) A kind of method and system of network file management
CN110752969B (en) Performance detection method, device, equipment and medium
CN112910937B (en) Object scheduling method and device in container cluster, server and container cluster
US7523113B2 (en) Distributed system, computer and state transition control method for distributed system
CN105912709A (en) Big data-based accompanying vehicle analysis method and system
CN111737021A (en) Parallel task processing method and device, electronic equipment and storage medium
CN110737504B (en) Fault-tolerant method, system, terminal and storage medium for deep learning model training
CN110134533B (en) System and method capable of scheduling data in batches
CN103024791A (en) Multi-service processing model and multi-service processing method in communication test system
CN108574718A (en) A kind of cloud host creation method and device
CN106412088A (en) Data synchronization method and terminal
CN106528297A (en) System for managing tasks
CN115469989A (en) Distributed batch task scheduling method and system
CN112202909A (en) Online upgrading method and system for computer storage system
CN107704473A (en) A kind of data processing method and device
CN111400097A (en) Data backup method, device, system and computer readable storage medium
CN110688211A (en) Distributed job scheduling method
CN107783843B (en) Cloud data processing method and device
CN110222016B (en) File processing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant