CN109284189A - A kind of batch tasks overtime efficiently triggering method and system - Google Patents

A kind of batch tasks overtime efficiently triggering method and system Download PDF

Info

Publication number
CN109284189A
CN109284189A CN201811035165.7A CN201811035165A CN109284189A CN 109284189 A CN109284189 A CN 109284189A CN 201811035165 A CN201811035165 A CN 201811035165A CN 109284189 A CN109284189 A CN 109284189A
Authority
CN
China
Prior art keywords
task
time
node
tasks
circle queue
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.)
Pending
Application number
CN201811035165.7A
Other languages
Chinese (zh)
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.)
Fujian Star Software Co Ltd
Original Assignee
Fujian Star Software 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 Fujian Star Software Co Ltd filed Critical Fujian Star Software Co Ltd
Priority to CN201811035165.7A priority Critical patent/CN109284189A/en
Publication of CN109284189A publication Critical patent/CN109284189A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration

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)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The present invention provides a kind of batch tasks time-out efficient triggering method, it include: creation circle queue and map structure, the node number and basic time span of circle queue are set according to preset task time-out time, each node is used for the mapping relations of logger task set and node location for storing a set task, map structure;Start a timer, a node location is moved at interval of basic time span in the circle queue by a pointer;When there is new set of tasks, new set of tasks is put into the upper node that current pointer in circle queue is directed toward node, and will be in set of tasks and the mapping relations of circle queue position write-in map;Whether the judging pointer present node of the task is empty, if so, determining that task is overtime task, triggers timeout mechanism;Otherwise, it is determined that being not timed-out task.The present invention also provides a kind of batch tasks time-out efficiently to trigger system, realizes efficient task time-out judgement, saves system resource.

Description

