CN106802826A - A kind of method for processing business and device based on thread pool - Google Patents

A kind of method for processing business and device based on thread pool Download PDF

Info

Publication number
CN106802826A
CN106802826A CN201611209613.1A CN201611209613A CN106802826A CN 106802826 A CN106802826 A CN 106802826A CN 201611209613 A CN201611209613 A CN 201611209613A CN 106802826 A CN106802826 A CN 106802826A
Authority
CN
China
Prior art keywords
task
thread pool
thread
queue
priority
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
CN201611209613.1A
Other languages
Chinese (zh)
Other versions
CN106802826B (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.)
China Unionpay Co Ltd
Original Assignee
China Unionpay 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 China Unionpay Co Ltd filed Critical China Unionpay Co Ltd
Priority to CN201611209613.1A priority Critical patent/CN106802826B/en
Publication of CN106802826A publication Critical patent/CN106802826A/en
Application granted granted Critical
Publication of CN106802826B publication Critical patent/CN106802826B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • 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)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Multi Processors (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of method for processing business and device based on thread pool, it is used to enable possess priority feature during thread pool processing system processing business, including:Receive pending business and parse pending business for N number of task;N is more than or equal to 1;According to the type of service of pending business, the configuration file of pending business is obtained;The task priority of the task queue information of pending business and each task of pending service resolution is contained in configuration file;According to the task priority of each task, N number of task is put into the task queue corresponding to pending business;Task queue has priority;According to task queue priority, N number of task is put into thread pool successively.Because task queue has priority, can the business higher to priority carry out priority treatment, additionally, task in task queue also has priority so that vital task can be by priority treatment.

Description

A kind of method for processing business and device based on thread pool
Technical field
The present invention relates to field of computer technology, more particularly to a kind of method for processing business and device based on thread pool.
Background technology
Nowadays, flourishing with financial circles, either real time processing system or batch processing system in financial sector The data pressure that system is faced is increasing.And the growth of the explosion type with data, most of financial sector all completed point Cloth stores data, and correlation technique is also more and more ripe.The database manipulation of complexity is frequently accompanied by Business Processing, for reality Now to the management of distributed data base, Business Processing efficiency is improved, thread pool is a kind of very effective Business Processing mechanism.
At present, synchronous single database thread cell system and asynchronous many data wires are mainly had based on thread pool transaction processing system Two kinds of journey cell system.Wherein, asynchronous many data thread pool systems because its without waiting for, the high efficiency such as asynchronous process processing feature and More and more widely used.However, asynchronous many data thread pools do not have weight function, it is impossible to support at the thread of priority Reason so that asynchronous many data thread pools are unable to priority treatment hot job and vital task.
In sum, current thread pool processing system does not possess priority feature in processing business.
The content of the invention
The present invention provides a kind of method for processing business and device based on thread pool, is used to process thread pool processing system Can possess priority feature during business.
The embodiment of the present invention provides a kind of method for processing business based on thread pool, including:
Receive pending business and parse pending business for N number of task;N is more than or equal to 1;
According to the type of service of pending business, the configuration file of pending business is obtained;Contained in configuration file and treated The task priority of the task queue information of processing business and each task of pending service resolution;
According to the task priority of each task, N number of task is put into the task queue corresponding to pending business;Task Queue has priority;
According to task queue priority, N number of task is put into thread pool successively.
Alternatively, the thread pool information of pending business is also included in configuration file,
According to task queue priority, before N number of task is put into thread pool successively, also include:
According to the thread pool information of the pending business, M of pending business pair described in the thread pool is determined Thread;
By the task in the task queue corresponding to pending business and M thread contexts.
Alternatively, database information is further comprises in configuration file,
According to task queue priority, before N number of task is put into thread pool successively, also include:
According to database information, M thread is connected with the database described in database information.
Alternatively, task queue be according to priority divided into from high to low FIFO fifo queue, weight queue, after enter elder generation Go out LIFO queues and external queue;
External queue is used to preserve mission critical, and mission critical is part or all of in N number of task;
According to task queue priority, after N number of task is put into thread pool successively, also include:
For each task in N number of task, the callback information of task is received;
According to callback information, judge whether task runs succeeded;
If task is to perform failure, it is determined that task corresponding mission critical in external queue, and returns and perform key Task.
Alternatively, thread pool is any one thread pool in thread cell system;Any thread pool energy in thread cell system Enough obtain the corresponding database resource of other thread pools;
According to task queue priority, after N number of task is put into thread pool successively, also include:
According to the implementation status of N number of task, the execution efficiency of thread pool is judged;
If the execution efficiency of thread pool is less than predetermined threshold value, is obtained from thread cell system and substitute thread pool;Substitute line Cheng Chi is thread pool of the processing speed higher than thread pool in thread cell system;
Untreated task in N number of task is completely or partially adjusted in the corresponding task queue of replacement thread pool.
The embodiment of the present invention provides a kind of business processing device based on thread pool, including:
Parsing module, for receiving pending business and parsing pending business for N number of task;N is more than or equal to 1;
Acquisition module, for the type of service according to pending business, obtains the configuration file of pending business;Configuration text The task priority of the task queue information of pending business and each task of pending service resolution is contained in part;
Configuration module, for the task priority according to each task, appointing corresponding to pending business is put into by N number of task In business queue;Task queue has priority;
Scheduler module, for according to task queue priority, N number of task being put into thread pool successively.
Alternatively, the thread pool information of pending business is also included in configuration file,
Configuration module is additionally operable to:
According to the thread pool information of the pending business, M of pending business pair described in the thread pool is determined Thread;
By the task in the task queue corresponding to pending business and M thread contexts.
Alternatively, database information is further comprises in configuration file,
Configuration module is additionally operable to according to database information, and M thread is connected with the database described in database information Connect.
Alternatively, task queue be according to priority divided into from high to low FIFO fifo queue, weight queue, after enter elder generation Go out LIFO queues and external queue;
External queue is used to preserve mission critical, and mission critical is part or all of in N number of task;
Scheduler module is additionally operable to:
For each task in N number of task, the callback information of task is received;
According to callback information, judge whether task runs succeeded;
If task is to perform failure, it is determined that task corresponding mission critical in external queue, and returns and perform key Task.
Alternatively, thread pool is any one thread pool in thread cell system;Any thread pool energy in thread cell system Enough obtain the corresponding database resource of other thread pools;
Scheduler module is additionally operable to:
According to the implementation status of N number of task, the execution efficiency of thread pool is judged;
If the execution efficiency of thread pool is less than predetermined threshold value, is obtained from thread cell system and substitute thread pool;Substitute line Cheng Chi is thread pool of the processing speed higher than thread pool in thread cell system;
Untreated task in N number of task is completely or partially adjusted in the corresponding task queue of replacement thread pool.
In sum, a kind of method for processing business and device based on thread pool are the embodiment of the invention provides, including:Connect Receive pending business and parse pending business for N number of task;N is more than or equal to 1;According to the type of service of pending business, obtain Take the configuration file of pending business;The task queue information and pending business solution of pending business are contained in configuration file The task priority of each task of analysis;According to the task priority of each task, N number of task is put into corresponding to pending business In task queue;Task queue has priority;According to task queue priority, N number of task is put into thread pool successively.Root According to the type of service of pending business, the N number of task come by pending service resolution is put into the corresponding task of pending business In queue, because task queue has priority, therefore in task scheduling, service resolution that can be higher to priority and come Task carries out priority treatment, additionally, the task in task queue can also be arranged according to priority so that important in business Task can by priority treatment, so, using method for processing business processing business of the present invention, can not only be according to priority Processing business, moreover it is possible to which priority processing is also carried out to the task that business fractionation comes.
Brief description of the drawings
Technical scheme in order to illustrate more clearly the embodiments of the present invention, below will be to that will make needed for embodiment description Accompanying drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for this For the those of ordinary skill in field, without having to pay creative labor, it can also be obtained according to these accompanying drawings His accompanying drawing.
Fig. 1 is a kind of method for processing business schematic flow sheet based on thread pool provided in an embodiment of the present invention;
Fig. 2 is a kind of type of service provided in an embodiment of the present invention, the relation between weighted value and task queue;
Fig. 3 is a kind of dynamic dispatching schematic diagram provided in an embodiment of the present invention;
Fig. 4 is a kind of distributed thread cell system framework provided in an embodiment of the present invention;
Fig. 5 is a kind of business processing device structural representation based on thread pool provided in an embodiment of the present invention.
Specific embodiment
In order that the object, technical solutions and advantages of the present invention are clearer, below in conjunction with accompanying drawing the present invention is made into One step ground is described in detail, it is clear that described embodiment is only some embodiments of the invention, rather than whole implementation Example.Based on the embodiment in the present invention, what those of ordinary skill in the art were obtained under the premise of creative work is not made All other embodiment, belongs to the scope of protection of the invention.
Fig. 1 is a kind of method for processing business schematic flow sheet based on thread pool provided in an embodiment of the present invention, such as Fig. 1 institutes Show, comprise the following steps:
S101:Receive pending business and parse pending business for N number of task;N is more than or equal to 1;
S102:According to the type of service of pending business, the configuration file of pending business is obtained;Included in configuration file The task priority of each task of the task queue information and pending service resolution of pending business;
S103:According to the task priority of each task, N number of task is put into the task queue corresponding to pending business In;Task queue has priority;
S104:According to task queue priority, N number of task is put into thread pool successively.
In the specific implementation process of step S101, typically pass through an application programming interface (Application Programming Interface, API) pending business is received, pending business is combined by multiple tasks, can be by Multiple tasks are resolved to, for the treatment for processing multiple tasks namely to parsing of pending business.
In the specific implementation process of step S102, each type of service all correspond to a configuration text for pre-setting Part, the type of service according to pending business obtains the corresponding configuration file of pending business, for example, inquiry business correspond to match somebody with somebody File 1 is put, transaction business correspond to configuration file 2, and configuration file 1 and configuration file 2 are all the configuration files for pre-setting, when When pending business is inquiry business, then configuration file 1 is obtained, when pending business is transaction business, then obtain configuration text Part 2.Alternatively, there is multiple tasks queue in thread pool, the task queue information of pending business contained in configuration file, And the task priority of each task of pending service resolution.For example, the configuration file of inquiry business is configuration file 1, then, The corresponding task queue A of inquiry business is have recorded in configuration file 1, and, the task of each task that inquiry business is parsed is excellent First level, alternatively, task priority here is distinguished with weighted value, and for common task, its weighted value is for just, weighted value is got over Greatly, priority is higher, and for vital task, its weighted value is negative, and weighted value is bigger, and priority is higher, will wait to locate by positive and negative The task that reason service resolution goes out is divided into two classes, facilitates follow-up priority processing.
In the specific implementation process of step S103, pending business is contained in the corresponding configuration file of pending business The priority of the N number of task for parsing, when N number of task is put into task queue, need to be according to the respective precedence information of N number of task It is put into.Task queue for receiving N number of task also has prioritization, has multiple tasks queue in thread pool, each There is different priority between queue, described in configuration file the corresponding task queue information of pending business, also just mean According to the type of service priority that to be pending business configuration different.For example, have recorded inquiry business pair in configuration file 1 The task queue A for answering, have recorded the corresponding task queue B of transaction business in configuration file 2, the priority of task queue B is higher than Task queue A, then the task in task queue B will be processed prior to the task in task queue A, that is, priority treatment is handed over The multiple tasks that easy service resolution goes out, and the multiple tasks that inquiry business is parsed will process what transaction business was parsed Can be just processed after multiple tasks.For N number of task that a pending service resolution goes out, task priority of also having is distinguished, Be placed into for task queue when, need according to priority sequentially be put into, for example, transaction business B has parsed N number of task, When this N number of task is put into task queue B, need to be put into according to priority orders so that priority task high can preferentially be located Reason.
Alternatively, the also thread pool information comprising pending business in configuration file, according to task queue priority, successively Before N number of task is put into thread pool, also include:According to the thread pool information of pending business, determine to wait to locate in thread pool M thread of reason business pair;M thread is used to process N number of task.Before N number of task is formally processed, also need to process task Thread pool configured.Alternatively, thread pool is likely to be a separate threads pond, it is also possible to be under the jurisdiction of distributed thread One thread pool of cell system.Alternatively, there is the distributed thread cell system of multiple thread pools for one, can first travels through The running status of each thread pool, the selection wherein optimal thread pool of the integrated condition such as speed of service and resource situation is used as place Manage the thread pool of this N number of task.The thread pool information of pending business is contained in configuration file, thread pool information have recorded place Number of threads M needed for managing the pending business, when it is determined that after thread pool, being marked off from thread pool according to thread pool information M thread, this M thread will be utilized separately for processing the task that the pending service resolution goes out.For example, being had in thread pool 1000 threads, the corresponding thread pool information of configuration file 2 of transaction business is 100 threads, then need to be divided from thread pool Go out 100 threads to process transaction business, this 100 threads can meet the treatment need of the multiple tasks that transaction business is parsed Ask.Thread pool information in configuration file is being pending business configuration thread so that the thread of configuration can meet The demand of pending business, will not waste the resource of thread pool again, such that it is able to improve the thread utilization rate in thread pool, optimization The internal memory planning of thread pool, improves the treatment effeciency of thread pool.Alternatively, default line is set according to practical application request or experience Journey number, is the line in pending business configuration thread pool by acquiescence number when thread pool information is not included in configuration file Journey.
Alternatively, database information is further comprises in configuration file, according to task queue priority, successively by N number of task Before being put into thread pool, also include:According to database information, by M thread and the database phase described in database information Connection.Thread pool process task needs the data resource in dispatching database, therefore, database letter is further comprises in configuration file Breath, database information of the database information for needed for processing the pending business, for example, treatment transaction business needs to dispatch data Storehouse 1 and the resource of database 2, then the database information in the corresponding configuration file 2 of transaction business is database 1 and database 2. M thread is referred to and database information is stored in thread pool with the database described in database to being connected, when entering Row task treatment when, M thread by according to database information from specified database scheduling resource, such as data of transaction business Storehouse information is database 1 and database 2, then thread pool, will be from the sum of database 1 when the task that transaction business is parsed is processed Data resource is dispatched according to storehouse 2.Database information is added in configuration file can be realized operating distributed multidatabase simultaneously, when need When increasing new database and being processed with supporting business, only need to increase corresponding database information in configuration file.
In the specific implementation process of step S104, each task queue has different priority, alternatively, preferentially will Task in the task queue high of first level is put into thread pool.
Alternatively, task queue be according to priority divided into from high to low FIFO fifo queue, weight queue, after enter elder generation Go out LIFO queues and external queue;External queue is used to preserve mission critical, and mission critical is the part or complete in N number of task Portion;According to task queue priority, after N number of task is put into thread pool successively, also include:It is every in for N number of task One task, receives the callback information of task;According to callback information, judge whether task runs succeeded;If task is to perform mistake Lose, it is determined that task corresponding mission critical in external queue, and return to execution mission critical.External queue is used to preserve closes Key task, generally, the task in external queue can't be performed, and mission critical is the N parsed in pending business It is part or all of in individual task.Alternatively, when pending business has high importance, and parsing for task is simultaneously few When, all parsing for tasks are all stored in external queue.Alternatively, when the importance of pending business is general or parsing When going out for task is excessive, it is stored in partial task therein as mission critical in external queue, alternatively, mission critical can Divided with according to the weight for representing task priority, it is e.g., weight is outer for the task of negative value is stored in as mission critical In putting queue.Each task scheduling is entered into thread pool to be processed, a callback information can be all obtained for representing task Performance.
Fig. 2 is a kind of type of service provided in an embodiment of the present invention, the relation between weighted value and task queue, is such as schemed Shown in 2, the priority of miscellaneous service is represented with weight, for general service, weighted value is for just, weighted value is bigger, and priority is got over Height, for important service, weighted value is negative, and weighted value is bigger, and priority is higher.Typically have for inquiry class business relatively low Weighted value, therefore its multiple tasks for parsing is placed into the minimum fifo queue of priority, financial class business relatively inquires about class industry Business is even more important, therefore is placed into built-in queues, when built-in queues low memory, can also be placed into external queue, for Second kills generic operation, and its highest priority is placed into LIFO queues.
During specific implementation, for each task in N number of task, the callback information of task is received;According to callback information, Judge whether task runs succeeded;If task is to perform failure, it is determined that task corresponding mission critical in external queue, and Return and perform mission critical.Unsuccessfully there are two kinds of situations in tasks carrying, a kind of situation is that the task of execution failure is mission critical, Now, only need directly to extract this task of preservation from external queue and return to execution, another situation is to perform failure Task be common task, do not preserved in external queue, then should extract nearest apart from this common task from external queue The mission critical of executed, and return to treatment.Alternatively, when other queuing memories are not enough, external queue can also participate in appointing Business scheduling.
In external queue preserve mission critical for system is provided a kind of snapshot functions so that task process make a mistake When, can be returned by way of recovering mission critical and processed again, enhance the availability of system.Additionally, need to only extract external Mission critical in queue is that can return to, without according to the type of error api interface different with result return, therefore, The present embodiment additionally provides a kind of extremely friendly simple api interface.
Alternatively, thread pool is any one thread pool in thread cell system;Any thread pool energy in thread cell system Enough obtain the corresponding database resource of other thread pools;According to task queue priority, N number of task is put into thread pool successively Afterwards, also include:According to the implementation status of N number of task, the execution efficiency of thread pool is judged;If the execution efficiency of thread pool is less than Predetermined threshold value, then obtain from thread cell system and substitute thread pool;Substitute thread pool be thread cell system in processing speed be higher than The thread pool of thread pool;Untreated task in N number of task is completely or partially adjusted to substitute the corresponding task queue of thread pool In.There are multiple thread pools, each thread pool can have differences to the treatment effeciency of task, resource in distributed thread cell system Pressure would also vary from, and when the treatment effeciency of thread pool of the pending business is processed less than predetermined threshold value, can be somebody's turn to do The share tasks that pending service resolution goes out give the treatment of other thread pools.In each thread pool of distributed thread cell system, contain Have the thread for calling the corresponding database resource of other thread pools so that each thread pool have treatment other thread pool services Ability.Fig. 3 is a kind of dynamic dispatching schematic diagram provided in an embodiment of the present invention, as shown in figure 3, business APP1 and business APP2 300 tasks are all parsed, respectively by thread pool a and thread pool b treatment, because the database resource of thread pool a is sufficient, has been appointed Business treatment effeciency is high, and after a period of time, business APP1 also remains 30 tasks, and business APP2 also remains 200 tasks, thread pool b Processing speed be less than predetermined threshold value, now, some or all of in remaining 200 tasks of business APP2 is dispatched to industry In the corresponding task queues of business APP1, remaining of thread pool b processing business APP2 is assisted by the corresponding thread pool a of business APP1 Business.Using the method for this dynamic dispatching, business procession can be accelerated, make full use of thread Pooled resources.Further, it is also possible to Extending transversely and deployment, for complicated business, the share tasks that will can be parsed alleviate single line in multiple thread pools The operating pressure of Cheng Chi, improves business procession.
Fig. 4 is a kind of distributed thread cell system framework provided in an embodiment of the present invention, as shown in figure 4, APP1, APP2 ..., APPN represent the pending type of service of N kinds of the distributed thread cell system, thread pool 1 ..., thread pool N be this N number of thread pool that thread pool has, each thread pool has four kinds of queues, and a thread pool tool is illustrated in Fig. 4 Some task queues:LIFO queues, built-in queues queue, fifo queue and external queue, manager are responsible for according to pending industry The execution sentence of business, by pending service resolution be multiple tasks, it is determined that and parse the corresponding configuration file of pending business, and Information configuration task queue, thread pool and database in configuration file, scheduler successively will according to queue priority Task scheduling to thread pool, node 1, node 2 ..., node N be N number of database node that the distributed thread cell system has, For the distributed thread cell system provides data resource.
In sum, a kind of method for processing business based on thread pool is the embodiment of the invention provides, including:Receive and wait to locate Reason business simultaneously parses pending business for N number of task;N is more than or equal to 1;According to the type of service of pending business, obtain and wait to locate The configuration file of reason business;Contained in configuration file pending business task queue information and pending service resolution it is each The task priority of task;According to the task priority of each task, N number of task is put into the task team corresponding to pending business In row;Task queue has priority;According to task queue priority, N number of task is put into thread pool successively.According to waiting to locate The type of service of reason business, the N number of task come by pending service resolution is put into the corresponding task queue of pending business, Because task queue has priority, therefore in task scheduling, service resolution that can be higher to priority and the coming of the task is entered Row major treatment, additionally, the task in task queue can also be arranged according to priority so that the vital task energy in business Enough by priority treatment, so, using method for processing business processing business of the present invention, can not only according to priority process industry Business, moreover it is possible to which priority processing is also carried out to the task that business fractionation comes.
Based on identical technology design, the embodiment of the present invention provides a kind of business processing device based on thread pool, the dress Putting can realize above-mentioned technical method.Fig. 5 is a kind of business processing device knot based on thread pool provided in an embodiment of the present invention Structure schematic diagram, as shown in figure 5, processing unit 500 includes parsing module 501, acquisition module 502, configuration module 503 and scheduling mould Block 504, wherein,
Parsing module 501, for receiving pending business and parsing pending business for N number of task;N is more than or equal to 1;
Acquisition module 502, for the type of service according to pending business, obtains the configuration file of pending business;Match somebody with somebody Put the task priority that the task queue information of pending business and each task of pending service resolution are contained in file;
Configuration module 503, for the task priority according to each task, N number of task is put into corresponding to pending business Task queue in;Task queue has priority;
Scheduler module 504, for according to task queue priority, N number of task being put into thread pool successively.
Alternatively, the thread pool information of pending business is also included in configuration file,
Configuration module 503 is additionally operable to:
According to the thread pool information of pending business, M thread of pending business pair in thread pool is determined;
By the task in the task queue corresponding to pending business and M thread contexts.
Alternatively, database information is further comprises in configuration file,
Configuration module 503, is additionally operable to:
According to database information, M thread is connected with the database described in database information.
Alternatively, task queue be according to priority divided into from high to low FIFO fifo queue, weight queue, after enter elder generation Go out LIFO queues and external queue;
External queue is used to preserve mission critical, and mission critical is part or all of in N number of task;
Scheduler module 504 is additionally operable to:
For each task in N number of task, the callback information of task is received;
According to callback information, judge whether task runs succeeded;
If task is to perform failure, it is determined that task corresponding mission critical in external queue, and returns and perform key Task.
Alternatively, thread pool is any one thread pool in thread cell system;Any thread pool energy in thread cell system Enough obtain the corresponding database resource of other thread pools;
Scheduler module 504 is additionally operable to:
According to the implementation status of N number of task, the execution efficiency of thread pool is judged;
If the execution efficiency of thread pool is less than predetermined threshold value, is obtained from thread cell system and substitute thread pool;Substitute line Cheng Chi is thread pool of the processing speed higher than thread pool in thread cell system;
Untreated task in N number of task is completely or partially adjusted in the corresponding task queue of replacement thread pool.
In sum, a kind of method for processing business and device based on thread pool are the embodiment of the invention provides, including:Connect Receive pending business and parse pending business for N number of task;N is more than or equal to 1;According to the type of service of pending business, obtain Take the configuration file of pending business;The task queue information and pending business solution of pending business are contained in configuration file The task priority of each task of analysis;According to the task priority of each task, N number of task is put into corresponding to pending business In task queue;Task queue has priority;According to task queue priority, N number of task is put into thread pool successively.Root According to the type of service of pending business, the N number of task come by pending service resolution is put into the corresponding task of pending business In queue, because task queue has priority, therefore in task scheduling, service resolution that can be higher to priority and come Task carries out priority treatment, additionally, the task in task queue can also be arranged according to priority so that important in business Task can by priority treatment, so, using method for processing business processing business of the present invention, can not only be according to priority Processing business, moreover it is possible to which priority processing is also carried out to the task that business fractionation comes.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product Figure and/or block diagram are described.It should be understood that every first-class during flow chart and/or block diagram can be realized by computer program instructions The combination of flow and/or square frame in journey and/or square frame and flow chart and/or block diagram.These computer programs can be provided The processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced for reality by the instruction of computer or the computing device of other programmable data processing devices The device of the function of being specified in present one flow of flow chart or multiple one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or other programmable data processing devices with spy In determining the computer-readable memory that mode works so that instruction of the storage in the computer-readable memory is produced and include finger Make the manufacture of device, the command device realize in one flow of flow chart or multiple one square frame of flow and/or block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that in meter Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented treatment, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
, but those skilled in the art once know basic creation although preferred embodiments of the present invention have been described Property concept, then can make other change and modification to these embodiments.So, appended claims are intended to be construed to include excellent Select embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification without deviating from essence of the invention to the present invention God and scope.So, if these modifications of the invention and modification belong to the scope of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to comprising these changes and modification.

Claims (10)

1. a kind of method for processing business based on thread pool, it is characterised in that including:
Receive pending business and parse the pending business for N number of task;N is more than or equal to 1;
According to the type of service of the pending business, the configuration file of the pending business is obtained;In the configuration file Contain the task priority of the task queue information of the pending business and each task of the pending service resolution;
According to the task priority of each task, N number of task is put into the task team corresponding to the pending business In row;The task queue has priority;
According to the task queue priority, N number of task is put into thread pool successively.
2. the method for claim 1, it is characterised in that the also line comprising the pending business in the configuration file Cheng Chi information,
According to the task queue priority, before N number of task is put into thread pool successively, also include:
According to the thread pool information of the pending business, M thread of pending business pair described in the thread pool is determined; The M thread is used to process N number of task.
3. method as claimed in claim 2, it is characterised in that further comprises database information in the configuration file,
According to the task queue priority, before N number of task is put into thread pool successively, also include:
According to the database information, the M thread is connected with the database described in the database information.
4. the method for claim 1, it is characterised in that the task queue according to priority is divided into first to enter from high to low First go out fifo queue, weight queue, after to enter first go out LIFO queues and external queue;
The external queue is used to preserve mission critical, and the mission critical is part or all of in N number of task;
According to the task queue priority, after N number of task is put into thread pool successively, also include:
For each task in N number of task, the callback information of the task is received;
According to the callback information, judge whether the task runs succeeded;
If the task is to perform failure, it is determined that the task corresponding mission critical in the external queue, and is returned Perform the mission critical.
5. the method as described in any one of Claims 1-4, it is characterised in that
The thread pool is any one thread pool in thread cell system;Any thread pool in the thread cell system can be obtained Take the corresponding database resource of other thread pools;
According to the task queue priority, after N number of task is put into thread pool successively, also include:
According to the implementation status of N number of task, the execution efficiency of the thread pool is judged;
If the execution efficiency of the thread pool is less than predetermined threshold value, is obtained from the thread cell system and substitute thread pool;Institute It is thread pool of the processing speed higher than the thread pool in the thread cell system to state and substitute thread pool;
Untreated task in N number of task is completely or partially adjusted in the corresponding task queue of the replacement thread pool.
6. a kind of business processing device based on thread pool, it is characterised in that including:
Parsing module, for receiving pending business and parsing the pending business for N number of task;N is more than or equal to 1;
Acquisition module, for the type of service according to the pending business, obtains the configuration file of the pending business;Institute State and the task queue information of the pending business and each task of the pending service resolution are contained in configuration file Task priority;
Configuration module, for the task priority according to each task, the pending business institute is put into by N number of task In corresponding task queue;The task queue has priority;
Scheduler module, for according to the task queue priority, N number of task being put into thread pool successively.
7. device as claimed in claim 6, it is characterised in that the also line comprising the pending business in the configuration file Cheng Chi information,
The configuration module is additionally operable to:
According to the thread pool information of the pending business, M thread of pending business pair described in the thread pool is determined;
By the task in the task queue corresponding to the pending business and the M thread contexts.
8. device as claimed in claim 7, it is characterised in that further comprises database information in the configuration file,
The configuration module, is additionally operable to:
According to the database information, the M thread is connected with the database described in the database information.
9. device as claimed in claim 6, it is characterised in that the task queue according to priority is divided into first to enter from high to low First go out fifo queue, weight queue, after to enter first go out LIFO queues and external queue;
The external queue is used to preserve mission critical, and the mission critical is part or all of in N number of task;
The scheduler module is additionally operable to:
For each task in N number of task, the callback information of the task is received;
According to the callback information, judge whether the task runs succeeded;
If the task is to perform failure, it is determined that the task corresponding mission critical in the external queue, and is returned Perform the mission critical.
10. the device as described in any one of claim 6 to 9, it is characterised in that
The thread pool is any one thread pool in thread cell system;Any thread pool in the thread cell system can be obtained Take the corresponding database resource of other thread pools;
The scheduler module is additionally operable to:
According to the implementation status of N number of task, the execution efficiency of the thread pool is judged;
If the execution efficiency of the thread pool is less than predetermined threshold value, is obtained from the thread cell system and substitute thread pool;Institute It is thread pool of the processing speed higher than the thread pool in the thread cell system to state and substitute thread pool;
Untreated task in N number of task is completely or partially adjusted in the corresponding task queue of the replacement thread pool.
CN201611209613.1A 2016-12-23 2016-12-23 Service processing method and device based on thread pool Active CN106802826B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611209613.1A CN106802826B (en) 2016-12-23 2016-12-23 Service processing method and device based on thread pool

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611209613.1A CN106802826B (en) 2016-12-23 2016-12-23 Service processing method and device based on thread pool

Publications (2)

Publication Number Publication Date
CN106802826A true CN106802826A (en) 2017-06-06
CN106802826B CN106802826B (en) 2021-06-18

Family

ID=58985750

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611209613.1A Active CN106802826B (en) 2016-12-23 2016-12-23 Service processing method and device based on thread pool

Country Status (1)

Country Link
CN (1) CN106802826B (en)

Cited By (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107491350A (en) * 2017-09-05 2017-12-19 武汉斗鱼网络科技有限公司 Interface task call method and device
CN108304473A (en) * 2017-12-28 2018-07-20 石化盈科信息技术有限责任公司 Data transmission method between data source and system
CN108958933A (en) * 2018-06-27 2018-12-07 阿里巴巴集团控股有限公司 Configuration parameter update method, device and the equipment of task performer
CN109189564A (en) * 2018-08-01 2019-01-11 北京奇虎科技有限公司 A kind of task processing method and device
CN109471731A (en) * 2018-11-21 2019-03-15 阿里巴巴集团控股有限公司 A kind of data processing, EMS memory management process, device, equipment and medium
CN109558255A (en) * 2018-12-13 2019-04-02 广东浪潮大数据研究有限公司 A kind of method and Task Processing Unit of task processing
CN109634653A (en) * 2018-11-30 2019-04-16 中链科技有限公司 A kind of resource allocation method and device based on component based architecture
CN109814994A (en) * 2019-01-03 2019-05-28 福建天泉教育科技有限公司 A kind of method and terminal of dynamic dispatching thread pool
CN109857535A (en) * 2019-02-18 2019-06-07 国家计算机网络与信息安全管理中心 The implementation method and device of task priority control towards Spark JDBC
CN110096344A (en) * 2018-01-29 2019-08-06 北京京东尚科信息技术有限公司 Task management method, system, server cluster and computer-readable medium
CN110321202A (en) * 2018-03-29 2019-10-11 优酷网络技术(北京)有限公司 Task processing method and device
CN110457124A (en) * 2019-08-06 2019-11-15 中国工商银行股份有限公司 For the processing method and its device of business thread, electronic equipment and medium
CN110457126A (en) * 2019-08-13 2019-11-15 杭州有赞科技有限公司 A kind of asynchronous invoking method and system
CN110532082A (en) * 2019-09-04 2019-12-03 厦门商集网络科技有限责任公司 A kind of task application device and method of task based access control predistribution
CN110647389A (en) * 2019-09-16 2020-01-03 北京镁伽机器人科技有限公司 Task processing method for automatic beverage machine, automatic beverage machine and storage medium
CN110837401A (en) * 2018-08-16 2020-02-25 苏宁易购集团股份有限公司 Hierarchical processing method and device for java thread pool
CN110851245A (en) * 2019-09-24 2020-02-28 厦门网宿有限公司 Distributed asynchronous task scheduling method and electronic equipment
CN111210288A (en) * 2019-12-26 2020-05-29 大象慧云信息技术有限公司 Tax control server-based invoicing batch invoicing job optimized scheduling method and system
CN111290846A (en) * 2020-02-26 2020-06-16 杭州涂鸦信息技术有限公司 Distributed task scheduling method and system
CN111552546A (en) * 2020-04-16 2020-08-18 贝壳技术有限公司 Task implementation method and device based on multithreading and storage medium
CN111737026A (en) * 2020-05-28 2020-10-02 苏州浪潮智能科技有限公司 Multithreading message processing method based on lookup operation
CN111813554A (en) * 2020-07-17 2020-10-23 济南浪潮数据技术有限公司 Task scheduling processing method and device, electronic equipment and storage medium
CN112288198A (en) * 2019-07-22 2021-01-29 北京车和家信息技术有限公司 Task processing system and method
CN112463331A (en) * 2020-12-02 2021-03-09 天津光电通信技术有限公司 Task scheduling optimization implementation method based on JAVA single thread pool
CN112659119A (en) * 2020-12-02 2021-04-16 广东博智林机器人有限公司 Control method and device of mechanical arm, electronic equipment and storage medium
CN113641517A (en) * 2021-08-10 2021-11-12 平安科技(深圳)有限公司 Service data sending method and device, computer equipment and storage medium
CN114116184A (en) * 2022-01-28 2022-03-01 腾讯科技(深圳)有限公司 Data processing method and device in virtual scene, equipment and medium
CN115037702A (en) * 2022-05-23 2022-09-09 北京梧桐车联科技有限责任公司 Message distribution method, data transmission method and equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030236815A1 (en) * 2002-06-20 2003-12-25 International Business Machines Corporation Apparatus and method of integrating a workload manager with a system task scheduler
CN101599027A (en) * 2009-06-30 2009-12-09 中兴通讯股份有限公司 A kind of thread pool management method and system thereof
CN102253860A (en) * 2011-07-13 2011-11-23 深圳市万兴软件有限公司 Asynchronous operation method and asynchronous operation management device
CN103559082A (en) * 2013-11-04 2014-02-05 北京华胜天成科技股份有限公司 Distributed task scheduling method, device and system based on queues
CN103870348A (en) * 2012-12-14 2014-06-18 中国电信股份有限公司 Test method and system for concurrent user access
CN104063279A (en) * 2013-03-20 2014-09-24 腾讯科技(深圳)有限公司 Task scheduling method and device and terminal
CN104407847A (en) * 2014-10-29 2015-03-11 中国建设银行股份有限公司 Batch processing method and device
CN104462370A (en) * 2014-12-09 2015-03-25 北京百度网讯科技有限公司 Distributed task scheduling system and method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030236815A1 (en) * 2002-06-20 2003-12-25 International Business Machines Corporation Apparatus and method of integrating a workload manager with a system task scheduler
CN101599027A (en) * 2009-06-30 2009-12-09 中兴通讯股份有限公司 A kind of thread pool management method and system thereof
CN102253860A (en) * 2011-07-13 2011-11-23 深圳市万兴软件有限公司 Asynchronous operation method and asynchronous operation management device
CN103870348A (en) * 2012-12-14 2014-06-18 中国电信股份有限公司 Test method and system for concurrent user access
CN104063279A (en) * 2013-03-20 2014-09-24 腾讯科技(深圳)有限公司 Task scheduling method and device and terminal
CN103559082A (en) * 2013-11-04 2014-02-05 北京华胜天成科技股份有限公司 Distributed task scheduling method, device and system based on queues
CN104407847A (en) * 2014-10-29 2015-03-11 中国建设银行股份有限公司 Batch processing method and device
CN104462370A (en) * 2014-12-09 2015-03-25 北京百度网讯科技有限公司 Distributed task scheduling system and method

Cited By (39)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107491350A (en) * 2017-09-05 2017-12-19 武汉斗鱼网络科技有限公司 Interface task call method and device
WO2019047376A1 (en) * 2017-09-05 2019-03-14 武汉斗鱼网络科技有限公司 Interface task calling method and device, electronic device and readable storage medium
CN108304473A (en) * 2017-12-28 2018-07-20 石化盈科信息技术有限责任公司 Data transmission method between data source and system
CN108304473B (en) * 2017-12-28 2020-09-04 石化盈科信息技术有限责任公司 Data transmission method and system between data sources
CN110096344A (en) * 2018-01-29 2019-08-06 北京京东尚科信息技术有限公司 Task management method, system, server cluster and computer-readable medium
CN110321202A (en) * 2018-03-29 2019-10-11 优酷网络技术(北京)有限公司 Task processing method and device
CN108958933B (en) * 2018-06-27 2021-12-21 创新先进技术有限公司 Configuration parameter updating method, device and equipment of task executor
CN108958933A (en) * 2018-06-27 2018-12-07 阿里巴巴集团控股有限公司 Configuration parameter update method, device and the equipment of task performer
CN109189564A (en) * 2018-08-01 2019-01-11 北京奇虎科技有限公司 A kind of task processing method and device
CN110837401A (en) * 2018-08-16 2020-02-25 苏宁易购集团股份有限公司 Hierarchical processing method and device for java thread pool
CN109471731A (en) * 2018-11-21 2019-03-15 阿里巴巴集团控股有限公司 A kind of data processing, EMS memory management process, device, equipment and medium
CN109634653A (en) * 2018-11-30 2019-04-16 中链科技有限公司 A kind of resource allocation method and device based on component based architecture
CN109634653B (en) * 2018-11-30 2023-08-01 苏州朗润创新知识产权运营有限公司 Resource allocation method and device based on componentized architecture
CN109558255A (en) * 2018-12-13 2019-04-02 广东浪潮大数据研究有限公司 A kind of method and Task Processing Unit of task processing
CN109814994A (en) * 2019-01-03 2019-05-28 福建天泉教育科技有限公司 A kind of method and terminal of dynamic dispatching thread pool
CN109814994B (en) * 2019-01-03 2021-10-08 福建天泉教育科技有限公司 Method and terminal for dynamically scheduling thread pool
CN109857535B (en) * 2019-02-18 2021-06-11 国家计算机网络与信息安全管理中心 Spark JDBC-oriented task priority control implementation method and device
CN109857535A (en) * 2019-02-18 2019-06-07 国家计算机网络与信息安全管理中心 The implementation method and device of task priority control towards Spark JDBC
CN112288198A (en) * 2019-07-22 2021-01-29 北京车和家信息技术有限公司 Task processing system and method
CN110457124A (en) * 2019-08-06 2019-11-15 中国工商银行股份有限公司 For the processing method and its device of business thread, electronic equipment and medium
CN110457126A (en) * 2019-08-13 2019-11-15 杭州有赞科技有限公司 A kind of asynchronous invoking method and system
CN110532082A (en) * 2019-09-04 2019-12-03 厦门商集网络科技有限责任公司 A kind of task application device and method of task based access control predistribution
CN110647389A (en) * 2019-09-16 2020-01-03 北京镁伽机器人科技有限公司 Task processing method for automatic beverage machine, automatic beverage machine and storage medium
CN110851245A (en) * 2019-09-24 2020-02-28 厦门网宿有限公司 Distributed asynchronous task scheduling method and electronic equipment
CN111210288A (en) * 2019-12-26 2020-05-29 大象慧云信息技术有限公司 Tax control server-based invoicing batch invoicing job optimized scheduling method and system
CN111290846A (en) * 2020-02-26 2020-06-16 杭州涂鸦信息技术有限公司 Distributed task scheduling method and system
CN111290846B (en) * 2020-02-26 2023-08-18 杭州涂鸦信息技术有限公司 Distributed task scheduling method and system
CN111552546A (en) * 2020-04-16 2020-08-18 贝壳技术有限公司 Task implementation method and device based on multithreading and storage medium
CN111737026A (en) * 2020-05-28 2020-10-02 苏州浪潮智能科技有限公司 Multithreading message processing method based on lookup operation
CN111813554A (en) * 2020-07-17 2020-10-23 济南浪潮数据技术有限公司 Task scheduling processing method and device, electronic equipment and storage medium
CN112659119A (en) * 2020-12-02 2021-04-16 广东博智林机器人有限公司 Control method and device of mechanical arm, electronic equipment and storage medium
CN112463331B (en) * 2020-12-02 2022-04-15 天津光电通信技术有限公司 Task scheduling optimization implementation method based on JAVA single thread pool
CN112463331A (en) * 2020-12-02 2021-03-09 天津光电通信技术有限公司 Task scheduling optimization implementation method based on JAVA single thread pool
CN113641517A (en) * 2021-08-10 2021-11-12 平安科技(深圳)有限公司 Service data sending method and device, computer equipment and storage medium
CN113641517B (en) * 2021-08-10 2023-08-29 平安科技(深圳)有限公司 Service data transmitting method, device, computer equipment and storage medium
CN114116184A (en) * 2022-01-28 2022-03-01 腾讯科技(深圳)有限公司 Data processing method and device in virtual scene, equipment and medium
CN114116184B (en) * 2022-01-28 2022-04-29 腾讯科技(深圳)有限公司 Data processing method and device in virtual scene, equipment and medium
CN115037702A (en) * 2022-05-23 2022-09-09 北京梧桐车联科技有限责任公司 Message distribution method, data transmission method and equipment
CN115037702B (en) * 2022-05-23 2024-04-12 北京梧桐车联科技有限责任公司 Message distribution and data transmission methods and equipment

Also Published As

Publication number Publication date
CN106802826B (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN106802826A (en) A kind of method for processing business and device based on thread pool
CN110727512B (en) Cluster resource scheduling method, device, equipment and storage medium
WO2020211579A1 (en) Processing method, device and system for distributed bulk processing system
US8752059B2 (en) Computer data processing capacity planning using dependency relationships from a configuration management database
CN109901920A (en) Method for scheduling task and device, electric terminal
US8108521B2 (en) Methods and systems for dynamic parallel processing
CN111338791A (en) Method, device and equipment for scheduling cluster queue resources and storage medium
CN105892996A (en) Assembly line work method and apparatus for batch data processing
CN101714231A (en) Method and system for managing free workflow without being based on process models
CN105912387A (en) Method and device for dispatching data processing operation
CN111400011B (en) Real-time task scheduling method, system, equipment and readable storage medium
CN114610474B (en) Multi-strategy job scheduling method and system under heterogeneous supercomputing environment
CN103503412B (en) For the method and device of scheduling resource
CN115840631B (en) RAFT-based high-availability distributed task scheduling method and equipment
CN110187956A (en) A kind of the layering real-time task scheduling method and system of multiple agent platform
CN104598304B (en) Method and apparatus for the scheduling in Job execution
CN107832130A (en) A kind of job stream scheduling of banking system performs method, apparatus and electronic equipment
CN111176806A (en) Service processing method, device and computer readable storage medium
CN114461393A (en) Multitask scheduling method, multitask scheduling device, electronic equipment, multitask scheduling system and automatic driving vehicle
CN115168013A (en) Task running system and method and computing device
CN113626173B (en) Scheduling method, scheduling device and storage medium
CN108415740A (en) A kind of workflow schedule method applied to data analysis task
CN108628677A (en) Distributed task scheduling processing system, method and apparatus
CN114327894A (en) Resource allocation method, device, electronic equipment and storage medium
CN112860401A (en) Task scheduling method and device, electronic equipment and storage medium

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