Summary of the invention
To overcome the problems in correlation technique, present description provides the configuration parameter update sides of task performer
Method, device and equipment.
According to this specification embodiment in a first aspect, provide a kind of configuration parameter update method of task performer, use
In the configuration parameter for updating the current ancestral task actuator for accepting task, which comprises
Configuration parameter to be updated is obtained, generates configuration file using the configuration parameter to be updated;
After creating goal task actuator based on the configuration file, received task is distributed to the goal task and is held
Row device.
Optionally, received task is being distributed to the goal task actuator, further includes: nullify described original
Business actuator.
Optionally, ancestral task actuator quilt after all thread process completion tasks of the ancestral task actuator
It nullifies, or is canceled after object time arrival.
It is optionally, described to distribute received task to the goal task actuator, comprising:
The mark of the goal task actuator is sent to task dispatcher, by the task dispatcher by received
Business distribution extremely task performer corresponding with the mark.
Optionally, the task performer includes following one or more: thread pool or object pool.
According to the second aspect of this specification embodiment, a kind of task processing system is provided, comprising:
Dynamic configuration manager, is used for: obtaining configuration parameter to be updated and obtains to be switched task performer mark
Know, task performer mark is sent to task dispatcher;
Actuator administrative unit, is used for: generating configuration file using the configuration parameter, is created based on the configuration file
Task performer;And one or more task performers that management has created;
Task dispatcher is used for: receiving waiting task;And after receiving the task performer mark, by institute
It states waiting task and is sent to the corresponding task performer of the task performer mark.
Optionally, the actuator administrative unit is used for: nullifying the ancestral task actuator.
Optionally, ancestral task actuator quilt after all thread process completion tasks of the ancestral task actuator
It nullifies, or is canceled after object time arrival.
According to the third aspect of this specification embodiment, a kind of configuration parameter updating device of task performer is provided, is used
In the configuration parameter for updating the current ancestral task actuator for accepting task, described device includes:
Module is obtained, is used for: obtaining configuration parameter to be updated, generates configuration text using the configuration parameter to be updated
Part;
Distribution module is used for: based on the configuration file creation goal task actuator after, by received task distribute to
The goal task actuator.
Optionally, received task is being distributed to the goal task actuator, further includes: nullify described original
Business actuator.
Optionally, ancestral task actuator quilt after all thread process completion tasks of the ancestral task actuator
It nullifies, or is canceled after object time arrival.
According to the fourth aspect of this specification embodiment, provide a kind of computer equipment, comprising: memory, processor and
Store the computer program that can be run on a memory and on a processor, wherein the processor executes real when described program
The configuration parameter update method of existing task performer above-mentioned.
The technical solution that the embodiment of this specification provides can include the following benefits:
In the present embodiment, if facing the demand being updated to the configuration parameter of task performer, available new matches
Parameter is set, the present embodiment is generated a new configuration file using the new configuration parameter, can be created based on the configuration file
One new task performer, the present embodiment are known as goal task actuator, and later, which replaces ancestral task
Actuator, new received task dividable is assigned to goal task actuator processing, to reach the configuration for updating task performer
The purpose of parameter.The present embodiment will not interrupt original task processing work, therefore can support dynamic configuration thread pool parameter, when
When portfolio changes, configuration parameter can be adjusted at any time, so as to meet multiple business demand.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not
This specification can be limited.
Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistent with this specification.On the contrary, they are only and such as institute
The example of the consistent device and method of some aspects be described in detail in attached claims, this specification.
It is only to be not intended to be limiting this explanation merely for for the purpose of describing particular embodiments in the term that this specification uses
Book.The "an" of used singular, " described " and "the" are also intended to packet in this specification and in the appended claims
Most forms are included, unless the context clearly indicates other meaning.It is also understood that term "and/or" used herein is
Refer to and includes that one or more associated any or all of project listed may combine.
It will be appreciated that though various information may be described using term first, second, third, etc. in this specification, but
These information should not necessarily be limited by these terms.These terms are only used to for same type of information being distinguished from each other out.For example, not taking off
In the case where this specification range, the first information can also be referred to as the second information, and similarly, the second information can also be claimed
For the first information.Depending on context, word as used in this " if " can be construed to " ... when " or
" when ... " or " in response to determination ".
With the continuous development of Internet technology, the requirement to the processing capacities of the equipment such as terminal or server is increasingly
It is high.For example, at a time, equipment is likely to be received multiple tasks, these tasks how are handled as technical staff and compare pass
The problem of note.
Optionally, equipment can use the processing form of multithreading, as shown in Figure 1, being that this specification is exemplary according to one
Implement a kind of multiple threads schematic diagram exemplified, includes thread pool and task dispatcher;Treatment process includes: to be based on matching
One thread pool of document creation is set, with the configuration parameter of thread pool, such as core-wire number of passes, maximum concurrent thread in this document
Several or thread free time etc.;And waiting task is added to task queue by task dispatcher;Thread pool is in discovery task
After task to be handled arrives in queue, thread can be created and go execution task, one task of a thread process.
After thread pool creation, the configuration parameter of setting is then remained unchanged.For example, maximum can be passed through after thread pool creation
Concurrent thread number is arranged to control the quantity of thread, for example the maximum concurrent thread number of one thread pool of setting is 5, then this
5 threads can be at most created in a thread pool goes processing task.However, since the quantity of waiting task in task queue is
Variation, and maximum concurrent thread number is fixed, the quantity that may cause waiting task in task queue is excessive, especially it is high simultaneously
It sends out under scene, the case where waiting task cannot be performed in time usually occurs.
In practical application, with business development, the demand being updated to the configuration parameter of thread pool may be faced;Example
Such as, increasing due to the upgrading of device hardware functions or service request, needs to expand the maximum concurrent thread number of thread pool.This
When, need to terminate the work of thread pool, therefore task processing can be interrupted, and modify the configuration file of thread pool again later, according to
New configuration file re-creates thread pool, so that the maximum concurrent thread number of thread pool becomes larger.
Demand similar with thread pool, that also there is the task performers such as object pool configuration parameter to update.Thread pool can be used for
Multiple-task is handled, object pool can be used for managing such as index file, web page contents resource task object.Based on this, this explanation
Book embodiment provides a kind of configuration parameter update scheme of task performer, the first task execution to this specification embodiment
The application scenarios of the configuration parameter update method of device are illustrated, as shown in Figure 2 A, several terminal devices, net involved in Fig. 2A
Network and several servers (can also be server cluster, Cloud Server etc.).Network to terminal device and server it
Between provide communication link medium.Network may include various connection types, such as wired, wireless communication link or optical fiber electricity
Cable etc..
User can be used terminal device and be interacted by network with server, to receive or send data etc..Terminal device
On various applications can be installed, such as social category application, web browser applications, the application of search engine class, the application of shopping class,
Instant messaging application or the application of mobile phone assistant's class etc..
Terminal device can be various electronic equipments, including but not limited to smart phone, tablet computer, e-book reading
Device, multimedia player, pocket computer on knee and desktop computer etc..
Server can be to provide the server of various services, such as provide support to the application installed on terminal device
Background server.Background server can receive the request of terminal device and carry out data processing according to request, and will processing
As a result terminal device is fed back to.
The configuration parameter update method of the task performer of this specification embodiment can be executed by server, can also be by
Terminal device executes, and correspondingly, the configuration parameter updating device for task performer can be set in server 1, can also
To be set in terminal device.It should be understood that the number of terminal device, network and server in Fig. 2A is only schematic
's.According to actual needs, any number of terminal device, network and server be can have.
The current task performer for accepting task is known as ancestral task actuator in the present embodiment, if ancestral task executes
The configuration parameter of device needs to update, and equipment can apply a kind of configuration parameter update method of task performer as shown in Figure 2 B,
Method includes the following steps:
In step 202, Actuator configuration parameter to be updated is obtained, is generated and is configured using the Actuator configuration parameter
File.
In step 204, based on the configuration file creation goal task actuator after, by received task from distribution to
The ancestral task actuator switching is distributed to the goal task actuator.
It updates schematic diagram in conjunction with a kind of configuration parameter of task performer shown in fig. 2 C and is illustrated, in the present embodiment,
If facing the demand being updated to the configuration parameter of task performer, available new configuration parameter, the present embodiment is utilized
The new configuration parameter generates a new configuration file, can create a new task performer based on the configuration file, this
Embodiment is known as goal task actuator, and later, which replaces ancestral task actuator and accept task, newly connects
The task dividable of receipts is assigned to goal task actuator processing, to achieve the purpose that the configuration parameter for updating task performer.
The present embodiment will not interrupt original task processing work, therefore can support dynamic configuration parameters, can when portfolio changes
To adjust configuration parameter at any time, so as to meet multiple business demand.
After creation has goal task actuator, two task performers involved in the present embodiment: ancestral task is executed
Device and goal task actuator, optionally, ancestral task actuator and goal task actuator can have unique identification, the mark
Ancestral task actuator and goal task actuator can uniquely be distinguished using modes such as title, pointer address by knowing.?
In some examples, task is accepted using task dispatcher, and received task is distributed into task performer;Task dispatcher needs
The mark of task performer is got, so that task dispatcher is able to know that this distributes task to which task execution
Device.It is therefore, described that by received task, from distribution to the ancestral task actuator, switching distribution, can to the subject thread pond
To include:
The mark of the goal task actuator is sent to task dispatcher, notifies the task dispatcher will be received
From distribution to the ancestral task actuator, switching is distributed to the goal task actuator task.
Wherein, goal task actuator realizes the configuration parameter to task performer instead of ancestral task actuator
Update, ancestral task actuator no longer needs to accept new task, can in order to discharge the occupied resource of ancestral task actuator
To distribute by received task to the task performer, the ancestral task actuator is nullified.
The opportunity of the cancellation can according to need flexible configuration, in some instances, can be in goal task actuator
It is directly nullified after undertaking task;In some instances, it has accepted some tasks due to ancestral task actuator handled, such as
Fruit, which is directly nullified, will lead to these task processing failures, therefore can be and infused after all tasks of undertaking are completed in processing
Pin.In other examples, it is possible to which ancestral task actuator needs consume a longer time processing, and these have accepted task, and examine
Considering ancestral task actuator may be larger to resource occupation, therefore is also possible to set an object time, in the object time
After arrival, regardless of whether completing all tasks in ancestral task actuator, all ancestral task actuator is nullified, to discharge money
Source.Wherein, which can flexibly determine according to actual needs.
The configuration parameter update method of above-mentioned task performer is applicable to task processing scene, as shown in figure 3, being this theory
A kind of bright book configuration diagram of task processing system shown according to an exemplary embodiment, comprising:
Dynamic configuration manager 31, is used for: obtaining configuration parameter to be updated and obtains to be switched task performer
Task performer mark is sent to task dispatcher by mark.
Actuator administrative unit 32, is used for: generating configuration file using the configuration parameter, is created based on the configuration file
Build task performer;And one or more task performers that management has created.
Task dispatcher 33, is used for: receiving waiting task;It, will and after receiving the task performer mark
The waiting task is sent to the task performer and identifies corresponding task performer.
In the task management system of the present embodiment, actuator administrative unit can manage at least one task performer, appoint
Business actuator is for handling task;The creation process of task performer can be and generate configuration file using configuration parameter, is based on
The configuration file creates to obtain.Since the configuration parameter progress to task performer with business development, may be faced more
New demand.The present embodiment realizes configuration parameter by way of creating another task performer and replacing existing task performer
It updates.
It is provided with dynamic configuration manager in the present embodiment, can be used for obtaining configuration parameter to be updated;This is to be updated
Configuration parameter, can be and configured by technical staff, be also possible to be obtained by dynamic configuration manager according to setting strategy is automatic.
After getting new configuration parameter, actuator administrative unit can use the configuration parameter to be updated and generate new configuration text
Part creates new task performer based on the configuration file.In the case where there is one or more task performers, task tune
Degree device needs are identified according to task performer, and the waiting task is sent to the task performer and identifies corresponding task
Actuator.The task dispatcher new task performer can be notified after creating new task performer based on above-mentioned framework
Mark, waiting task is sent to by newly created task performer by task dispatcher, old task performer is no longer
Undertaking task, to realize the update to configuration parameter.
In the present embodiment, appointing for task is accepted before the dynamic configuration manager receives the task performer mark
Business actuator is ancestral task actuator, and the actuator administrative unit is used for: receiving institute in the dynamic configuration manager
After stating task performer mark, the ancestral task actuator is nullified, to discharge the occupied resource in primary thread pond.
Optionally, the actuator administrative unit is used for: being nullified after the ancestral task actuator handles completion task
The ancestral task actuator, or the ancestral task actuator is nullified after object time arrival.In some instances, due to
Ancestral task actuator has been accepted some tasks and has been handled, and will lead to these task processing failures if directly nullified, because
This can be is unregistered after all tasks of undertaking are completed in processing.In other examples, it is possible to which ancestral task executes
Device needs consume a longer time processing, and these have accepted task, and in view of ancestral task actuator may to resource occupation compared with
Greatly, therefore it is also possible to set an object time, after object time arrival, regardless of whether completing in ancestral task actuator
All tasks, all nullify ancestral task actuator, to discharge resource.
Corresponding with the embodiment of configuration parameter update method of foregoing task actuator, this specification additionally provides task
The configuration parameter updating device of actuator and its embodiment of applied computer equipment.
The embodiment of the configuration parameter updating device of this specification task performer can be applied on a computing device, example
Such as server or terminal device.Installation practice can also pass through hardware or software and hardware combining by software realization
Mode is realized.It taking software implementation as an example, is the processor by file process where it as the device on a logical meaning
Computer program instructions corresponding in nonvolatile memory are read into memory what operation was formed.For hardware view,
As shown in figure 4, one kind for computer equipment where the configuration parameter updating device of this specification embodiment task performer is hard
Part structure chart, in addition to processor 410 shown in Fig. 4, memory 430, network interface 420 and nonvolatile memory 440 it
Outside, the server or electronic equipment in embodiment where device 431 may be used also generally according to the actual functional capability of the computer equipment
To include other hardware, this is repeated no more.
As shown in figure 5, Fig. 5 is a kind of this specification configuration ginseng of task performer shown according to an exemplary embodiment
The block diagram of number updating device, for updating the configuration parameter of the current ancestral task actuator for accepting task, described device includes:
Module 51 is obtained, is used for: obtaining configuration parameter to be updated, generates configuration using the configuration parameter to be updated
File;
Distribution module 52, is used for: after configuration file creation goal task actuator, received task being distributed
To the goal task actuator.
Optionally, received task is being distributed to the goal task actuator, further includes: nullify described original
Business actuator.
Optionally, ancestral task actuator quilt after all thread process completion tasks of the ancestral task actuator
It nullifies, or is canceled after object time arrival.
Optionally, the distribution module, is also used to:
The mark of the goal task actuator is sent to task dispatcher, by the task dispatcher by received
Business distribution extremely task performer corresponding with the mark.
Optionally, the task performer includes following one or more: thread pool, object pool or resource pool.
The function of modules and the realization process of effect are specific in the configuration parameter updating device of above-mentioned task performer
It is detailed in the realization process that step is corresponded in the configuration parameter update method of above-mentioned task performer, details are not described herein.
For device embodiment, since it corresponds essentially to embodiment of the method, so related place is referring to method reality
Apply the part explanation of example.The apparatus embodiments described above are merely exemplary, wherein described be used as separation unit
The module of explanation may or may not be physically separated, and the component shown as module can be or can also be with
It is not physical module, it can it is in one place, or may be distributed on multiple network modules.It can be according to actual
The purpose for needing to select some or all of the modules therein to realize this specification scheme.Those of ordinary skill in the art are not
In the case where making the creative labor, it can understand and implement.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
Those skilled in the art will readily occur to this specification after considering specification and practicing the invention applied here
Other embodiments.This specification is intended to cover any variations, uses, or adaptations of this specification, these modifications,
Purposes or adaptive change follow the general principle of this specification and do not apply in the art including this specification
Common knowledge or conventional techniques.The description and examples are only to be considered as illustrative, the true scope of this specification and
Spirit is indicated by the following claims.
It should be understood that this specification is not limited to the precise structure that has been described above and shown in the drawings,
And various modifications and changes may be made without departing from the scope thereof.The range of this specification is only limited by the attached claims
System.
The foregoing is merely the preferred embodiments of this specification, all in this explanation not to limit this specification
Within the spirit and principle of book, any modification, equivalent substitution, improvement and etc. done should be included in the model of this specification protection
Within enclosing.