A kind of batch tasks overtime efficiently triggering method and system
Technical field
The present invention relates to technical field of data processing more particularly to a kind of efficient triggering method of batch tasks time-out and it is System.
Background technique
There are a large amount of task operatings in existing system, it is desirable that the execution of each task no more than set time, If time-out needs to terminate current task or determines task time-out.Common way is, at the beginning of each task, All start a timer, after waiting until that time point arrives, whether judgement task is completed, if do not completed, determine task time-out, If task much if will start many timers, very consumption system resource.Such as there are largely look into the database When inquiry operation etc., needs to set timer to each query task and go timing, result in waste of resources.
Summary of the invention
One of the technical problem to be solved in the present invention is to provide a kind of batch tasks time-out efficient triggering method, reduce The enabling of timer number realizes efficient task time-out judgement, saves system resource.
One of the technical problem to be solved in the present invention is achieved in that a kind of efficient triggering method of batch tasks time-out, Include the following steps:
Step 10, creation circle queue and map structure, the node of circle queue is arranged according to preset task time-out time Number and basic time span, each node are used for logger task set for storing a set task, the map structure With the mapping relations of node location;
Step 20, starting one timer, by a pointer at interval of basic time span in the circle queue A mobile node location;
Step 30, when being needed to be implemented there are new set of tasks, new set of tasks is put into circle queue currently Pointer is directed toward a upper node for node, and will be in set of tasks and the mapping relations of circle queue position write-in map;
Whether step 40, the judging pointer present node of the task are empty, if so, determining that the task of current node is super When task, trigger timeout mechanism;Otherwise, it is determined that being not timed-out task.
Further, the node number and basic time span meet following relationship: node number=time-out time/base This time span.
Further, if task is fulfiled ahead of schedule, node position of the task in circle queue is searched from map structure It sets, the task is deleted from circle queue.
Further, the triggering timeout mechanism includes: after overtime task is marked, this from circle queue Overtime task removes.
Further, the circle queue uses structure of arrays or list structure, and the set of tasks uses structure of arrays Or list structure.
The second technical problem to be solved by the present invention is to provide a kind of efficient triggering system of batch tasks time-out, reduce The enabling of timer number realizes efficient task time-out judgement, saves system resource.
The second technical problem to be solved by the present invention is achieved in that a kind of efficient triggering system of batch tasks time-out, Module and task time-out judgment module are increased newly including circle queue creation module, timing module, task;
The circle queue creation module, for creating circle queue and map structure, according to preset task time-out time The node number and basic time span of circle queue are set, and each node is for storing a set task, the map knot Structure is used for the mapping relations of logger task set and node location;
The timing module, for starting a timer, by a pointer at interval of basic time span described A mobile node location in circle queue;
The task increases module newly, for when needing to be implemented there are new set of tasks, new set of tasks to be put into Current pointer is directed toward a upper node for node in circle queue, and set of tasks and the mapping relations of circle queue position are write Enter in map;
The task time-out judgment module, for judging whether the task of pointer present node is empty, if so, determining to work as The task of preceding node is overtime task, triggers timeout mechanism;Otherwise, it is determined that being not timed-out task.
Further, the node number and basic time span meet following relationship: node number=time-out time/base This time span.
Further, if task is fulfiled ahead of schedule, node position of the task in circle queue is searched from map structure It sets, the task is deleted from circle queue.
Further, the triggering timeout mechanism includes: after overtime task is marked, this from circle queue Overtime task removes.
Further, the circle queue uses structure of arrays or list structure, and the set of tasks uses structure of arrays Or list structure.
The present invention has the advantage that using circle queue store tasks collection merge formulate map to circle queue node with Set of tasks information is associated storage, concurrently sets a pointer and is directed toward present node, is put into and is worked as by new set of tasks A upper node for prior pointer judges that current pointer is directed toward whether node is sky to determine whether there are overtime tasks, it is only necessary to The efficient judgement to the time-out of high-volume task can be realized in one timer, has greatly saved system resource.
Detailed description of the invention
The present invention is further illustrated in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is the method for the present invention execution flow chart.
Fig. 2 is present system block diagram.
Fig. 3 is circle queue data structure schematic diagram of the present invention.
Specific embodiment
As shown in figures 1 and 3, the efficient triggering method of a kind of batch tasks time-out of the present invention, includes the following steps:
Step 10, creation circle queue and map structure, the node of circle queue is arranged according to preset task time-out time Number and basic time span, each node are used for logger task set for storing a set task, the map structure With the mapping relations of node location;Wherein, structure of arrays can be used in the circle queue as needed or list structure carries out pipe Reason, structure of arrays can be used in the set of tasks as needed or list structure is managed;Such as task combines and uses chained list When structure stores, it is denoted as List<task>;Mapping relations of the set of tasks of map structure record in the node location of circle queue It is denoted as map<task, index>;
One step 20, starting timer, by a pointer currentIndex at interval of basic time span in institute A mobile node location in circle queue is stated, as shown in figure 3, such as pointer is successively moved since the 0th node, 0- > 1- > 2- > 3...- > n- > 0, so it is mobile after a week again again from 0 move, continuous circulation is gone down;
Step 30, when being needed to be implemented there are new set of tasks, new set of tasks is put into circle queue currently Pointer is directed toward a upper node for node, and will be in set of tasks and the mapping relations of circle queue position write-in map;
Whether step 40, the judging pointer present node of the task are empty, if so, determining that the task of current node is super When task, trigger timeout mechanism;Otherwise, it is determined that being not timed-out task.
Wherein, the node number and basic time span tickMS meet following relationship: node number=time-out time/ Basic time span, such as the time-out time of all tasks are fixed as 30 seconds, can create the circle queue of 30 nodes, basic Time span tickMS is 1 second.
Preferably, node location of the task in circle queue is searched from map structure if task is fulfiled ahead of schedule, The task is deleted from circle queue.
Preferably, the triggering timeout mechanism includes: that after overtime task is marked, this is surpassed from circle queue When task remove.
As shown in Figures 2 and 3, a kind of batch tasks of the invention time-out efficiently triggering system, including circle queue creation Module, timing module, task increase module and task time-out judgment module newly;
The circle queue creation module, for creating circle queue and map structure, according to preset task time-out time The node number and basic time span of circle queue are set, and each node is for storing a set task, the map knot Structure is used for the mapping relations of logger task set and node location;Wherein, array knot can be used in the circle queue as needed Structure or list structure are managed, and structure of arrays can be used in the set of tasks as needed or list structure is managed;Example When combining such as task using list structure storage, it is denoted as List<task>;The set of tasks of map structure record is in circle queue The mapping relations of node location are denoted as map<task, and index>;
The timing module, for start a timer, by a pointer currentIndex at interval of it is basic when Between span mobile node location in the circle queue, as shown in figure 3, such as pointer since the 0th node successively It is mobile, 0- > 1- > 2- > 3...- > n- > 0, so it is mobile after a week again again from 0 move, continuous circulation is gone down;
The task increases module newly, for when needing to be implemented there are new set of tasks, new set of tasks to be put into Current pointer is directed toward a upper node for node in circle queue, and set of tasks and the mapping relations of circle queue position are write Enter in map;
The task time-out judgment module, for judging whether the task of pointer present node is empty, if so, determining to work as The task of preceding node is overtime task, triggers timeout mechanism;Otherwise, it is determined that being not timed-out task.
Wherein, the node number and basic time span tickMS meet following relationship: node number=time-out time/ Basic time span, such as the time-out time of all tasks are fixed as 30 seconds, can create the circle queue of 30 nodes, basic Time span tickMS is 1 second.
Preferably, from map structure map<task, index>middle task of searching is in annular team if task is fulfiled ahead of schedule Node location in column deletes the task from circle queue.
Preferably, the triggering timeout mechanism includes: that after overtime task is marked, this is surpassed from circle queue When task remove.
The present invention starts a timer by one circle queue of creation, defines a pointer and is directed toward and currently works as prosthomere Point, can be since 0, and at interval of a time mobile node, when there is new set of tasks to start, then set of tasks is put into currently The task that all current pointers are directed toward node is all determined as that time-out, the present invention only need to start one by a upper node for pointer A timer can carry out overtime judgement to the set of tasks that all time-out times are a fixed value, be greatly saved system money Source, and time-out of the invention judge it is simple to operation, efficient.
Although specific embodiments of the present invention have been described above, those familiar with the art should be managed Solution, we are merely exemplary described specific embodiment, rather than for the restriction to the scope of the present invention, it is familiar with this The technical staff in field should be covered of the invention according to modification and variation equivalent made by spirit of the invention In scope of the claimed protection.

