CN109901918A - A kind of method and apparatus handling overtime task - Google Patents

A kind of method and apparatus handling overtime task Download PDF

Info

Publication number
CN109901918A
CN109901918A CN201711292379.8A CN201711292379A CN109901918A CN 109901918 A CN109901918 A CN 109901918A CN 201711292379 A CN201711292379 A CN 201711292379A CN 109901918 A CN109901918 A CN 109901918A
Authority
CN
China
Prior art keywords
task
task data
data
stored
overtime
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
CN201711292379.8A
Other languages
Chinese (zh)
Other versions
CN109901918B (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 CN201711292379.8A priority Critical patent/CN109901918B/en
Publication of CN109901918A publication Critical patent/CN109901918A/en
Application granted granted Critical
Publication of CN109901918B publication Critical patent/CN109901918B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of method and apparatus for handling overtime task, are related to field of computer technology.One specific embodiment of this method includes: to be stored in database profession first task data, the second task data is stored in the memory of each example;Wherein, the information attribute of second task data belongs to a part of the information attribute of the first task data;According to second task data, obtains and handle overtime task;Update the corresponding first task data of the overtime task and the second task data.The embodiment is able to solve the problem that task treatment effeciency is low, resource overhead is big.

Description

A kind of method and apparatus handling overtime task
Technical field
The present invention relates to field of computer technology more particularly to a kind of method and apparatus for handling overtime task.
Background technique
The situation of task time-out can all be encountered in actual life in many scenes, for example user has descended an order, but It is not paid in specified time, this just needs system to have a relevant business module to be handled, and cancels this order automatically.
In realizing process of the present invention, at least there are the following problems in the prior art for inventor's discovery: for scattered complete Whether the timeout datum to be processed of office, meet overtime item by all waiting tasks of global United Dispatching center elder generation timing scan Part, so that overtime task is collected, processing overtime task of reallocating.Therefore, individual machine example needs to handle big in synchronization The overtime task of batch increases some unnecessary resources when overtime task reaches certain magnitude and various operation system Expense.Moreover, only wait lower whorl to retry by throw exception retry mechanism when the process for handling overtime task occurs abnormal, Unnecessary waste is brought to each operation system resource.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of method and apparatus for handling overtime task, it is able to solve at task Manage the big problem of low efficiency, resource overhead.
To achieve the above object, according to an aspect of an embodiment of the present invention, a kind of side for handling overtime task is provided Method, comprising:
First task data are stored in database profession, the second task data are stored in the memory of each example;Its In, the information attribute of second task data belongs to a part of the information attribute of the first task data;
According to second task data, obtains and handle overtime task;
Update the corresponding first task data of the overtime task and the second task data;
If the second task data is stored in the memory of each example, obtains and locates according to second task data It manages in any one step of overtime task first task data corresponding with the overtime task is updated and exception occurs, then it will be different Normal information is stored in the database;
The exception information in the database is obtained, the strategy for corresponding to the exception information is chosen according to policy library, and The exception is handled according to the strategy.
Optionally, the first task data stored in the database include each example the second task stored in memory Data, and each example the second task data stored in memory is different.
Optionally, first task data are stored in database profession, the second task data is stored in each example In depositing, comprising:
The processing request of reception task;
It is handled and is requested according to the task, generate first task data, the information attribute of the first task data is at least Including task time-out time and task status;
The first task data are stored in database profession;
The second task data is generated, the information attribute of second task data includes task time-out time;
Second task data is stored in the memory of each example.
Optionally, it according to second task data, determines and handles overtime task, comprising:
The memory is scanned, to obtain the second task data of storage in the memory;
The task time-out time for comparing current time Yu second task data judges whether current time is more than described Task time-out time, if so, handling the corresponding overtime task of the task time-out time.
Optionally, the corresponding first task data of the overtime task and the second task data are updated, comprising:
According to the processing result of the overtime task, appointing for the corresponding first task data of the overtime task is updated Business state deletes corresponding second task data of the overtime task.
In addition, other side according to an embodiment of the present invention, provides a kind of device for handling overtime task, comprising:
Second task data is stored in each reality for being stored in database profession first task data by memory module In the memory of example;Wherein, the information attribute of second task data belongs to the one of the information attribute of the first task data Part;
Processing module, for obtaining and handling overtime task according to second task data;
Update module, for updating the corresponding first task data of the overtime task and the second task data;
Abnormal memory module, if for the second task data is stored in the memory of each example, according to described Two task datas obtain and handle any one step of overtime task first task data corresponding with the overtime task is updated Occur exception in rapid, then exception information is stored in the database;
Exception processing module is chosen described in corresponding to for obtaining the exception information in the database according to policy library The strategy of exception information, and the exception is handled according to the strategy.
Optionally, the first task data stored in the database include each example the second task stored in memory Data, and each example the second task data stored in memory is different.
Optionally, the memory module is used for:
The processing request of reception task;
It is handled and is requested according to the task, generate first task data, the information attribute of the first task data is at least Including task time-out time and task status;
The first task data are stored in database profession;
The second task data is generated, the information attribute of second task data includes task time-out time;
Second task data is stored in the memory of each example.
Optionally, the processing module is used for:
The memory is scanned, to obtain the second task data of storage in the memory;
The task time-out time for comparing current time Yu second task data judges whether current time is more than described Task time-out time, if so, handling the corresponding overtime task of the task time-out time.
Optionally, the update module is used for:
According to the processing result of the overtime task, the task shape of the corresponding first task data of the overtime task is updated State deletes corresponding second task data of the overtime task.
Other side according to an embodiment of the present invention, additionally provides a kind of electronic equipment, comprising:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processing Device realizes method described in any of the above-described embodiment.
Other side according to an embodiment of the present invention additionally provides a kind of computer-readable medium, is stored thereon with meter Calculation machine program, realizes method described in any of the above-described embodiment when described program is executed by processor.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that because using first task data is deposited It is stored in database, the second task data is stored in the memory of each example, obtained simultaneously according to second task data The technological means of overtime task is handled, so the technical problem that task treatment effeciency is low, resource overhead is big is overcome, and will be original Global Task-decomposing handled respectively in each example at several subtasks, significantly reduce single instance processing it is same The performance pressures of moment high-volume overtime task.Moreover, leading to when the processing of the task of example each in cluster or system occur abnormal Classification examination can be carried out to abnormal from global angle by crossing the abnormal step that retries, and Different Strategies is selected to carry out abnormality processing.And And, to according to policy library strategy dynamic cataloging and handle, treatment effeciency can be improved by being manually entered, to enrich policy library.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is the schematic diagram of the main flow of the method for processing overtime task according to an embodiment of the present invention;
Fig. 2 be according to the present invention one can refer to embodiment processing overtime task method main flow signal Figure;
Fig. 3 is another signal that can refer to the main flow of the method for the processing overtime task of embodiment according to the present invention Figure;
Fig. 4 is the schematic diagram of the main modular of the device of processing overtime task according to an embodiment of the present invention;
Fig. 5 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 6 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention Figure.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Fig. 1 is the method for processing overtime task according to an embodiment of the present invention.As an embodiment of the present invention, as schemed Shown in 1, the method for the processing overtime task may include:
Step 101, first task data are stored in database profession, the second task data is stored in each example In depositing;Wherein, the information attribute of second task data belongs to a part of the information attribute of the first task data.
In this step, first task data are stored in database profession, the second task data are stored each to cluster In the memory of example, basic data is provided for subsequent step.Also, the information attribute of second task data belongs to described A part of the information attribute of one task data;Wherein, the information attribute may include task time-out time, task status. As an embodiment of the present invention, the information attribute of the first task data includes at least task time-out time and task shape State, the information attribute of second task data include task time-out time, are stored with the data in each example memory of simplification, Basic data is provided simultaneously for subsequent step.
As another embodiment of the invention, the information attributes of the first task data include at least O/No., The task time-out time and task status of order, the information attribute of second task data include times of O/No. and order Business time-out time.It should be noted that each order has globally unique number, each order can correspond to multinomial wait locate The task of reason, such as pay, deliver, return goods, exchange goods, cancel an order, complain, examine.Optionally, the order can be purchase Object order, delivery order, audit order etc..
It should be pointed out that be stored in the database global O/No., the corresponding each task of each order, The time-out time of each task, each task task status (such as new order, pending payment, payment are completed, payment time-out, to Delivery, delivery are completed, delivery is overtime, wait completion of returning goods, exchange goods, examination & approval time-out etc.).Further, the first task data Information attribute at least further include each task task status.Optionally, the information attribute of the first task data may be used also To include sorting code number when task processing is abnormal;It can also include the timestamp information of task deposit database.
By taking the payment task of order as an example, for database as global resource, the order data structure in database is as follows:
Optionally, the classification when information attribute of second task data does not include: task status, task processing exception Coding, timestamp information of task deposit memory etc..In an embodiment of the present invention, the information attribute of second task data The time-out time of O/No. and the corresponding each task of each order can be only included.Optionally, second task data Information attribute can be made of O/No. and task time-out time.
By taking the payment task of order as an example, HashSet structure is can be used in the order data structure in cluster instance memory, such as Under:
For example, for 120 tasks (for example, it may be the payment task of 60 orders and complain task, can also be with It is the shipping tasks of 120 orders, can also be the payment task of 30 orders, shipping tasks, task of exchanging goods, cancels an order and appoint Business) and 10 examples, 120 tasks can be averagely allocated to 10 examples (in each example memory 10 tasks of storage and The time-out time of each task).It can also be according to the height of each instance processes ability, to each example allocation different number Task, so that optimized allocation of resources, saves resource overhead.
It may also is that being distributed according to the difference of task definition (such as pay, deliver, return goods, cancel an order, complain) Task.Specifically, for example, the identical task of task definition is distributed into the same example, the instance processes these Business.For complex disposal process or processing time longer task, the identical task of task definition can be distributed to multiple Example, so that optimized allocation of resources, improves treatment effeciency.The multi-task can also be distributed to the same example to handle, originally Invention to this with no restriction.
Optionally, each example of cluster uses distributed deployment (such as ZooKeeper), is taking into account horizontal extension ability Meanwhile task data is oriented to all example parallel processings in cluster, treatment effeciency is promoted, failure risk is reduced.
As an embodiment of the present invention, the first task data stored in the database include each example memory Second task data of middle storage, and each example the second task data stored in memory is different.That is, each A example O/No. stored in memory is possible to identical, task be also possible to it is identical, but generally will not be in each example The identical task data of identical O/No. and the same O/No. is stored in memory.
As it can be seen that in an embodiment of the present invention, can simplify the data storage in each example local memory, using this hair The data storage method that bright embodiment provides, can be improved the efficiency of reading data, to reduce time overhead.
As another embodiment of the invention, the step 101 includes: that first task data are first stored in database In, then the second task data is stored in memory.In this embodiment, database success is stored in first task data Afterwards, then by the second task data it is stored in memory, to guarantee the data validity of database, can be based in the next steps First task data in database execute task.
As another embodiment of the invention, step 101 may include: to receive the task processing request of user;According to The task processing request, generates first task data and the second task data.
It should be pointed out that at the time of time-out time refers to task time-out, i.e. cut-off to what moment (such as 2017 11 10 divide 20 seconds when month 20 days 01), if the task is thrown away untreated, which belongs to overtime task.
Specifically, it can be directed to different task definitions, different timeout thresholds is set.By taking payment task as an example, time-out Threshold value can be 24 hours or 0.5 hour, and when receiving the task requests of user, the current time adds time threshold, As pay the time-out time of task.By taking shipping tasks as an example, timeout threshold can be 2 days or 7 days, when receiving user's When task requests, the current time adds time threshold, the as time-out time of shipping tasks.Therefore, the time-out time can It is determined with time and timeout threshold according to task requests, calculates time-out time, in a step 101 in order in subsequent step It is whether overtime that task is quickly determined in rapid.
As yet another embodiment of the present invention, step 101 may include: to receive task processing request first, then root Request is handled according to the task and generates first task data, is then stored in database profession first task data;It generates later Second task data is finally stored in the memory of each example by the second task data.Wherein, the first task data Information attribute includes at least task time-out time and task status, and the information attribute of second task data includes task time-out Time.
In this embodiment, the task requests of user are first received, then generate first task number according to the task requests According to, first task data be stored in database success and then according to the task requests generate the second task data, then Second task data is stored in memory, to guarantee the data validity of database.If first task data are stored in data Library failure, then terminate.It should be noted that the second task data can also be generated while generating first task data;But It is after first task data are stored in database success, the second task data to be stored in the memory of each example.
Step 102, it according to second task data, obtains and handles overtime task.
In this step, then scanning memory first is filtered out with obtaining the second task data according to task time-out time Overtime task reprocesses the overtime task.
As another embodiment of the invention, step 102 includes: to scan the memory first, is stored in institute to obtain State the second task data in memory;Then, compare the task time-out time of current time Yu second task data, judge Whether current time is more than the task time-out time;If so, handling the corresponding overtime task of the task time-out time;If It is no, then terminate, waiting scans next time.
Optionally, the memory is scanned, periodically to obtain the second task data.Optionally, using single thread or more The mode of thread handles overtime task.
It should be noted that since the information attribute of the second task data includes task time-out time, then, in scanning When depositing, it can be determined that whether each task is overtime at current time.If so, the task is overtime task;If it is not, then this Business is not a time out task.
It should be pointed out that also the task in normal time is being handled, if task exists while handling overtime task Processing is completed in normal time, which is deleted from memory.As it can be seen that the second task data being stored in memory is constantly It updates.In fact, the second task data is task data to be processed.
Optionally, all examples can be used Spring+Quartz mode and configure starting in cluster, and each example is from respective Overtime order is obtained in local memory.Since the embodiment of the present invention exists original global Task-decomposing at several subtasks It is handled respectively in each example, therefore, significantly reduces the property of individual machine instance processes synchronization high-volume overtime task It can pressure.
It should be pointed out that the prior art when handling each overtime task, needs first from each operation system in example (such as ordering system, custom system, commodity information system etc.) foraging task basic data (such as mission bit stream, user information, Merchandise news etc.), then these task basic datas are associated with and are assembled, generate task data, then newly drive journey processing time-out into Task.And in an embodiment of the present invention, without being associated and assembling in example, only by task time-out time It determines overtime task, then realizes the processing to overtime task.As it can be seen that the embodiment of the present invention makes full use of distributed proccessing With memory treatment effeciency advantage, the treatment effeciency of overtime task is improved.
Step 103, the corresponding first task data of the overtime task and the second task data are updated.
Specifically, in this step, the task of the corresponding first task data of overtime task handled in step 102 is updated State deletes corresponding second task data of the overtime task.
Optionally, after processing overtime task success, the task status of first task data is first updated;When being updated successfully Afterwards, then the second task data is deleted, to guarantee the data validity of database.
By taking payment task as an example, after processing overtime task success, first by the task status orderState of overtime task It is revised as " payment is completed " from " pending payment ", then deletes the overtime task in memory.Therefore, each example is stored in memory super When task quantity may remain in certain amount grade, avoid occupying a large amount of memories.
Fig. 2 be according to the present invention one can refer to embodiment processing overtime task method main flow signal Figure.As another embodiment of the invention, step 102 and step 103 can be specifically included:
Timing scan example memory;
The second task data is obtained from the memory;
The task time-out time for comparing current time Yu second task data, judges whether there is overtime task;
Overtime task if it does not exist then terminates;
Overtime task if it exists, then using single thread/multi-thread data processing mode processing overtime task;
After processing overtime task success, the task status of the corresponding first task data of the overtime task is first updated; After being updated successfully, then delete corresponding second task data of the overtime task.
According to various embodiments recited above, it can be seen that the present invention is stored in number by using by first task data According in library, the second task data is stored in the memory of each example, according to second task data, obtains and handle super When task technological means, to solve the problems, such as that task treatment effeciency is low, resource overhead is big.That is, the prior art It is that individual machine example in synchronization needs to handle large batch of overtime task, when overtime task reaches certain magnitude and business When system is various, some unnecessary resource overheads are increased.And the present invention is to be stored in database profession first task data, Second task data is stored in the memory of each example, according to second task data, obtains and handle overtime task, To handle original global Task-decomposing respectively in each example at several subtasks, single reality is significantly reduced The performance pressures of example processing synchronization high-volume overtime task.
Moreover, overtime task is assured that by the time-out time of task without being associated and assembling in example, Then the processing to overtime task is realized.As it can be seen that the embodiment of the present invention makes full use of distributed proccessing and memory to handle effect Rate advantage improves the treatment effeciency of overtime task.
As yet another embodiment of the present invention, the method can also include:
Step 104, if the second task data is stored in the memory of each example, according to second task data Obtain and handle occur in any one steps of overtime task first task data corresponding with the overtime task is updated it is different Often, then exception information is stored in the database;And
Step 105, the exception information in the database is obtained, is chosen according to policy library and corresponds to the exception information Strategy, and the exception is handled according to the strategy.
Specifically, in a step 101, if occurring when the second task data to be stored in the memory of each example different Often, then exception information is stored in database;In a step 102, if in timing scan, obtaining the second task data, determining super When task, occur in any one step in overtime task processing abnormal, then exception information is stored in database;In step In 103, if there is exception when updating the task status of the corresponding first task data of overtime task, exception information is stored in In database.And then according to exception information, carry out abnormal retry.
For ease of description, the exception occurred in above-mentioned steps 101, step 102, step 103 is classified as " process by the present invention It is abnormal ".
If being pointed out that, Fig. 2 exemplarily only indicates exception occur at " updating task status ", causes to update and lose It loses, then exception information is stored in database, carry out abnormal retry.Similarly, occur exception in executing other steps, also will Exception information is stored in database, is carried out exception and is retried, repeats no more.
In yet another embodiment of the present invention, since the information attribute of the first task data can also include task Sorting code number (errorType) when processing is abnormal.Optionally, it after exception information is stored in the database, updates The first task data, such as sorting code number (errorType) when order processing exception, in order to according to order processing exception When sorting code number determine corresponding strategy.
Optionally, exception information is periodically obtained from database.Such as order time-out is obtained periodically from database The abnormal order of processing (isFinish=0 and errorType is not empty).
Optionally, it can also be triggered by event, when the event triggers, obtain the exception information in the database, according to Policy library chooses the strategy for corresponding to the exception information, then handles the exception according to the strategy.For example, in urgent feelings Under condition, abnormal order can walk designated lane using event trigger mechanism by separate interface, to handle abnormal order.
It, therefore, can be according to from plan it should be noted that be stored in the policy library corresponding to various abnormal strategies The strategy slightly chosen in library executes corresponding processing.
Optionally, the exception can also include system exception and/or data exception.Optionally, the system exception packet Include example on-hook, network connection is abnormal, example memory has been expired, database access is abnormal, caching read-write is abnormal etc..Optionally, institute It states the information that data exception may include order to be altered, causes to occur abnormal.Similarly, different for system exception and data Often, strategy corresponding thereto can also be selected from policy library.
Fig. 3 is another signal that can refer to the main flow of the method for the processing overtime task of embodiment according to the present invention Figure, the method for handling overtime task may include:
It is triggered by clocked flip or event, exception information is obtained from database, judges whether there is exception information;
Exception information if it does not exist then terminates;
Exception information if it exists then determines abnormal type according to the exception information, for example process is abnormal, system is different Often, data exception or other unknown exceptions;
The strategy for corresponding to the Exception Type is chosen according to policy library;
If the Exception Type is that process is abnormal, the first task data in database are called, and handles time-out and appoints Business;If processing is unsuccessful, the first task data in database are called again, and handle overtime task, until handling successfully; Then task status (the note of the exception information i.e. more in new database of the overtime task in first task data is updated Record);
In process exception, according to number of retries threshold value and/or time threshold can be retried decide whether to continue to retry.If Not up to number of retries threshold value and/or time threshold is retried, then continue growing call number, dispatched again, if being more than weight It tries frequency threshold value and/or retries time threshold, then issue and remind to responsible person.Specifically, number of retries threshold can be preset It is worth and retries time threshold, if exceeding threshold value, no longer retries, and issue prompting, to notify responsible person, so as to pass through people The mode of work carries out overtime task processing or waits next round triggering.It should be noted that can also be further directed to: will Second task data is stored in the memory of each example, obtains and handle overtime task and more according to second task data There is exception in any one step of new first task data, formulates different strategies respectively, and these policy stores are existed In policy library.
If the Exception Type is system exception, no longer retry, and issue prompting, to notify responsible person, so as to By manually carrying out abnormality processing.After artificial treatment, the record of the exception information in more new database.It can also be further Statistic of classification is carried out according to the details of system exception.After a period of time, by system exception and data exception, process abnormal one It rises and forms statistical table, be mainly used for analyzing various exceptions shared ratio when overtime task retracts.
If the Exception Type is data exception, abandons, no longer retry, and the shape of the order in more new database State value, so that the order for data exception occur is not re-used as exception in next round triggering.
If the Exception Type is other unknown exceptions, no longer retry, and issue prompting, to notify responsible person, from And it can be by manually carrying out abnormality processing.It further, can also be according to artificial treatment as a result, increasing relative strategy newly strategy In library, policy library is updated, is used when identical abnormal for processing next time.
Occur exception when updating data-base recording if being pointed out that, leads to the failure, then no longer retry, under waiting One wheel triggering, to carry out abnormal retry in next round.
Optionally, for the abnormal order of event triggering, according to number of retries threshold value and/or time threshold can also be retried Decide whether to continue to retry, issue and remind to responsible person.
It therefore, can be from by the abnormal step that retries when the processing of the task of example each in cluster or system occur abnormal Global angle carries out classification examination to abnormal, and Different Strategies is selected to carry out abnormality processing.And it can be by being manually entered, with rich Rich policy library improves treatment effeciency to according to policy library strategy dynamic cataloging and handle.
In addition, another can refer in the specific implementation for the method for handling overtime task described in embodiment in the present invention Hold, has been described in detail in the method for processing overtime task described above, therefore has no longer illustrated in this duplicate contents.
Fig. 4 is the device of processing overtime task according to an embodiment of the present invention, as shown in figure 4, the processing overtime task Device 400 include memory module 401, processing module 402, update module 403, abnormal memory module 404 and abnormality processing mould Block 405.First task data are stored in database profession by memory module 401, and the second task data is stored in each example In memory;Wherein, the information attribute of second task data belongs to a part of the information attribute of the first task data; Processing module 402 obtains according to second task data and handles overtime task;Update module 403 updates the time-out and appoints It is engaged in corresponding first task data and the second task data.If the second task data is stored in the memory of each example, It is obtained according to second task data and handles overtime task first task data corresponding with the overtime task is updated Occurs exception in any one step, exception information is then stored in the database by the abnormal storage mould 404;The exception Processing module 405 obtains the exception information in the database, and the strategy for corresponding to the exception information is chosen according to policy library, And the exception is handled according to the strategy.
First task data are stored in database profession by memory module 401, the second task data are stored each to cluster In the memory of example, basic data is provided for the operation of subsequent module.Also, the information attribute of second task data belongs to A part of the information attribute of the first task data;Wherein, the information attribute may include task time-out time, task State.As an embodiment of the present invention, the information attribute of the first task data include at least task time-out time and Task status, the information attribute of second task data include task time-out time, with the number in each example memory of simplification Basic data is provided according to storage, while for subsequent step.
Optionally, the information attribute of the first task data can also include sorting code number when task processing is abnormal; It can also include the timestamp information of task deposit database.Optionally, the information attribute of second task data does not include: Sorting code number, the timestamp information of task deposit memory when task status, task processing are abnormal etc..
In some embodiments of the invention, the information attribute of the first task data includes at least O/No., orders Single task time-out time and task status, the information attribute of second task data includes the task of O/No. and order Time-out time.Optionally, the information attribute of second task data can only include O/No. and each order is corresponding The time-out time of each task.Optionally, the information attribute of second task data is by O/No. and task time-out time Composition.
Optionally, the first task data stored in the database include each example the second task stored in memory Data, and each example the second task data stored in memory is different.
Optionally, first task data are first stored in database profession by the memory module 401, then by the second task data It is stored in memory.Database success is stored in first task data and then the second task data is stored in memory, To guarantee the data validity of database, other modules can execute task based on the first task data in database.
Optionally, the memory module 401 receives task processing request first, and then being handled according to the task please seek survival At first task data, then first task data are stored in database profession;The second task data is generated later, finally by Two task datas are stored in the memory of each example.
If first task data are stored in failed database, terminate.It should be noted that can also be first in generation While data of being engaged in, the second task data is generated;But after first task data are stored in database success, by second Task data is stored in the memory of each example.
Optionally, the processing module 402 scans the memory, to obtain the second number of tasks of storage in the memory According to;Then, the task time-out time for comparing current time Yu second task data judges whether current time is more than described Task time-out time;If so, handling the corresponding overtime task of the task time-out time;If it is not, then terminating, wait next time Scanning.
Optionally, the memory is scanned, periodically to obtain the second task data.Optionally, using single thread or more The mode of thread handles overtime task.
Optionally, the update module 403 updates the task status of the corresponding first task data of overtime task, and deletes Except corresponding second task data of overtime task.
Optionally, after processing overtime task success, the task shape of the corresponding first task data of overtime task is first updated State;After being updated successfully, then corresponding second task data of overtime task is deleted, to guarantee the data validity of database.
If occurring exception when the second task data to be stored in the memory of each example, exception information is stored in number According in library;If in timing scan, the second task data of acquisition, determining that overtime task, overtime task are handled, in update task status Any one during occur abnormal, then exception information is stored in database;If updating overtime task corresponding first Occur exception when the task status of task data, then exception information is stored in data.And then it according to exception information, carries out Exception retries.
Optionally, the exception can also include system exception and/or data exception.Optionally, the system exception packet Include that example on-hook, network connection be abnormal, example memory has been expired.Optionally, the data exception may include the information of order It is altered, causes to occur abnormal.Similarly, it for system exception and data exception, can also be selected from policy library and its phase Corresponding strategy.
According to various embodiments recited above, it can be seen that the present invention is stored in number by using by first task data According in library, the second task data is stored in the memory of each example, according to second task data, obtains and handle super When task technological means, to solve the problems, such as that task treatment effeciency is low, resource overhead is big.That is, the prior art It is that individual machine example in synchronization needs to handle large batch of overtime task, when overtime task reaches certain magnitude and business When system is various, some unnecessary resource overheads are increased.And the present invention is to be stored in database profession first task data, Second task data is stored in the memory of each example, according to second task data, obtains and handle overtime task, To handle original global Task-decomposing respectively in each example at several subtasks, single reality is significantly reduced The performance pressures of example processing synchronization high-volume overtime task.
It should be noted that the specific implementation content of the device in processing overtime task of the present invention, described above It handles and has been described in detail in the method for overtime task, therefore no longer illustrate in this duplicate contents.
Fig. 5 is shown can be using the method for the processing overtime task of the embodiment of the present invention or the device of processing overtime task Exemplary system architecture 500.
As shown in figure 5, system architecture 500 may include terminal device 501,502,503, network 404 and server 405. Network 504 between terminal device 501,502,503 and server 505 to provide the medium of communication link.Network 504 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 501,502,503 and be interacted by network 504 with server 505, to receive or send out Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 501,502,503 (merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 501,502,503 can be the various electronic equipments with display screen and supported web page browsing, packet Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 505 can be to provide the server of various services, such as utilize terminal device 501,502,503 to user The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to reception To the data such as information query request analyze etc. processing, and by processing result (such as target push information, product letter Breath --- merely illustrative) feed back to terminal device.
It should be noted that the method for processing overtime task provided by the embodiment of the present invention is generally held by server 505 Row, correspondingly, the device of the processing overtime task are generally positioned in server 505.
It should be understood that the number of terminal device, network and server in Fig. 5 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 6, it illustrates the computer systems 600 for the terminal device for being suitable for being used to realize the embodiment of the present invention Structural schematic diagram.Terminal device shown in Fig. 6 is only an example, function to the embodiment of the present invention and should not use model Shroud carrys out any restrictions.
As shown in fig. 6, computer system 600 includes central processing unit (CPU) 601, it can be read-only according to being stored in Program in memory (ROM) 602 or be loaded into the program in random access storage device (RAM) 603 from storage section 608 and Execute various movements appropriate and processing.In RAM 603, also it is stored with system 600 and operates required various programs and data. CPU 601, ROM 602 and RAM603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to always Line 604.
I/O interface 605 is connected to lower component: the importation 606 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 607 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 608 including hard disk etc.; And the communications portion 609 of the network interface card including LAN card, modem etc..Communications portion 609 via such as because The network of spy's net executes communication process.Driver 610 is also connected to I/O interface 605 as needed.Detachable media 611, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 610, in order to read from thereon Computer program be mounted into storage section 608 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.? In such embodiment, which can be downloaded and installed from network by communications portion 609, and/or from can Medium 611 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 601, system of the invention is executed The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet Include memory module, processing module, update module, abnormal memory module and exception processing module, wherein the title of these modules exists The restriction to the module itself is not constituted in the case of certain.
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes Obtaining the equipment includes: to be stored in database profession first task data, and the second task data is stored in the memory of each example In;Wherein, the information attribute of second task data belongs to a part of the information attribute of the first task data;According to Second task data, obtains and handles overtime task;Update the corresponding first task data of the overtime task and second Task data;If the second task data is stored in the memory of each example, is obtained simultaneously according to second task data It handles in any one step of overtime task first task data corresponding with the overtime task is updated and exception occurs, then will Exception information is stored in the database;The exception information in the database is obtained, is chosen according to policy library described in corresponding to The strategy of exception information, and the exception is handled according to the strategy.
Technical solution according to an embodiment of the present invention, because being stored in database profession using by first task data, by Two task datas are stored in the memory of each example, are obtained according to second task data and are handled the technology of overtime task Means, so overcome the technical problem that task treatment effeciency is low, resource overhead is big, and by original global Task-decomposing at Several subtasks are handled respectively in each example, significantly reduce single instance processing synchronization high-volume overtime task Performance pressures.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention Within.

Claims (12)

1. a kind of method for handling overtime task characterized by comprising
First task data are stored in database profession, the second task data are stored in the memory of each example;Wherein, institute State the second task data information attribute belong to the first task data information attribute a part;
According to second task data, obtains and handle overtime task;
Update the corresponding first task data of the overtime task and the second task data;
If the second task data is stored in the memory of each example, obtains and handles super according to second task data When task first task data corresponding with the overtime task is updated any one step in occur it is abnormal, then by abnormal letter Breath is stored in the database;
The exception information in the database is obtained, the strategy according to policy library selection corresponding to the exception information, and according to The strategy handles the exception.
2. the method according to claim 1, wherein the first task data stored in the database include each A example the second task data stored in memory, and each example the second task data stored in memory is different.
3. the method according to claim 1, wherein first task data are stored in database profession, by second Task data is stored in the memory of each example, comprising:
The processing request of reception task;
It is handled and is requested according to the task, generate first task data, the information attribute of the first task data includes at least Task time-out time and task status;
The first task data are stored in database profession;
The second task data is generated, the information attribute of second task data includes task time-out time;
Second task data is stored in the memory of each example.
4. according to the method described in claim 3, it is characterized in that, determining according to second task data and handling time-out Task, comprising:
The memory is scanned, to obtain the second task data of storage in the memory;
The task time-out time for comparing current time Yu second task data judges whether current time is more than the task Time-out time, if so, handling the corresponding overtime task of the task time-out time.
5. according to the method described in claim 3, it is characterized in that, update the corresponding first task data of the overtime task and Second task data, comprising:
According to the processing result of the overtime task, the task shape of the corresponding first task data of the overtime task is updated State deletes corresponding second task data of the overtime task.
6. a kind of device for handling overtime task characterized by comprising
Second task data is stored in each example for being stored in database profession first task data by memory module In memory;Wherein, the information attribute of second task data belongs to a part of the information attribute of the first task data;
Processing module, for obtaining and handling overtime task according to second task data;
Update module, for updating the corresponding first task data of the overtime task and the second task data;
Abnormal memory module, if for the second task data is stored in the memory of each example, according to described second Business data acquisition is simultaneously handled in any one steps of overtime task and the corresponding first task data of the update overtime task There is exception, then exception information is stored in the database;
Exception processing module is chosen according to policy library for obtaining the exception information in the database and corresponds to the exception The strategy of information, and the exception is handled according to the strategy.
7. device according to claim 6, which is characterized in that the first task data stored in the database include each A example the second task data stored in memory, and each example the second task data stored in memory is different.
8. device according to claim 6, which is characterized in that the memory module is used for:
The processing request of reception task;
It is handled and is requested according to the task, generate first task data, the information attribute of the first task data includes at least Task time-out time and task status;
The first task data are stored in database profession;
The second task data is generated, the information attribute of second task data includes task time-out time;
Second task data is stored in the memory of each example.
9. device according to claim 8, which is characterized in that the processing module is used for:
The memory is scanned, to obtain the second task data of storage in the memory;
The task time-out time for comparing current time Yu second task data judges whether current time is more than the task Time-out time, if so, handling the corresponding overtime task of the task time-out time.
10. device according to claim 8, which is characterized in that the update module is used for:
According to the processing result of the overtime task, the task status of the corresponding first task data of the overtime task is updated, Delete corresponding second task data of the overtime task.
11. a kind of electronic equipment characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real Now such as method as claimed in any one of claims 1 to 5.
12. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor Such as method as claimed in any one of claims 1 to 5 is realized when row.
CN201711292379.8A 2017-12-08 2017-12-08 Method and device for processing overtime task Active CN109901918B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711292379.8A CN109901918B (en) 2017-12-08 2017-12-08 Method and device for processing overtime task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711292379.8A CN109901918B (en) 2017-12-08 2017-12-08 Method and device for processing overtime task

Publications (2)

Publication Number Publication Date
CN109901918A true CN109901918A (en) 2019-06-18
CN109901918B CN109901918B (en) 2024-04-05

Family

ID=66940149

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711292379.8A Active CN109901918B (en) 2017-12-08 2017-12-08 Method and device for processing overtime task

Country Status (1)

Country Link
CN (1) CN109901918B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111641678A (en) * 2020-04-29 2020-09-08 深圳壹账通智能科技有限公司 Task scheduling method and device, electronic equipment and medium
CN112035164A (en) * 2020-09-03 2020-12-04 中国银行股份有限公司 Method for updating node configuration of distributed system, application node and control node
CN112163810A (en) * 2020-09-28 2021-01-01 杭州拼便宜网络科技有限公司 Method and device for sending mail
CN112732460A (en) * 2021-01-05 2021-04-30 卓望数码技术(深圳)有限公司 Data state management method, system and storage medium
CN112835704A (en) * 2021-03-26 2021-05-25 中国工商银行股份有限公司 Task processing method, thread pool management method, device and computing equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103581225A (en) * 2012-07-25 2014-02-12 中国银联股份有限公司 Distributed system node processing task method
CN104182283A (en) * 2014-08-22 2014-12-03 北京京东尚科信息技术有限公司 Task synchronization method
CN104407917A (en) * 2014-11-13 2015-03-11 中国建设银行股份有限公司 JMS (Java messaging service)-based transaction processing method and JMS-based transaction processing device
US20150293953A1 (en) * 2014-04-11 2015-10-15 Chevron U.S.A. Inc. Robust, low-overhead, application task management method
CN106293971A (en) * 2016-08-15 2017-01-04 张家林 A kind of method and apparatus of distributed task dispatching
CN106789431A (en) * 2016-12-26 2017-05-31 中国银联股份有限公司 A kind of overtime monitoring method and device
US20170236188A1 (en) * 2014-12-30 2017-08-17 NetSuite Inc. System and method for automating business processes throughout the life cycle of an order by using a publish-subscriber pattern

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103581225A (en) * 2012-07-25 2014-02-12 中国银联股份有限公司 Distributed system node processing task method
US20150293953A1 (en) * 2014-04-11 2015-10-15 Chevron U.S.A. Inc. Robust, low-overhead, application task management method
CN104182283A (en) * 2014-08-22 2014-12-03 北京京东尚科信息技术有限公司 Task synchronization method
CN104407917A (en) * 2014-11-13 2015-03-11 中国建设银行股份有限公司 JMS (Java messaging service)-based transaction processing method and JMS-based transaction processing device
US20170236188A1 (en) * 2014-12-30 2017-08-17 NetSuite Inc. System and method for automating business processes throughout the life cycle of an order by using a publish-subscriber pattern
CN106293971A (en) * 2016-08-15 2017-01-04 张家林 A kind of method and apparatus of distributed task dispatching
CN106789431A (en) * 2016-12-26 2017-05-31 中国银联股份有限公司 A kind of overtime monitoring method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111641678A (en) * 2020-04-29 2020-09-08 深圳壹账通智能科技有限公司 Task scheduling method and device, electronic equipment and medium
CN112035164A (en) * 2020-09-03 2020-12-04 中国银行股份有限公司 Method for updating node configuration of distributed system, application node and control node
CN112163810A (en) * 2020-09-28 2021-01-01 杭州拼便宜网络科技有限公司 Method and device for sending mail
CN112163810B (en) * 2020-09-28 2024-04-30 杭州拼便宜网络科技有限公司 Mail sending method and device
CN112732460A (en) * 2021-01-05 2021-04-30 卓望数码技术(深圳)有限公司 Data state management method, system and storage medium
CN112835704A (en) * 2021-03-26 2021-05-25 中国工商银行股份有限公司 Task processing method, thread pool management method, device and computing equipment

Also Published As

Publication number Publication date
CN109901918B (en) 2024-04-05

Similar Documents

Publication Publication Date Title
CN109901918A (en) A kind of method and apparatus handling overtime task
US6493680B2 (en) Method and apparatus for processing billing transactions
US7657453B2 (en) System, computer-readable medium and method for filtering exceptions generated by forecasting and replenishment engine
US5668993A (en) Multithreaded batch processing system
US5999916A (en) No-reset option in a batch billing system
WO1997024688A9 (en) Method and aparatus for processing billing transactions
US20100036690A1 (en) Service scheduling
CN108874513A (en) Handle method, system, electronic equipment and the computer-readable medium of timed task
CN112801607A (en) Management service platform and construction method
CN110473036A (en) A kind of method and apparatus generating order number
CN109413125A (en) The method and apparatus of dynamic regulation distributed system resource
US8463755B2 (en) System and method for providing collaborative master data processes
CN113051060A (en) GPU dynamic scheduling method and device based on real-time load and electronic equipment
CN110515741A (en) A kind of degradation processing method and device based on local task queue
CN110389976A (en) A kind of dispatching method and device of multi-interface data
CN110457327A (en) A kind of data processing method, device and storage medium
CN106357735B (en) For operating the method and apparatus of the infrastructure layer of cloud computing framework
US8538993B2 (en) Outsourced options management
CN109146672A (en) It is a kind of that matching process and device are brought together based on production model
CN110490501B (en) Transport capacity state management method and device
CN109933459A (en) A kind of execution method and apparatus of multitask
CN113762819A (en) Channel scheduling method and device
US11853791B2 (en) Transaction scheduling for a user data cache by assessing update criteria
CN115329733B (en) Report form statistical method and device, computer equipment and storage medium
CN115187358B (en) Account checking engine data processing system and working method thereof

Legal Events

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