CN107832126A - The method of adjustment and its terminal of a kind of thread - Google Patents
The method of adjustment and its terminal of a kind of thread Download PDFInfo
- Publication number
- CN107832126A CN107832126A CN201710985525.9A CN201710985525A CN107832126A CN 107832126 A CN107832126 A CN 107832126A CN 201710985525 A CN201710985525 A CN 201710985525A CN 107832126 A CN107832126 A CN 107832126A
- Authority
- CN
- China
- Prior art keywords
- thread
- task
- upper limit
- waiting task
- waiting
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/484—Precedence
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Computer And Data Communications (AREA)
Abstract
The present invention is applied to field of computer technology, there is provided the method for adjustment and its terminal of a kind of thread, including:The task number that includes is inquired about in waiting task storehouse at predetermined intervals;The upper limit is started according to task number and default thread, it is determined that current thread starts number;Based on the priority of each waiting task, the waiting task that extraction matches with thread startup number from waiting task storehouse;Start thread corresponding with thread startup number, and waiting task is responded by thread.The present invention solves the method for adjustment of existing thread, the quantity of thread is changeless, if in heavy traffic period, the thread of startup possibly can not meet current portfolio, so as to cause waiting task to overstock, so as to reduce the efficiency of service response, even result in the failure of substantial amounts of task or time-out, reduce server service quality and user usage experience the problem of.
Description
Technical field
The invention belongs to the method for adjustment and its terminal of field of computer technology, more particularly to a kind of thread.
Background technology
With the continuous development of scientific technology, the type service that user can be completed by network is also more and more, thus takes
The traffic pressure of business device also increases therewith, it is generally the case that the business that server is initiated client by the way of concurrent processing
Responded, specifically, server is by starting a plurality of thread while handling multiple service requests.But the adjustment of existing thread
Method, the quantity of thread is changeless, if in heavy traffic period, the thread of startup possibly can not meet current business
Amount, so as to cause waiting task to overstock, so as to reduce the efficiency of service response, even result in substantial amounts of task failure or super
When, reduce the service quality of server and the usage experience of user.
The content of the invention
In view of this, the embodiments of the invention provide a kind of method of adjustment of thread and its terminal, to solve existing thread
Method of adjustment, the quantity of thread is changeless, if in heavy traffic period, the thread of startup possibly can not meet current
Portfolio, so as to cause waiting task to overstock, so as to reduce the efficiency of service response, even result in substantial amounts of task and lose
Effect or time-out, reduce server service quality and user usage experience the problem of.
The first aspect of the embodiment of the present invention provides a kind of method of adjustment of thread, the method for adjustment bag of the thread
Include:
The task number that includes is inquired about in waiting task storehouse at predetermined intervals;
The upper limit is started according to the task number and default thread, it is determined that current thread starts number;
Based on the priority of each waiting task, extraction and thread startup number from the waiting task storehouse
The waiting task of matching;
Start thread corresponding with thread startup number, and pass through the thread and respond the waiting task.
The second aspect of the embodiment of the present invention provides a kind of terminal device, including memory, processor and is stored in
In the memory and the computer program that can run on the processor, described in the computing device during computer program
Realize following steps:
The task number that includes is inquired about in waiting task storehouse at predetermined intervals;
The upper limit is started according to the task number and default thread, it is determined that current thread starts number;
Based on the priority of each waiting task, extraction and thread startup number from the waiting task storehouse
The waiting task of matching;
Start thread corresponding with thread startup number, and pass through the thread and respond the waiting task.
The third aspect of the embodiment of the present invention provides a kind of computer-readable recording medium, the computer-readable storage
Media storage has computer program, and the computer program realizes following steps when being executed by processor:
The task number that includes is inquired about in waiting task storehouse at predetermined intervals;
The upper limit is started according to the task number and default thread, it is determined that current thread starts number;
Based on the priority of each waiting task, extraction and thread startup number from the waiting task storehouse
The waiting task of matching;
Start thread corresponding with thread startup number, and pass through the thread and respond the waiting task.
The method of adjustment and its terminal for implementing a kind of thread provided in an embodiment of the present invention have the advantages that:
The task number that the embodiment of the present invention is included by inquiring about at predetermined intervals in waiting task storehouse, and root
Current thread is adjusted in real time according to the task number and starts number, so that the service response ability of terminal device is waited to locate with current
The quantity of reason task matches;Terminal device is after determining that thread starts number, then from waiting task storehouse, based on each
The priority of waiting task, the extraction waiting task consistent with thread startup number from waiting task storehouse, and carry out
Response, it is achieved thereby that the thread of dynamic adjustment terminal device starts the purpose of number.Compared with existing service response technology,
The startup number of threads of server keeps constant, when waiting task is less, thread startup but free time easily occurs, wastes
The resource of server, when waiting task is more, the number that current thread starts will not be increased again, easily cause task to be accumulated
The situation of pressure, and the present embodiment every time to waiting task carry out batch concurrently respond before, will be according to currently pending
The waiting task that includes in business storehouse, adjust current thread and start number, so as to reached in each service response cycle when
Carve, the service response ability and current number of tasks for keeping terminal device match, and improve efficiency and the end of service response
The service quality of end equipment, provide the user more preferable usage experience.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, below will be to embodiment or description of the prior art
In the required accompanying drawing used be briefly described, it should be apparent that, drawings in the following description be only the present invention some
Embodiment, for those of ordinary skill in the art, without having to pay creative labor, can also be according to these
Accompanying drawing obtains other accompanying drawings.
Fig. 1 is a kind of implementation process figure of the method for adjustment for thread that first embodiment of the invention provides;
Fig. 2 is a kind of method of adjustment S102 for thread that second embodiment of the invention provides specific implementation flow chart;
Fig. 3 is a kind of specific implementation flow chart of the method for adjustment for thread that third embodiment of the invention provides;
Fig. 4 is a kind of method of adjustment S102 for thread that fourth embodiment of the invention provides specific implementation flow chart;
Fig. 5 is a kind of method of adjustment S103 for thread that fifth embodiment of the invention provides specific implementation flow chart;
Fig. 6 is a kind of structured flowchart of the adjustment terminal for thread that one embodiment of the invention provides;
Fig. 7 is a kind of schematic diagram for terminal device that one embodiment of the invention provides.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.
The task number that the embodiment of the present invention is included by inquiring about at predetermined intervals in waiting task storehouse, and root
Current thread is adjusted in real time according to the task number and starts number, so that the service response ability of terminal device is waited to locate with current
The quantity of reason task matches;Terminal device is after determining that thread starts number, then from waiting task storehouse, based on each
The priority of waiting task, the extraction waiting task consistent with thread startup number from waiting task storehouse, and carry out
Response, it is achieved thereby that the thread of dynamic adjustment terminal device starts the purpose of number, solve the method for adjustment of existing thread,
The quantity of thread is changeless, if in heavy traffic period, the thread of startup possibly can not meet current portfolio, from
And cause waiting task to overstock, so as to reduce the efficiency of service response, substantial amounts of task failure or time-out are even resulted in, drop
The problem of service quality of low server and the usage experience of user.
In embodiments of the present invention, the executive agent of flow is the terminal device for being provided with thread adjustment programme, and terminal is set
Standby to include the terminals such as mobile phone, computer equipment, tablet personal computer, especially, the terminal device is specially a server, for receiving
The service request of each user terminal initiation is simultaneously responded, and response results then are returned into corresponding user terminal, so as to
Realize the operation of service response.Fig. 1 shows the implementation process figure of the method for adjustment for the thread that first embodiment of the invention provides,
Details are as follows:
In S101, the task number that includes is inquired about in waiting task storehouse at predetermined intervals.
In the present embodiment, terminal device then appoints processing after the processing task of other users terminal transmission is received
In business storage and waiting task storehouse, when machine reaches when treated, according to the priority of each waiting task and to connect
Order is received, corresponding waiting task is extracted and is responded.
It should be noted that the waiting task storehouse can be in the local storage of terminal device, and in this case, terminal
Equipment directly reads local storage, you can obtains the relevant information of waiting task;Waiting task storehouse can also be one only
Vertical storage server, specially receive and store the processing task that each user terminal is sent.Because terminal device needs simultaneously
The processing task that multiple user terminals are sent is responded, that is, needs to distribute certain port number, to perform the reception of processing task
Operation, on the other hand, terminal device also need result returning to user's end after waiting task corresponding to response completion
End, now, return to operation needs to call certain port number again.Therefore, terminal device is in order to improve the effect of its service response
Rate, an independent storage server can will be set, the port of respective numbers is set, the processing that other users terminal is sent is received and appoint
Business, terminal device only needed between waiting task storehouse, establish a data link be used for obtain needs waiting task i.e.
Can, other ports can be used for the result of generation feeding back to user terminal.
In the present embodiment, terminal device inquires about in waiting task storehouse the task included at predetermined intervals
Number, wherein, the default time interval is specially the task extracting cycle of terminal device.There is terminal device default task to carry
Cycle and task response cycle are taken, terminal device will extract phase when reaching task extracting cycle from waiting task storehouse
The waiting task of quantity is answered, and enters task response cycle.In task response cycle, terminal device passes through multiple threads pair
The waiting task of extraction is responded, and can't extract waiting task from waiting task storehouse, and week is responded in task
After phase, if arriving again at start-up time corresponding to task extracting cycle, circulation performs the operation of extraction waiting task.
And the step of S101 of the present embodiment offer, then enters the operation performed during task extracting cycle for terminal device.Illustratively,
Such as default time interval is 2 minutes, then terminal device will inquire about in waiting task storehouse including for task in every two minutes
Number, then the task in the waiting task storehouse is responded.Certainly, the duration of default time interval can be according to user
Actual demand be configured, such as 30 seconds, 10 minutes etc., whether rush hour section can also be belonged to according to current slot,
Adjust the default time interval.
Alternatively, in the present embodiment, also include before S101:Pass through default waiting task checking algorithm, school
The legitimacy and integrality of waiting task are tested, if verifying successfully, is stored in waiting task storehouse, and perform S101 phase
Close operation;Conversely, if verification failure, abandons the task requests, and return to the illegal information of task and be given to corresponding user's end
End.By above-mentioned means, terminal device can pre-process to waiting task before treatment, most of illegal so as to filter out
Task, not only reduce the service response pressure of terminal device, moreover it is possible to discharge the memory space in more waiting task storehouses, be used for
Preserve other effective waiting tasks.
In S102, the upper limit is started according to the task number and default thread, it is determined that current thread startup
Number.
In the present embodiment, terminal device then obtains pre- after the task number included in obtaining waiting task storehouse
If thread start the upper limit, judge that task number and thread start the size of both upper limits, determine whether can be each
Individual waiting task distributes an independent thread and responded.If task number, which is less than or equal to thread, starts the upper limit, table
Show can be that each waiting task sets a thread, to respond above-mentioned waiting task, now current thread starts
Number is task number;Conversely, if task number, which is more than default thread, starts the upper limit, then it represents that can not be the quantity of task
More than openable number of threads, i.e., in this subtask response cycle, the waiting task of whole can not be responded, therefore
The thread startup upper limit is arranged to current thread and starts number.
Alternatively, in the present embodiment, terminal device can also be that thread corresponding to each task type is set starts
The upper limit.In this case, terminal device not only obtains the task number included in pending task library in S101, always according to respectively
Task number corresponding to each task type is counted, then opens the task number of each task type with corresponding thread
The dynamic upper limit is compared, and obtains the thread promoter number of each task type, so as to pass through multiple thread promoter numbers
Calculate current thread and start number.Terminal device is in order in every subtask response cycle, except response priority is higher
Task outside, certain resource has also been reserved to respond the relatively low task of priority, so as to avoid the relatively low task of priority
Type is delayed execution always, thus for each task type set corresponding to thread start the upper limit, so as to it is balanced each
The number of responses of task type.
Illustratively, terminal device is net recommendation server, the net recommendation sent for responding each user terminal
Service request, the wherein net recommendation service request include but is not limited to:Influence clothes of the user to the net recommendation of interactive object
Business, such as online service consulting, suggestion feedback reply, failure declare processing, are also included within and calculate the net recommendation mistake of interactive object
Respective service request in journey, such as sample operations feedback opinion collection service request, sample operations feedback opinion sends service please
Ask.Because net recommendation service request typically has stronger real-time, therefore, wait to locate when net recommendation server detects
Net recommendation service request is included in reason task library, then can preferentially be handled.If in some period, net recommendation server
Substantial amounts of net recommendation service request is persistently obtained, and because the priority of the service request is higher, server is at each
Net recommendation service request is only responded in business response cycle, then other service requests can be caused to cannot respond to.Therefore, net recommendation
Server starts the upper limit, such as the net recommendation service for entirety for thread corresponding to different service request type settings
Device, it is 100 that its thread, which starts the upper limit, and it is 80 that thread corresponding to net recommendation service request, which starts the upper limit, other kinds of clothes
It is 20 that the thread of business request, which starts the upper limit,.It can be seen that server ensure preferentially to respond net recommendation service request it is same
When, certain threading service has been reserved to respond other kinds of service request, so as to reasonably distribute Service Source.
Preferably for such scheme, the task number of the first kind is less than corresponding thread and starts the upper limit, and
The task number of Second Type is more than corresponding thread and starts the upper limit, now, the remaining line of task number of the first kind
Journey, the task available for response Second Type.Illustrative, the task number of the first kind is 15, and its corresponding first thread
Start the upper limit be 30, therefore, terminal device distribute to the task of the first kind resource there remains 15 threads will be in sky
In the spare time, other kinds of task can be responded.Now, terminal device determines that the task number of Second Type is 25, and its corresponding second
It is 20 that thread, which starts the upper limit, therefore in remaining 15 threads in the thread of the first kind, can will extract 5 threads and be used to respond
The task of Second Type, so as to according to actual conditions, rationally call the resource of each type.
In S103, based on the priority of each waiting task, extraction and the line from the waiting task storehouse
The waiting task of Cheng Qidong numbers matching.
In the present embodiment, terminal device obtains the priority of each waiting task first, and according to true in S102
Fixed current startup number of threads N, N number of waiting task of highest priority is extracted from waiting task storehouse, be used as this
The waiting task that subtask responding process performs.
In the present embodiment, the priority of waiting task can be entered by task initiator by the user of task requests
Row is set, and user is when generate waiting task, then the priority of setting waiting task, so that terminal device is treated receiving
During processing task, its corresponding priority can be based on, it is determined that corresponding response opportunity.Specifically, user directly sets priority
Parameter, such as priority byte in waiting task, set corresponding parameter value;Can also be by limiting task feedback time
Mode, the priority of waiting task is set indirectly, such as the higher waiting task of priority, it is corresponding predetermined anti-
It is shorter to present the time;And the relatively low waiting task of priority is corresponded to, its corresponding feedback on reservation time is longer.
In the present embodiment, the priority of waiting task can also be configured by terminal device.Specifically, terminal is set
The standby task type according to waiting task, default task type and priority corresponding relations list are inquired about, so that it is determined that treating
The priority of processing task, and generate the corresponding relation list of waiting task and priority.Terminal device is performing S103's
During operation, then the corresponding relation list of the waiting task and priority is directly read, you can determine each waiting task pair
Answer priority.Preferably, the waiting task in the corresponding relation list of waiting task and priority, according to the big of priority
Small order, is ranked up successively, if priority identical waiting task, the sequencing that the time is obtained according to task is carried out
Sequence, so as to which terminal device directly intercepts waiting task corresponding with thread startup number N, without obtaining priority letter one by one
After breath, then extracted, improve task response efficiency.
In S104, start thread corresponding with thread startup number, and by waiting to locate described in thread response
Reason task.
In the present embodiment, terminal device starts number according to the thread determined in S102, starts corresponding quantity
Thread, and the thread by having been turned on responds the waiting task for extracting to obtain in S103.Specifically, each thread responds
One waiting task, so as to realize purpose that multiple waiting tasks concurrently respond.
In the present embodiment, after a certain thread of terminal device has completed a waiting task, then obtain corresponding to the task
User's mark is asked, and is identified according to request user, task result is fed back to corresponding to request user mark eventually
End.Wherein, the operation of result feedback can transfer to the thread for responding the waiting task to perform, and can also have been performed in thread
Into after task, the network address of result and counterpart terminal is sent to result sending module, transfers to result
Sending module uniformly carries out the transmission operation of task result.
Alternatively, in the present embodiment, terminal device can collect the result of all thread generations of this response cycle
Afterwards, just unify result feeding back to corresponding user terminal.In this case, because some waiting tasks may relate to
And data operation quantity it is less, therefore the thread for handling the waiting task of the type can more early complete response operation, and locate
It is uniformly to be transmitted to manage result, i.e., above-mentioned thread is in idle condition.In this case, terminal device can arrange the free time
Thread supports the slower thread of progress, i.e., by two threads while the slower waiting task of implementation progress, so as to comparatively fast appoint
The speed of response of business and the utilization rate of resource.
Above as can be seen that a kind of method of adjustment of thread provided in an embodiment of the present invention passes through at predetermined intervals
The task number included in inquiry waiting task storehouse, and current thread is adjusted according to the task number in real time and starts number,
So that the service response ability and the quantity of current waiting task of terminal device match;Terminal device is determining thread
After starting number, then from waiting task storehouse, based on the priority of each waiting task, extracted from waiting task storehouse
The waiting task consistent with thread startup number, and responded, it is achieved thereby that the thread of dynamic adjustment terminal device opens
The purpose of dynamic number.Compared with existing service response technology, the startup number of threads of server keeps constant, when pending
When being engaged in less, easily there is thread startup but free time, waste the resource of server, when waiting task is more, again will not
Increase the number that current thread starts, easily cause the overstocked situation of task, and the present embodiment is every time to waiting task
Before concurrently respond in batches, by according to the waiting task included in currently pending task library, current thread is adjusted
Start number, so as at the time of reaching in each service response cycle, keep the service response ability of terminal device with currently
Number of tasks matches, and improves the efficiency of service response and the service quality of terminal device, provides the user more preferable use
Experience.
Fig. 2 shows a kind of method of adjustment S102 for thread that second embodiment of the invention provides specific implementation flow
Figure.Shown in Figure 2, relative to embodiment described in Fig. 1, a kind of method of adjustment S102 for thread that the present embodiment provides also includes
Following steps, details are as follows:
Further, it is described that the upper limit is started according to the task number and default thread, it is determined that current thread opens
Dynamic number, including:
In S201, the temporal information at current time is obtained.
In the present embodiment, the default thread startup upper limit changes with time and changed in terminal device, i.e., not
Same period, corresponding thread start the upper limit.For example, for free time section, terminal device average received is waited to locate
Reason task quantity is typically less, and now, terminal device need not be operated in full load condition, but can be progressively to pending
Task is responded, therefore the thread startup upper limit is smaller;Conversely, in peak hours/period, terminal device largely treats lasting reception
Processing task, now, terminal device can be at full load condition, avoids waiting task bulk deposition and causes batch tasks to be lost
Effect.
In the present embodiment, terminal device, will be true after the task number included during currently pending task library is determined
Determine the temporal information at current time.Wherein, the temporal information can be absolute temporal information, such as 18:53, uniquely determine current
Time;The temporal information can also be relative temporal information, such as the duration of terminal device operation, the duration of fully loaded pattern
For representing the temporal information of terminal device running status.In this case, terminal device defines each operational mode most
Big run time, if the run time of the temporal information at current time, i.e. operational mode is more than maximum run time, then switch
The operational mode of the terminal device, and correspondingly adjust current thread and start the upper limit, so as to which keeper passes through configuration response
Operational mode starts upper limit relation list with thread, then the thread that can adjust terminal device in real time starts the upper limit.
In S202, start the corresponding relation of the upper limit and temporal information based on default thread, determine the temporal information
The corresponding thread starts the upper limit.
In the present embodiment, terminal device is previously stored with the thread startup upper limit corresponding to each different temporal information,
And generate the corresponding relation that thread starts the upper limit and temporal information.Wherein, the corresponding relation can be from the upper clothes of terminal device
Obtained in business device, the upper server determines each equipment in different time by obtaining the running situation of multiple terminal devices
Thread starts the upper limit corresponding to section, then generates the general thread for being applied to an each terminal device startup and reaches the standard grade and believes with the time
The corresponding relation of breath.Therefore, each terminal device can directly obtain the corresponding relation from upper server, and store and local
Memory module in.
In the present embodiment, user can generate the thread and start the upper limit and temporal information according to the use demand of reality
Corresponding relation, it can also be adjusted based on existing corresponding relation.For the ease of management, terminal device sets so as to system default
The corresponding relation that the thread starts the upper limit and temporal information is generated outside the mode put, user can also be allowed to be generated or adjusted.
Terminal device will inquire about default the thread startup upper limit and temporal information after current temporal information is determined
Corresponding relation, determine that current time corresponds to thread and starts the upper limit, then perform S203 associative operation.
In S203, the thread starts the upper limit according to corresponding to the task number and the temporal information, it is determined that
Current thread starts number.
In the present embodiment, terminal device will be waited to hold after being determined that thread corresponding to current time information starts the upper limit
Compared with the task number included in row task library and thread start the upper limit, above-mentioned less numerical value in both is chosen as working as
Preceding thread starts number.
In embodiments of the present invention, the numerical value of the thread startup upper limit is not changeless, but can be according to different
Temporal information is adjusted, and so as to effectively utilize the thread resources of terminal device, is avoided the unnecessary wasting of resources, is improved
The utilization ratio of resource, and the flexibility of terminal device.Especially, terminal device may be for a long time in full in peak hours/period
It is operated under load or the pattern of overload, therefore in order to provide terminal device certain phase buffer, it is whole in non-rush hour section
End equipment may be at loading it is less in the state of work.For example, a certain task extracting cycle between at one's leisure, terminal device
Detect and 100 waiting tasks are included in waiting task storehouse, and it is 50 that thread corresponding to the moment, which starts the upper limit, and under
One extracting cycle database does not receive new waiting task, therefore, terminal device can by two task response cycles,
, should although terminal device starts the upper limit in peak hours/period thread can reach 100 to perform above-mentioned 100 waiting tasks
Period is free time section, i.e., in the period, the mathematical expectation of the task amount of waiting task is less, not during president
Between persistently get substantial amounts of waiting task, therefore relatively low thread can be kept to start the upper limit, even if running into what burst increased
Waiting task, still can progressively it be responded.
Fig. 3 shows a kind of specific implementation flow chart of the method for adjustment for thread that third embodiment of the invention provides.Ginseng
As shown in Figure 3, a kind of method of adjustment of the thread provided relative to embodiment described in Fig. 2, the present embodiment is further comprising the steps of,
Details are as follows:
Further, before S101, the method for adjustment of the thread also includes:
In S301, history service response record is obtained;Wherein, the history service response record includes each period
Waiting task information and hardware resource operation information.
In the present embodiment, terminal device will generate corresponding pending after the pending task of every secondary response
Business response record, wherein, the waiting task response record specifically includes:When responding opening time, response deadline, performing
The information such as length, hardware resource occupancy situation, response waiting time.Terminal device obtain corresponding to each waiting task appoint
It is engaged in after response record, then can determines the quantity of waiting task included in different time sections, and the end of each period
The Expenditure Levels of the overall hardware resource of end equipment, then generate history service response record.
In the present embodiment, hardware resource operation information includes but is not limited to following a kind of or at least two combinations:CPU
Running situation, the occupancy situation of internal memory, the running temperature of terminal device, reading and writing data speed etc..Because hardware resource is run
Information except internal factors such as the task quantity with currently responding mutually outside the Pass, also with outside such as computer room temperature, voltage, power etc. because
Pass is known as, therefore, terminal device not only obtains the waiting task information of each period, also obtains hardware resource operation letter
Breath, and history service response record corresponding to generating, during to determine that thread starts the upper limit, it is outer both to consider that internal factor further contemplated
Influence factor of portion's environment to terminal device.
In S302, recorded based on the history service response, generate pair that the thread starts the upper limit and temporal information
It should be related to.
In the present embodiment, different time sections or task extracting cycle during terminal device records according to history service response
Corresponding pending number of tasks, determine pending number of tasks average in each period, so as to obtain pending number of tasks with
The variation tendency of time passage.Terminal device is based on the pending number of tasks variation tendency, obtain determine thread start the upper limit with
The factor I of the corresponding relation of temporal information.
In the present embodiment, different time sections or task extracting cycle during terminal device records according to history service response
Corresponding hardware running information, determine the running status of terminal device in each period, the running status include loading condition,
Operational efficiency situation and abnormality incidence, so as to obtain the variation tendency of running status over time.Terminal device is based on
The running status variation tendency, obtain determining the factor Ⅱ for the corresponding relation that thread starts the upper limit and temporal information.
In the present embodiment, terminal device starts the upper limit and temporal information according to factor I and factor Ⅱ generation thread
Corresponding relation.Alternatively, factor I specially averagely performs number of tasks, and factor Ⅱ is hardware operational efficiency, therefore appoints
Thread corresponding to one period starts the upper limit:Averagely perform number of tasks × hardware operational efficiency.Illustrative, 8:00 to 8:10 this
In one period, the pending number of tasks that terminal device average received arrives is 50, and the speed of period hardware operation reaches volume
Determine operating rate, therefore operational efficiency is 100%, therefore the thread startup upper limit is corresponding to the period:50 × 100%=
50.Certainly, the factor I can be the pending number of tasks of period maximum in historical record or minimum pending
The mathematic expectaion for number or the pending number of tasks of being engaged in, is not limited one by one herein.Then, factor Ⅱ can also be according to fortune
Proportionality coefficient corresponding to the determination of row state, is not also limited, specifically, the running status of terminal device is better, i.e., one by one herein
Load is less, operational efficiency is higher and/or abnormality incidence is lower, and its corresponding proportionality coefficient is bigger, then terminal device is at this
Period can respond more pending tasks, therefore the thread startup upper limit is higher;Conversely, the operating state of terminal device is got over
Difference, its corresponding proportionality coefficient are smaller.Wherein, the proportionality coefficient is the positive number more than 0.
In embodiments of the present invention, terminal device can also record according to history service response, to thread start the upper limit with
The corresponding relation list of temporal information is adjusted, and based on above-mentioned purpose, the history service that terminal device obtains the machine first rings
It should record, then be learnt by history service response record, improve the accuracy of corresponding relation list.
Fig. 4 shows a kind of method of adjustment S102 for thread that fourth embodiment of the invention provides specific implementation flow
Figure.It is shown in Figure 4, relative to embodiment described in Fig. 1 to Fig. 3, institute in a kind of method of adjustment for thread that the present embodiment provides
State and the upper limit is started according to the task number and default thread, it is determined that current thread starts number, also comprising S401~
S405, details are as follows:
In S401, judge whether the task number is more than the thread and starts the upper limit.
In S402, if the task number be more than the thread start the upper limit, judge the task number with it is described
Whether the first ratio that thread starts between the upper limit is more than default up-regulation activation threshold value.
In the present embodiment, the thread of terminal device starts the upper limit and can be adjusted according to currently practical task number,
So that the task disposal ability of terminal device matches with current task amount.It is according to management because default thread starts the upper limit
Member or System History record are prejudged what is obtained, and various emergency cases usually occur in real process, because
This, terminal device is provided with the flow that adjustment thread starts the upper limit, starts the upper limit the thread is adjusted flexibly.
In the present embodiment, terminal device detects that the task number included in currently pending task library opens more than thread
The dynamic upper limit, that is, represent that terminal device can not be completed to respond in this subtask response cycle to all waiting tasks, it is actual
Task amount is more than the task disposal ability of present terminal equipment.Now, terminal device is on then calculating task number and thread start
The first ratio between limit, and judge whether first ratio is more than default up-regulation activation threshold value.
In the present embodiment, activation threshold value is raised to be used to define the situation whether current task amount belongs to abnormal increase,
And whether current task disposal ability is enough to tackle current task amount, without causing large batch of task to overstock and losing
Effect.Therefore, if the first ratio is less than or equal to up-regulation activation threshold value, then it represents that the current task disposal ability of terminal device is with working as
Preceding task amount is matching, starts the upper limit without adjusting thread, maintains current thread to start the upper limit constant;If conversely,
One ratio is more than up-regulation activation threshold value, then it represents that current task amount burst increase, and the current disposal ability of terminal device without
Method ensures waiting task energy normal response, therefore adjustment thread is started into the upper limit, performs S403 associative operation.
Illustratively, in certain time period, it is 100 that the thread of terminal device, which starts the upper limit, and up-regulation activation threshold value is
300%, the quantity of even a certain moment pending task is then needed to thread beyond more than twice of the disposal ability of terminal device
Start the upper limit to be adjusted.If the task number included in current time pending task library is 150, start the upper limit more than thread
100, then the first ratio that terminal device calculating task number and thread start the upper limit is:150/100=150%, less than up-regulation
Activation threshold value, then current thread is kept to start the upper limit constant.
In S403, if first ratio is more than default up-regulation activation threshold value, based on first ratio, improve
The thread starts the upper limit, and chooses the task number with the smaller value in the thread startup upper limit after raising as institute
State current thread and start number.
In the present embodiment, after terminal device detects that the first ratio is more than default up-regulation activation threshold value, then to terminal
The thread of equipment starts the upper limit and carries out corresponding adjust.Terminal device is preset with the first ratio and arranged with adjusting the corresponding relation of amplitude
Table, according to the first ratio being currently calculated, inquire about first ratio corresponding to regulation coefficient, then pass through the regulation coefficient
Increase the thread and start the upper limit.
Illustratively, as described in S402 example, it is 100 that the thread of terminal device, which starts the upper limit, and up-regulation activation threshold value is
300%, current task number is 320, i.e. the first ratio is 320% more than up-regulation activation threshold value, it is therefore desirable to which thread is opened
The dynamic upper limit is adjusted.Corresponding relation list of the terminal device based on first ratio with adjustment amplitude, is calculated 320% pair
The regulation coefficient answered is 200%, i.e., thread is started into upper limit increasing is twice, that is, it is 200 that the thread after improving, which starts the upper limit,.
In the present embodiment, terminal device is after determining that thread starts the upper limit, then after task number and adjustment
Thread starts in the upper limit, chooses a less numerical value and starts number as current thread.Because regulation coefficient is likely larger than
First ratio, therefore the thread being actually calculated starts the upper limit and is likely larger than task number.
In S404, if the task number is less than the thread and starts the upper limit, judge the thread start the upper limit with
Whether the second ratio between the task number is more than default downward activation threshold value.
In the present embodiment, terminal device can be also suitably adjusted according to current task number in current thread startup
Limit, may be according in historical record because terminal device is when setting the corresponding relation of temporal information and the thread startup upper limit
The foundation for being currently up the upper limit and being used as setting of each period, thus in order that to obtain the corresponding relation more accurate, and close
The thread resources of reason ground distribution terminal equipment, therefore terminal device can also reduce thread according to current task reasonable quantity and open
The dynamic upper limit, so that reserved thread can perform other operations.Illustratively, in certain time period, the thread of terminal device starts
The upper limit is 100, it is 200% to lower activation threshold value, and it is current that the quantity of even a certain moment pending task is less than terminal device
More than twice of disposal ability, then need to be adjusted the thread startup upper limit.If included in current time pending task library
Task number is 40, starts the upper limit 100 less than thread, then terminal device computational threads start the second ratio of the upper limit and task number
It is worth and is:100/40=250%, more than activation threshold value is lowered, then perform S405 associative operation.
In the present embodiment, when it is determined that task number is less than the thread startup upper limit, then computational threads start terminal device
The second ratio between the upper limit and task number, and judge whether the second ratio is more than default downward activation threshold value.If second
Ratio, which is more than, lowers activation threshold value, then it represents that and the task disposal ability of terminal device is far longer than current desired task amount, because
This will reduce thread and start the upper limit, and perform S405 operation;If conversely, the second ratio be less than or equal to lower activation threshold value,
Current thread is then kept to start the upper limit.
In S405, if second ratio is more than default downward activation threshold value, based on first ratio, reduce
The thread starts the upper limit, and chooses the task number with the smaller value in the thread startup upper limit after reduction as institute
State current thread and start number.
Illustratively, as described in S402 example, it is 100 that the thread of terminal device, which starts the upper limit, and lowering activation threshold value is
200%, current task number is 40, i.e. the second ratio is 250% more than downward activation threshold value, it is therefore desirable to which thread is started
The upper limit is lowered.Corresponding relation list of the terminal device based on first ratio with adjustment amplitude, is calculated 250% correspondence
Regulation coefficient be 200%, i.e., by thread start the upper limit reduce by one times, that is, decline after thread start the upper limit be 50.
In the present embodiment, after terminal device detects that the second ratio is more than default downward activation threshold value, then to terminal
The thread of equipment starts the upper limit and carries out corresponding adjust.Terminal device is preset with the second ratio and arranged with adjusting the corresponding relation of amplitude
Table, according to the second ratio being currently calculated, inquire about second ratio corresponding to regulation coefficient, then pass through the regulation coefficient
Reduce the thread and start the upper limit.
In embodiments of the present invention, by obtaining the ratio between task number and the thread startup upper limit, it is determined whether need
To start the upper limit to thread to be adjusted, so as to which the task disposal ability of terminal device be adjusted flexibly, improve in thread startup
The accuracy of limit.
Fig. 5 shows a kind of method of adjustment S103 for thread that fifth embodiment of the invention provides specific implementation flow
Figure.Shown in Figure 5, relative to embodiment described in Fig. 1, a kind of method of adjustment S103 for thread that the present embodiment provides also includes
Following steps, details are as follows:
Further, the priority based on each waiting task, extraction and institute from the waiting task storehouse
The waiting task that thread starts number matching is stated, including:
In S501, according to the maximum waiting time of each waiting task and task delivery time, judge respectively each
Whether the individual waiting task is effective.
In the present embodiment, terminal device is in order to ensure the waiting task of response is effective waiting task, because
This can be judged effective attribute of each waiting task before waiting task is extracted.If it is determined that waiting task
Effectively, then S503 associative operation is performed;If it is determined that it is pending invalid, then perform S502 associative operation.
Specifically, terminal device obtains current temporal information and the delivery time of the task first, calculate relative to
The waiting time at current time, if the waiting time be more than maximum waiting time, then it represents that the task has failed, and is identified as nothing
The waiting task of effect;If conversely, the waiting time is less than or equal to maximum waiting time, then it represents that the task is effective, identification
For effective waiting task.
In S502, if the waiting task is invalid, by the waiting task from the waiting task storehouse
Delete, and service time-out information is returned to client corresponding to the waiting task.
In the present embodiment, if terminal device detects that waiting task is invalid task, by the waiting task
Dote on and deleted in waiting task storehouse, so that it is guaranteed that the waiting task included in waiting task storehouse is effectively to wait to locate
Reason task.Further, in order to inform its waiting task failure for sending of the user of service request, terminal device is to pending
Pushes customer corresponding to task services time-out information, so that the client initiates task requests again.
In S503, if the waiting task is effective, the remaining effective time based on the waiting task, adjustment
The priority of the waiting task.
In the present embodiment, terminal device is then extracted and included in the task if it is determined that the waiting task is effective task
Remaining effective time, so as to adjust the priority of the waiting task according to the remaining effective time.Terminal device avoids treating
Processing task fails, and is responded first for more urgent waiting task, therefore terminal device will be waited to locate according to each
The effecting surplus time of reason task, the priority of remaining time shorter waiting task is improved, and for the effecting surplus time
Longer waiting task then maintains its priority constant.
In embodiments of the present invention, terminal device screens to waiting task first before extraction operates, so as to carry
The high effective percentage of service response, so as to improve the efficiency of service response.
It should be understood that the size of the sequence number of each step is not meant to the priority of execution sequence, each process in above-described embodiment
Execution sequence should determine that the implementation process without tackling the embodiment of the present invention forms any limit with its function and internal logic
It is fixed.
Fig. 6 shows a kind of structured flowchart of the adjustment terminal for thread that one embodiment of the invention provides, the tune of the thread
The each unit that whole terminal includes is used to perform each step in embodiment corresponding to Fig. 1.Referring specifically to corresponding to Fig. 1 and Fig. 1
Embodiment in associated description.For convenience of description, it illustrate only part related to the present embodiment.
Referring to Fig. 6, the adjustment terminal of the thread includes:
Task number determining unit 61, for inquiring about in waiting task storehouse including for task at predetermined intervals
Number;
Current thread starts number determining unit 62, for according to the task number and the startup of default thread
Limit, it is determined that current thread starts number;
Waiting task extraction unit 63, for the priority based on each waiting task, from the waiting task
The waiting task that extraction matches with thread startup number in storehouse;
Waiting task response unit 64, for starting thread corresponding with thread startup number, and by described
Thread responds the waiting task.
Alternatively, the current thread starts number determining unit 62 and included:
Temporal information determining unit, for obtaining the temporal information at current time;
Thread starts upper limit determining unit, for starting the corresponding relation of the upper limit and temporal information based on default thread,
Determine that the thread starts the upper limit corresponding to the temporal information;
Current thread starts number setting unit, for the institute according to corresponding to the task number and the temporal information
State thread and start the upper limit, it is determined that current thread starts number.
Alternatively, the adjusting apparatus of the thread also includes:
History service response records acquiring unit, for obtaining history service response record;Wherein, the history service rings
Waiting task information and hardware resource operation information including each period should be recorded;
Thread starts upper limit corresponding relation generation unit, for being recorded based on the history service response, generates the line
The corresponding relation of the Cheng Qidong upper limits and temporal information.
Alternatively, the current thread starts number determining unit 62 and also included:
Up-regulation triggering identifying unit, if being more than the thread for the task number starts the upper limit, judge described appoint
Whether the first ratio that business number and the thread start between the upper limit is more than default up-regulation activation threshold value;
Thread starts upper limit up-regulation unit, if being more than default up-regulation activation threshold value for first ratio, is based on
First ratio, improve the thread and start the upper limit, and choose in the thread startup after the task number and raising
Smaller value in limit starts number as the current thread;
Triggering identifying unit is lowered, if being less than the thread for the task number starts the upper limit, judges the line
Whether the second ratio between the Cheng Qidong upper limits and the task number is more than default downward activation threshold value;
Thread starts the upper limit and lowers unit, if being more than default downward activation threshold value for second ratio, is based on
First ratio, reduce the thread and start the upper limit, and choose in the thread startup after the task number and reduction
Smaller value in limit starts number as the current thread.
Alternatively, the waiting task extraction unit 63 includes:
Waiting task fail-ure criterion unit, for according to the maximum waiting time of each waiting task and task hair
The moment is sent, judges whether each waiting task is effective respectively;
Waiting task fail response unit, if invalid for the waiting task, by the waiting task from
Deleted in the waiting task storehouse, and service time-out information is returned to client corresponding to the waiting task;
Waiting task priority determining unit, if effective for the waiting task, based on described pending
The remaining effective time of business, adjust the priority of the waiting task.
Therefore, the adjustment terminal of thread provided in an embodiment of the present invention again may be by inquiring about at predetermined intervals
The task number included in waiting task storehouse, and current thread is adjusted according to the task number in real time and starts number, so that
The service response ability and the quantity of current waiting task of terminal device match;Terminal device is determining thread startup
After number, then from waiting task storehouse, based on the priority of each waiting task, extraction and line from waiting task storehouse
The consistent waiting task of Cheng Qidong numbers, and responded, it is achieved thereby that the thread startup of dynamic adjustment terminal device
Several purposes.Compared with existing service response technology, the startup number of threads of server keeps constant, when waiting task compared with
When few, easily there is thread startup but free time, waste the resource of server, when waiting task is more, will not increase again
The number that current thread starts, easily cause the overstocked situation of task, and the present embodiment is being carried out to waiting task every time
Before batch concurrently responds, by according to the waiting task included in currently pending task library, adjust current thread and start
Number, so as at the time of reaching in each service response cycle, keep the service response ability of terminal device and current task
Number matches, and improves the efficiency of service response and the service quality of terminal device, provides the user more preferable usage experience.
Fig. 7 is a kind of schematic diagram for terminal device that another embodiment of the present invention provides.As shown in fig. 7, the embodiment
Terminal device 7 includes:Processor 70, memory 71 and it is stored in the memory 71 and can be transported on the processor 70
Capable computer program 72, such as the adjustment programme of thread.The processor 70 is realized when performing the computer program 72
State the step in the method for adjustment embodiment of each thread, such as the S101 to S104 shown in Fig. 1.Or the processor 70
Realize the function of each unit in above-mentioned each device embodiment when performing the computer program 72, for example, module 61 shown in Fig. 6 to
64 functions.
Exemplary, the computer program 72 can be divided into one or more units, one or more of
Unit is stored in the memory 71, and is performed by the processor 70, to complete the present invention.One or more of lists
Member can complete the series of computation machine programmed instruction section of specific function, and the instruction segment is used to describe the computer journey
Implementation procedure of the sequence 72 in the terminal device 7.For example, the computer program 72 can be divided into the determination of task number
Unit, current thread start number determining unit, waiting task extraction unit and waiting task response unit, each unit
Concrete function is as follows:
Task number determining unit, for inquiring about in waiting task storehouse including for task at predetermined intervals
Number;
Current thread starts number determining unit, for starting the upper limit according to the task number and default thread,
It is determined that current thread starts number;
Waiting task extraction unit, for the priority based on each waiting task, from the waiting task storehouse
The waiting task that middle extraction matches with thread startup number;
Waiting task response unit, for starting thread corresponding with thread startup number, and pass through the line
Journey responds the waiting task.
The terminal device 7 can be that the calculating such as desktop PC, notebook, palm PC and cloud server are set
It is standby.The terminal device may include, but be not limited only to, processor 70, memory 71.It will be understood by those skilled in the art that Fig. 7
The only example of terminal device 7, the restriction to terminal device 7 is not formed, can included than illustrating more or less portions
Part, some parts or different parts are either combined, such as the terminal device can also include input-output equipment, net
Network access device, bus etc..
Alleged processor 70 can be CPU (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other PLDs, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor
Deng.
The memory 71 can be the internal storage unit of the terminal device 7, such as the hard disk of terminal device 7 or interior
Deposit.The memory 71 can also be the External memory equipment of the terminal device 7, such as be equipped with the terminal device 7
Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, dodge
Deposit card (Flash Card) etc..Further, the memory 71 can also both include the storage inside list of the terminal device 7
Member also includes External memory equipment.The memory 71 is used to store needed for the computer program and the terminal device
Other programs and data.The memory 71 can be also used for temporarily storing the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each work(
Can unit, module division progress for example, in practical application, can be as needed and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device are divided into different functional units or module, more than completion
The all or part of function of description.Each functional unit, module in embodiment can be integrated in a processing unit, also may be used
To be that unit is individually physically present, can also two or more units it is integrated in a unit, it is above-mentioned integrated
Unit can both be realized in the form of hardware, can also be realized in the form of SFU software functional unit.In addition, each function list
Member, the specific name of module are not limited to the protection domain of the application also only to facilitate mutually distinguish.Said system
The specific work process of middle unit, module, the corresponding process in preceding method embodiment is may be referred to, will not be repeated here.
In the above-described embodiments, the description to each embodiment all emphasizes particularly on different fields, and is not described in detail or remembers in some embodiment
The part of load, it may refer to the associated description of other embodiments.
Those of ordinary skill in the art are it is to be appreciated that the list of each example described with reference to the embodiments described herein
Member and algorithm steps, it can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
Performed with hardware or software mode, application-specific and design constraint depending on technical scheme.Professional and technical personnel
Described function can be realized using distinct methods to each specific application, but this realization is it is not considered that exceed
The scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed device/terminal device and method, can be with
Realize by another way.For example, device described above/terminal device embodiment is only schematical, for example, institute
The division of module or unit is stated, only a kind of division of logic function, there can be other dividing mode when actually realizing, such as
Multiple units or component can combine or be desirably integrated into another system, or some features can be ignored, or not perform.Separately
A bit, shown or discussed mutual coupling or direct-coupling or communication connection can be by some interfaces, device
Or INDIRECT COUPLING or the communication connection of unit, can be electrical, mechanical or other forms.
The unit illustrated as separating component can be or may not be physically separate, show as unit
The part shown can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple
On NE.Some or all of unit therein can be selected to realize the mesh of this embodiment scheme according to the actual needs
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, can also
That unit is individually physically present, can also two or more units it is integrated in a unit.Above-mentioned integrated list
Member can both be realized in the form of hardware, can also be realized in the form of SFU software functional unit.
If the integrated module/unit realized in the form of SFU software functional unit and as independent production marketing or
In use, it can be stored in a computer read/write memory medium.Based on such understanding, the present invention realizes above-mentioned implementation
All or part of flow in example method, by computer program the hardware of correlation can also be instructed to complete, described meter
Calculation machine program can be stored in a computer-readable recording medium, and the computer program can be achieved when being executed by processor
The step of stating each embodiment of the method..Wherein, the computer program includes computer program code, the computer program
Code can be source code form, object identification code form, executable file or some intermediate forms etc..Computer-readable Jie
Matter can include:Can carry any entity or device of the computer program code, recording medium, USB flash disk, mobile hard disk,
Magnetic disc, CD, computer storage, read-only storage (ROM, Read-Only Memory), random access memory (RAM,
Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It is it should be noted that described
The content that computer-readable medium includes can carry out appropriate increasing according to legislation in jurisdiction and the requirement of patent practice
Subtract, such as in some jurisdictions, electric carrier signal and electricity are not included according to legislation and patent practice, computer-readable medium
Believe signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to foregoing reality
Example is applied the present invention is described in detail, it will be understood by those within the art that:It still can be to foregoing each
Technical scheme described in embodiment is modified, or carries out equivalent substitution to which part technical characteristic;And these are changed
Or replace, the essence of appropriate technical solution is departed from the spirit and scope of various embodiments of the present invention technical scheme, all should
Within protection scope of the present invention.
Claims (10)
- A kind of 1. method of adjustment of thread, it is characterised in that including:The task number that includes is inquired about in waiting task storehouse at predetermined intervals;The upper limit is started according to the task number and default thread, it is determined that current thread starts number;Based on the priority of each waiting task, extract from the waiting task storehouse and matched with thread startup number Waiting task;Start thread corresponding with thread startup number, and pass through the thread and respond the waiting task.
- 2. method of adjustment according to claim 1, it is characterised in that described according to the task number and default line The Cheng Qidong upper limits, it is determined that current thread starts number, including:Obtain the temporal information at current time;Start the corresponding relation of the upper limit and temporal information based on default thread, determine the thread corresponding to the temporal information Start the upper limit;The thread starts the upper limit according to corresponding to the task number and the temporal information, it is determined that current thread starts Number.
- 3. method of adjustment according to claim 2, it is characterised in that the method for adjustment also includes:Obtain history service response record;Wherein, the history service response record includes the waiting task of each period Information and hardware resource operation information;Recorded based on the history service response, generate the corresponding relation that the thread starts the upper limit and temporal information.
- 4. according to the method for adjustment described in claim any one of 1-3, it is characterised in that it is described according to the task number and Default thread starts the upper limit, it is determined that current thread starts number, in addition to:If the task number is more than the thread and starts the upper limit, judge the task number and the thread start the upper limit it Between the first ratio whether be more than default up-regulation activation threshold value;If first ratio is more than default up-regulation activation threshold value, based on first ratio, improves the thread and start The upper limit, and the task number is chosen with the smaller value in the thread startup upper limit after raising as the current thread Start number;If the task number is less than the thread and starts the upper limit, judge the thread start the upper limit and the task number it Between the second ratio whether be more than default downward activation threshold value;If second ratio is more than default downward activation threshold value, based on first ratio, reduces the thread and start The upper limit, and the task number is chosen with the smaller value in the thread startup upper limit after reduction as the current thread Start number.
- 5. method of adjustment according to claim 1, it is characterised in that the priority based on each waiting task, The waiting task that extraction matches with thread startup number from the waiting task storehouse, including:According to the maximum waiting time of each waiting task and task delivery time, each described pending is judged respectively Whether business is effective;If the waiting task is invalid, the waiting task is deleted from the waiting task storehouse, and to described Client corresponding to waiting task returns to service time-out information;If the waiting task is effective, the remaining effective time based on the waiting task, described pending of adjustment The priority of business.
- 6. a kind of terminal device, it is characterised in that the terminal device includes memory, processor and is stored in the storage Realized in device and the computer program that can run on the processor, described in the computing device during computer program as follows Step:The task number that includes is inquired about in waiting task storehouse at predetermined intervals;The upper limit is started according to the task number and default thread, it is determined that current thread starts number;Based on the priority of each waiting task, extract from the waiting task storehouse and matched with thread startup number Waiting task;Start thread corresponding with thread startup number, and pass through the thread and respond the waiting task.
- 7. terminal device according to claim 6, it is characterised in that described according to the task number and default line The Cheng Qidong upper limits, it is determined that current thread starts number, including:Obtain the temporal information at current time;Start the corresponding relation of the upper limit and temporal information based on default thread, determine the thread corresponding to the temporal information Start the upper limit;The thread starts the upper limit according to corresponding to the task number and the temporal information, it is determined that current thread starts Number.
- 8. terminal device according to claim 7, it is characterised in that described in the computing device during computer program also Realize following steps:Obtain history service response record;Wherein, the history service response record includes the waiting task of each period Information and hardware resource operation information;Recorded based on the history service response, generate the corresponding relation that the thread starts the upper limit and temporal information.
- 9. according to the terminal device described in claim any one of 6-8, it is characterised in thatIt is described that the upper limit is started according to the task number and default thread, it is determined that current thread starts number, in addition to:If the task number is more than the thread and starts the upper limit, judge the task number and the thread start the upper limit it Between the first ratio whether be more than default up-regulation activation threshold value;If first ratio is more than default up-regulation activation threshold value, based on first ratio, improves the thread and start The upper limit, and the task number is chosen with the smaller value in the thread startup upper limit after raising as the current thread Start number;If the task number is less than the thread and starts the upper limit, judge the thread start the upper limit and the task number it Between the second ratio whether be more than default downward activation threshold value;If second ratio is more than default downward activation threshold value, based on first ratio, reduces the thread and start The upper limit, and the task number is chosen with the smaller value in the thread startup upper limit after reduction as the current thread Start number.
- 10. a kind of computer-readable recording medium, the computer-readable recording medium storage has computer program, and its feature exists In when the computer program is executed by processor the step of realization such as any one of claim 1 to 5 methods described.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710985525.9A CN107832126B (en) | 2017-10-20 | 2017-10-20 | Thread adjusting method and terminal thereof |
PCT/CN2018/077682 WO2019075980A1 (en) | 2017-10-20 | 2018-02-28 | Thread adjustment method and terminal thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710985525.9A CN107832126B (en) | 2017-10-20 | 2017-10-20 | Thread adjusting method and terminal thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107832126A true CN107832126A (en) | 2018-03-23 |
CN107832126B CN107832126B (en) | 2020-06-12 |
Family
ID=61648667
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710985525.9A Active CN107832126B (en) | 2017-10-20 | 2017-10-20 | Thread adjusting method and terminal thereof |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107832126B (en) |
WO (1) | WO2019075980A1 (en) |
Cited By (27)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108710538A (en) * | 2018-05-14 | 2018-10-26 | 中国平安人寿保险股份有限公司 | A kind of thread configuration method, computer readable storage medium and terminal device |
CN109063140A (en) * | 2018-08-03 | 2018-12-21 | 福州麦辽自动化设备有限公司 | A kind of data query method, transfer server and computer readable storage medium |
CN109086132A (en) * | 2018-06-26 | 2018-12-25 | 深圳市买买提信息科技有限公司 | A kind of recognition of face task balance call method, device and terminal device |
CN109189336A (en) * | 2018-08-17 | 2019-01-11 | 郑州云海信息技术有限公司 | A kind of storage system thread method of adjustment, system and electronic equipment and storage medium |
CN109254835A (en) * | 2018-06-27 | 2019-01-22 | 阿里巴巴集团控股有限公司 | Processing method, device, server and the readable storage medium storing program for executing of batch processing task |
CN109271252A (en) * | 2018-08-29 | 2019-01-25 | 华为技术有限公司 | A kind of method and device adjusting Thread Count |
CN109544015A (en) * | 2018-11-26 | 2019-03-29 | 平安科技(深圳)有限公司 | A kind of method for allocating tasks and relevant device based on data processing |
CN109710402A (en) * | 2018-12-17 | 2019-05-03 | 平安普惠企业管理有限公司 | Method, apparatus, computer equipment and the storage medium of process resource acquisition request |
CN109815007A (en) * | 2018-12-15 | 2019-05-28 | 平安科技(深圳)有限公司 | Thread control method, device, electronic equipment and storage medium based on cloud monitoring |
CN110287018A (en) * | 2019-07-04 | 2019-09-27 | 中国工商银行股份有限公司 | Batch tasks method of combination and device |
CN110413419A (en) * | 2018-04-28 | 2019-11-05 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus that rule executes |
CN111262894A (en) * | 2018-11-30 | 2020-06-09 | 北京嘀嘀无限科技发展有限公司 | Method and device for controlling online consultation user quantity |
CN111324447A (en) * | 2019-06-26 | 2020-06-23 | 杭州海康威视系统技术有限公司 | Thread adjusting method and device, application server and storage medium |
CN111415725A (en) * | 2020-03-05 | 2020-07-14 | 北京深睿博联科技有限责任公司 | Scheduling method, system, terminal and storage medium applied to AI medical image diagnosis algorithm |
CN111552567A (en) * | 2020-04-27 | 2020-08-18 | 北京奇艺世纪科技有限公司 | Thread management method and device, electronic equipment and storage medium |
CN111782378A (en) * | 2020-07-29 | 2020-10-16 | 平安银行股份有限公司 | Adaptive processing performance adjusting method, server and readable storage medium |
CN111784533A (en) * | 2020-06-16 | 2020-10-16 | 洪江川 | Information analysis method based on artificial intelligence and big data and cloud computing platform |
CN112000446A (en) * | 2020-07-13 | 2020-11-27 | 深圳市优必选科技股份有限公司 | Data transmission method and robot |
CN112069367A (en) * | 2020-09-07 | 2020-12-11 | 上海金仕达软件科技有限公司 | Task scheduling method and system |
CN112153060A (en) * | 2020-09-27 | 2020-12-29 | 苏州浪潮智能科技有限公司 | Communication control method and system of SMB protocol server and related components |
CN112882818A (en) * | 2021-03-30 | 2021-06-01 | 中信银行股份有限公司 | Task dynamic adjustment method, device and equipment |
CN113222456A (en) * | 2021-05-29 | 2021-08-06 | 长沙市到家悠享家政服务有限公司 | Task processing method, system, electronic device and computer readable medium |
CN113568737A (en) * | 2021-06-30 | 2021-10-29 | 北京达佳互联信息技术有限公司 | Hardware resource allocation method and device |
CN113885956A (en) * | 2021-09-29 | 2022-01-04 | 北京百度网讯科技有限公司 | Service deployment method and device, electronic equipment and storage medium |
CN113886185A (en) * | 2021-10-16 | 2022-01-04 | 深圳市瑞云科技有限公司 | Method for automatically judging busy state of platform |
CN116755869A (en) * | 2023-08-23 | 2023-09-15 | 北京浩然五洲软件技术有限公司 | Financial business part processing method, system and medium |
CN117453363A (en) * | 2023-11-06 | 2024-01-26 | 北京明朝万达科技股份有限公司 | Accessory processing method and device, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080155549A1 (en) * | 2006-12-20 | 2008-06-26 | Blinick Stephen L | Method and Apparatus for Adjusting Sleep Time of Fixed High-Priority Threads |
CN102779062A (en) * | 2011-05-09 | 2012-11-14 | 阿里巴巴集团控股有限公司 | Method and device for controlling number of threads accessing system resources |
CN104572277A (en) * | 2014-12-17 | 2015-04-29 | 大唐移动通信设备有限公司 | Thread flow control method and thread flow control device |
CN106952163A (en) * | 2016-01-07 | 2017-07-14 | 平安科技(深圳)有限公司 | Insurance data processing method and system |
-
2017
- 2017-10-20 CN CN201710985525.9A patent/CN107832126B/en active Active
-
2018
- 2018-02-28 WO PCT/CN2018/077682 patent/WO2019075980A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080155549A1 (en) * | 2006-12-20 | 2008-06-26 | Blinick Stephen L | Method and Apparatus for Adjusting Sleep Time of Fixed High-Priority Threads |
CN102779062A (en) * | 2011-05-09 | 2012-11-14 | 阿里巴巴集团控股有限公司 | Method and device for controlling number of threads accessing system resources |
CN104572277A (en) * | 2014-12-17 | 2015-04-29 | 大唐移动通信设备有限公司 | Thread flow control method and thread flow control device |
CN106952163A (en) * | 2016-01-07 | 2017-07-14 | 平安科技(深圳)有限公司 | Insurance data processing method and system |
Cited By (38)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110413419A (en) * | 2018-04-28 | 2019-11-05 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus that rule executes |
CN108710538A (en) * | 2018-05-14 | 2018-10-26 | 中国平安人寿保险股份有限公司 | A kind of thread configuration method, computer readable storage medium and terminal device |
CN108710538B (en) * | 2018-05-14 | 2023-06-02 | 中国平安人寿保险股份有限公司 | Thread configuration method, computer readable storage medium and terminal equipment |
CN109086132A (en) * | 2018-06-26 | 2018-12-25 | 深圳市买买提信息科技有限公司 | A kind of recognition of face task balance call method, device and terminal device |
CN109254835A (en) * | 2018-06-27 | 2019-01-22 | 阿里巴巴集团控股有限公司 | Processing method, device, server and the readable storage medium storing program for executing of batch processing task |
CN109063140A (en) * | 2018-08-03 | 2018-12-21 | 福州麦辽自动化设备有限公司 | A kind of data query method, transfer server and computer readable storage medium |
CN109189336A (en) * | 2018-08-17 | 2019-01-11 | 郑州云海信息技术有限公司 | A kind of storage system thread method of adjustment, system and electronic equipment and storage medium |
CN109271252A (en) * | 2018-08-29 | 2019-01-25 | 华为技术有限公司 | A kind of method and device adjusting Thread Count |
CN109544015A (en) * | 2018-11-26 | 2019-03-29 | 平安科技(深圳)有限公司 | A kind of method for allocating tasks and relevant device based on data processing |
CN109544015B (en) * | 2018-11-26 | 2023-07-25 | 平安科技(深圳)有限公司 | Task allocation method based on data processing and related equipment |
CN111262894A (en) * | 2018-11-30 | 2020-06-09 | 北京嘀嘀无限科技发展有限公司 | Method and device for controlling online consultation user quantity |
CN109815007A (en) * | 2018-12-15 | 2019-05-28 | 平安科技(深圳)有限公司 | Thread control method, device, electronic equipment and storage medium based on cloud monitoring |
CN109710402A (en) * | 2018-12-17 | 2019-05-03 | 平安普惠企业管理有限公司 | Method, apparatus, computer equipment and the storage medium of process resource acquisition request |
CN111324447A (en) * | 2019-06-26 | 2020-06-23 | 杭州海康威视系统技术有限公司 | Thread adjusting method and device, application server and storage medium |
CN111324447B (en) * | 2019-06-26 | 2023-03-28 | 杭州海康威视系统技术有限公司 | Thread adjusting method and device, application server and storage medium |
CN110287018A (en) * | 2019-07-04 | 2019-09-27 | 中国工商银行股份有限公司 | Batch tasks method of combination and device |
CN110287018B (en) * | 2019-07-04 | 2021-08-13 | 中国工商银行股份有限公司 | Batch task arranging method and device |
CN111415725A (en) * | 2020-03-05 | 2020-07-14 | 北京深睿博联科技有限责任公司 | Scheduling method, system, terminal and storage medium applied to AI medical image diagnosis algorithm |
CN111415725B (en) * | 2020-03-05 | 2023-09-26 | 北京深睿博联科技有限责任公司 | Scheduling method, system, terminal and storage medium applied to AI medical image diagnosis algorithm |
CN111552567A (en) * | 2020-04-27 | 2020-08-18 | 北京奇艺世纪科技有限公司 | Thread management method and device, electronic equipment and storage medium |
CN111784533A (en) * | 2020-06-16 | 2020-10-16 | 洪江川 | Information analysis method based on artificial intelligence and big data and cloud computing platform |
CN111784533B (en) * | 2020-06-16 | 2021-04-27 | 无限数联网络科技(北京)有限公司 | Information analysis method based on artificial intelligence and big data and cloud computing platform |
CN112000446A (en) * | 2020-07-13 | 2020-11-27 | 深圳市优必选科技股份有限公司 | Data transmission method and robot |
CN111782378A (en) * | 2020-07-29 | 2020-10-16 | 平安银行股份有限公司 | Adaptive processing performance adjusting method, server and readable storage medium |
CN111782378B (en) * | 2020-07-29 | 2024-04-16 | 平安银行股份有限公司 | Adaptive processing performance adjustment method, server and readable storage medium |
CN112069367A (en) * | 2020-09-07 | 2020-12-11 | 上海金仕达软件科技有限公司 | Task scheduling method and system |
CN112153060A (en) * | 2020-09-27 | 2020-12-29 | 苏州浪潮智能科技有限公司 | Communication control method and system of SMB protocol server and related components |
CN112882818A (en) * | 2021-03-30 | 2021-06-01 | 中信银行股份有限公司 | Task dynamic adjustment method, device and equipment |
CN113222456A (en) * | 2021-05-29 | 2021-08-06 | 长沙市到家悠享家政服务有限公司 | Task processing method, system, electronic device and computer readable medium |
CN113568737B (en) * | 2021-06-30 | 2024-03-26 | 北京达佳互联信息技术有限公司 | Hardware resource allocation method and device |
CN113568737A (en) * | 2021-06-30 | 2021-10-29 | 北京达佳互联信息技术有限公司 | Hardware resource allocation method and device |
CN113885956B (en) * | 2021-09-29 | 2023-08-29 | 北京百度网讯科技有限公司 | Service deployment method and device, electronic equipment and storage medium |
CN113885956A (en) * | 2021-09-29 | 2022-01-04 | 北京百度网讯科技有限公司 | Service deployment method and device, electronic equipment and storage medium |
CN113886185B (en) * | 2021-10-16 | 2023-07-11 | 深圳市瑞云科技有限公司 | Method for automatically judging busy state of platform |
CN113886185A (en) * | 2021-10-16 | 2022-01-04 | 深圳市瑞云科技有限公司 | Method for automatically judging busy state of platform |
CN116755869A (en) * | 2023-08-23 | 2023-09-15 | 北京浩然五洲软件技术有限公司 | Financial business part processing method, system and medium |
CN116755869B (en) * | 2023-08-23 | 2023-10-27 | 北京浩然五洲软件技术有限公司 | Financial business part processing method, system and medium |
CN117453363A (en) * | 2023-11-06 | 2024-01-26 | 北京明朝万达科技股份有限公司 | Accessory processing method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN107832126B (en) | 2020-06-12 |
WO2019075980A1 (en) | 2019-04-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107832126A (en) | The method of adjustment and its terminal of a kind of thread | |
CN110333937A (en) | Task distribution method, device, computer equipment and storage medium | |
CN104243405B (en) | A kind of request processing method, apparatus and system | |
CN109889999B (en) | Flow pool management method, system and terminal of Internet of things card | |
CN106201661A (en) | Method and apparatus for elastic telescopic cluster virtual machine | |
CN106209682A (en) | Business scheduling method, device and system | |
CN110933178B (en) | Method for adjusting node configuration in cluster system and server | |
CN110096388A (en) | A kind of method, apparatus and computer storage medium of data backup | |
CN108418787A (en) | Acquisition method, terminal device and the medium of Enterprise Resources Plan data | |
CN107689966A (en) | Account resource share method, system, equipment and computer-readable recording medium | |
CN108400898A (en) | The management method and device of resource in cloud data management platform | |
CN114661476A (en) | Task processing method, device, equipment and storage medium | |
CN115239450A (en) | Financial data processing method and device, computer equipment and storage medium | |
CN111260253A (en) | Information sending method and device, computer equipment and storage medium | |
CN112363826B (en) | Project resource comprehensive management system, method, terminal and storage medium | |
CN110233942A (en) | The virtual unofficial biography method, apparatus of cell-phone number, equipment and storage medium | |
CN110225088A (en) | A kind of cloud desktop management method and system | |
CN105450679B (en) | Carry out the method and system of data cloud storage | |
CN108388409A (en) | Print request processing method, device, computer equipment and storage medium | |
CN112270466A (en) | Operation method and device of vehicle charging device | |
CN107277143A (en) | A kind of resource matched management method and device | |
CN105049475B (en) | The data efficient storage optimization method and system of extensive community | |
CN106933655A (en) | Event execution method and device | |
CN116484985A (en) | Network point service reservation method, device and system and electronic equipment | |
CN110515991A (en) | Batch dispenses the collection method and device, storage medium, terminal of file |
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 |