Claims (10)

1. a kind of efficient triggering method of batch tasks time-out, characterized by the following steps:
Step 10, creation circle queue and map structure, the node number of circle queue is arranged according to preset task time-out time And basic time span, each node are used for logger task set and section for storing a set task, the map structure The mapping relations of point position;
One step 20, starting timer, are moved in the circle queue by a pointer at interval of basic time span One node location;
Step 30, when being needed to be implemented there are new set of tasks, new set of tasks is put into current pointer in circle queue It is directed toward a upper node for node, and will be in set of tasks and the mapping relations of circle queue position write-in map;
Whether step 40, the judging pointer present node of the task are empty, if so, determining that the task of current node is appointed for time-out Business triggers timeout mechanism;Otherwise, it is determined that being not timed-out task.
2. a kind of efficient triggering method of batch tasks time-out according to claim 1, it is characterised in that: the node number Meet following relationship with basic time span: node number=time-out time/basic time span.
3. a kind of efficient triggering method of batch tasks time-out according to claim 1, it is characterised in that: if task is complete in advance At, then node location of the task in circle queue is searched from map structure, from circle queue the task delete.
4. a kind of efficient triggering method of batch tasks time-out according to claim 1, it is characterised in that: the triggering time-out Mechanism includes: that the overtime task is removed from circle queue after overtime task is marked.
5. a kind of efficient triggering method of batch tasks time-out according to claim 1, it is characterised in that: the circle queue Using structure of arrays or list structure, the set of tasks uses structure of arrays or list structure.
6. a kind of efficient triggering system of batch tasks time-out, it is characterised in that: including circle queue creation module, timing module, Task increases module and task time-out judgment module newly;
The circle queue creation module is arranged for creating circle queue and map structure according to preset task time-out time The node number and basic time span of circle queue, each node are used for storing a set task, the map structure In the mapping relations of logger task set and node location;
The timing module, for starting a timer, by a pointer at interval of basic time span in the annular A mobile node location in queue;
The task increases module newly, for when needing to be implemented there are new set of tasks, new set of tasks to be put into annular Current pointer is directed toward a upper node for node in queue, and set of tasks and the mapping relations of circle queue position are written In map;
The task time-out judgment module, for judging whether the task of pointer present node is empty, if so, determining currently The task of node is overtime task, triggers timeout mechanism;Otherwise, it is determined that being not timed-out task.
7. a kind of batch tasks time-out according to claim 6 efficiently triggers system, it is characterised in that: the node number Meet following relationship with basic time span: node number=time-out time/basic time span.
8. a kind of batch tasks time-out according to claim 6 efficiently triggers system, it is characterised in that: if task is complete in advance At, then node location of the task in circle queue is searched from map structure, from circle queue the task delete.
9. a kind of batch tasks time-out according to claim 6 efficiently triggers system, it is characterised in that: the triggering time-out Mechanism includes: that the overtime task is removed from circle queue after overtime task is marked.
10. a kind of batch tasks time-out according to claim 6 efficiently triggers system, it is characterised in that: the annular team Column use structure of arrays or list structure, and the set of tasks uses structure of arrays or list structure.
CN201811035165.7A 2018-09-06 2018-09-06 A kind of batch tasks overtime efficiently triggering method and system Pending CN109284189A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811035165.7A CN109284189A (en) 2018-09-06 2018-09-06 A kind of batch tasks overtime efficiently triggering method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811035165.7A CN109284189A (en) 2018-09-06 2018-09-06 A kind of batch tasks overtime efficiently triggering method and system

Publications (1)

Publication Number Publication Date
CN109284189A true CN109284189A (en) 2019-01-29

Family

ID=65184515

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811035165.7A Pending CN109284189A (en) 2018-09-06 2018-09-06 A kind of batch tasks overtime efficiently triggering method and system

Country Status (1)

Country Link
CN (1) CN109284189A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032438A (en) * 2019-04-24 2019-07-19 北京高途云集教育科技有限公司 Delayed tasks execute method, apparatus and electronic equipment
CN111083010A (en) * 2019-12-17 2020-04-28 深圳市网心科技有限公司 Speed measurement method and device and computer readable storage medium
CN111245935A (en) * 2020-01-10 2020-06-05 深圳前海环融联易信息科技服务有限公司 Timeout request processing method and device, computer equipment and storage medium
CN111724495A (en) * 2020-04-30 2020-09-29 杭州任联科技有限公司 Non-inductive attendance system and method based on dual-orientation gateway, RFID and BP neural network
CN115658272A (en) * 2022-11-07 2023-01-31 南京金信通信息服务有限公司 ETL task scheduling method, storage medium and electronic device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1558691A (en) * 2004-01-14 2004-12-29 中兴通讯股份有限公司 Method for timed monitoring of memory database in mobile communication equipment
CN1713630A (en) * 2004-06-25 2005-12-28 华为技术有限公司 Method for triggering related timer
US20070171814A1 (en) * 2006-01-20 2007-07-26 Lionel Florit System and method for preventing loops in the presence of control plane failures
CN101221512A (en) * 2007-01-12 2008-07-16 中兴通讯股份有限公司 Timing method and system used for real-time operating system
US20140223436A1 (en) * 2013-02-04 2014-08-07 Avaya Inc. Method, apparatus, and system for providing and using a scheduling delta queue

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1558691A (en) * 2004-01-14 2004-12-29 中兴通讯股份有限公司 Method for timed monitoring of memory database in mobile communication equipment
CN1713630A (en) * 2004-06-25 2005-12-28 华为技术有限公司 Method for triggering related timer
US20070171814A1 (en) * 2006-01-20 2007-07-26 Lionel Florit System and method for preventing loops in the presence of control plane failures
CN101221512A (en) * 2007-01-12 2008-07-16 中兴通讯股份有限公司 Timing method and system used for real-time operating system
US20140223436A1 (en) * 2013-02-04 2014-08-07 Avaya Inc. Method, apparatus, and system for providing and using a scheduling delta queue

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
XUDONG WU等: "Active queue management and global fairness objectives", 《CONFERENCE PROCEEDINGS OF THE 2003 IEEE INTERNATIONAL PERFORMANCE, COMPUTING, AND COMMUNICATIONS CONFERENCE,2003》 *
刘鹏等: "一种面向实时系统的单循环队列算法的应用", 《计算机工程与设计》 *
王家奇士: "[架构师之路]10w定时任务,如何高效触发超时 2017-03-09", 《HTTPS://BLOG.CSDN.NET/QIJIQIGUAI/ARTICLE/DETAILS/78606877》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032438A (en) * 2019-04-24 2019-07-19 北京高途云集教育科技有限公司 Delayed tasks execute method, apparatus and electronic equipment
CN111083010A (en) * 2019-12-17 2020-04-28 深圳市网心科技有限公司 Speed measurement method and device and computer readable storage medium
CN111245935A (en) * 2020-01-10 2020-06-05 深圳前海环融联易信息科技服务有限公司 Timeout request processing method and device, computer equipment and storage medium
CN111724495A (en) * 2020-04-30 2020-09-29 杭州任联科技有限公司 Non-inductive attendance system and method based on dual-orientation gateway, RFID and BP neural network
CN115658272A (en) * 2022-11-07 2023-01-31 南京金信通信息服务有限公司 ETL task scheduling method, storage medium and electronic device
CN115658272B (en) * 2022-11-07 2023-11-21 南京金信通信息服务有限公司 ETL task scheduling method, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN109284189A (en) A kind of batch tasks overtime efficiently triggering method and system
US9734203B2 (en) Access path optimization through system statistics
CN106844682B (en) Method for interchanging data, apparatus and system
CN104536904B (en) A kind of method of data management, equipment and system
CN105279261B (en) Dynamic scalable database filing method and system
CN105069134A (en) Method for automatically collecting Oracle statistical information
CN111460236A (en) Big data acquisition administers quick retrieval system based on data lake
CN105608222A (en) Rapid building method of tile pyramid for large-scale raster data set
CN102043625A (en) Workflow operation method and system
CN102073697A (en) Data processing method and data processing device
CN102841889A (en) Method and device for achieving efficient database access based on ORM (object relational mapping) architecture
CN104182436B (en) A kind of method and device of Clean Up Database
CN107301214A (en) Data migration method, device and terminal device in HIVE
CN110597912B (en) Block storage method and device
CN106339244A (en) Method and device for realizing statistical information collection
CN103258047B (en) A kind of data organization method towards medicine enterprise Activity-Based Cost Control data warehouse
CN109635022B (en) Visual elastic search data acquisition method and device
CN112667593B (en) Method and device for ETL (extract transform and load) process to execute hbase fast loading
CN106250501A (en) Report processing method and reporting system
CN110910237B (en) Data processing method and device in blockchain, intelligent terminal and storage medium
CN103377292A (en) Database result set caching method and device
CN108319694A (en) A kind of automatic cleaning method and device of historical data
CN101833585A (en) Database server operation control system, method and device
KR20160091471A (en) In-memory Database System based on Circle-Queue and Data processing method thereof
CN107179883A (en) Spark architecture optimization method of hybrid storage system based on SSD and HDD

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190129