Thread distribution method and device
Technical field
The invention belongs to computer application field, more particularly to a kind of thread distribution method and device.
Background technology
Cluster computing carrys out a focus of referred to as computer circle research in recent years.Cluster is not only able to make full use of now
Some computing resources, and the computer system of superior performance can be realized by relatively low software and hardware cost.
In the environment of more clusters are run simultaneously, the performance of each cluster has differences.For example, high performance cluster A can
Can exist to another cluster B and rely on, and cluster B performance is less than cluster A performance.When cluster A operates in height simultaneously
In the environment for sending out request, and cluster A, frequently to cluster B concurrent requests, in this case, the request of cluster A high concurrents has
Cluster B shake or collapse are likely to result in, the offer service of cluster B not stabilizabilities is provided, ultimately results in disaster accident
Occur.
At present, in order to ensure that cluster B can provide stable service for cluster A, the number of machines in cluster B can be increased
Amount, so when cluster A frequently will be significantly to frequency phenomena such as during cluster B transmission requests, cluster B occurs shaking or collapsed
Reduce, but it is this improve the method for cluster B performances by increasing machine resources, and the request sent to cluster B as cluster A
When being not frequent, wasting phenomenon that increased machine resources just occur.
The content of the invention
The present invention provides a kind of thread distribution method and device, and the machine for solving to rely on cluster by increase provides
Source, the risk that the cluster to reduce relied on occurs shaking or collapsed, it frequently can lead to the waste problem of machine resources.
To achieve these goals, the invention provides a kind of thread distribution method, including:
Obtain the maximum query rate per second for relying on cluster and allowing that target cluster is relied on;
When distributing thread to pending destination request, the target cluster and the sound relied between cluster are obtained
Between seasonable;
Obtain the current thread number that the target cluster is used;
Based on maximum query rate per second, the response time and the current thread number, target cluster is obtained
Thread Count can be distributed;
Obtain the required Thread Count of the destination request;
Judge Thread Count needed for the destination request can distribute Thread Count described in whether being less than or equal to;
It is corresponding for destination request distribution if Thread Count needed for described can distribute Thread Count described in being less than or equal to
Thread.
To achieve these goals, the invention provides a kind of thread distributor, including:
Query rate acquisition module, the maximum query rate per second for relying on cluster and allowing relied on for obtaining target cluster;
Time-obtaining module, for when distributing thread to pending destination request, take the target cluster with it is described
Rely on the response time between cluster;
Current thread acquisition module, obtain the current thread number that the target cluster is used;
Distribute thread acquisition module, for based on maximum query rate per second, the response time and it is described currently
Thread Count, obtain target cluster distributes Thread Count;
Required thread acquisition module, for obtaining the required Thread Count of the destination request;
Judge module, for judging Thread Count needed for the destination request can distribute Thread Count described in whether being less than or equal to;
Distribute module, for judging that the required Thread Count can distribute thread described in being less than or equal in the judge module
During number, then corresponding thread is distributed for the destination request.
Thread distribution method and device provided by the invention, what the dependence cluster relied on by obtaining target cluster allowed
Maximum query rate per second, when destination request distributes thread, according to maximum query rate per second, target cluster and dependence cluster it
Between the current thread number that is used of response time and target cluster, obtain the Thread Count that distributes of target cluster, obtain
The required Thread Count of destination request, then it is destination request point when Thread Count needed for destination request is less than or equal to that Thread Count can be distributed
With corresponding thread.In the present embodiment, target cluster limits itself according to the maximum query rate per second that is allowed of cluster is relied on
Distribute number of passes, that is, realize that itself is limited concurrent request quantity, play a part of protection rely on cluster, reduce to according to
Impact caused by relying cluster, reduce and rely on the risk that cluster occurs shaking or collapsed.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of the thread distribution method of the embodiment of the present invention one;
Fig. 2 is the schematic flow sheet of the thread distribution method of the embodiment of the present invention two;
Fig. 3 is the schematic flow sheet of the thread distribution method of the embodiment of the present invention three;
Fig. 4 is the structural representation of the thread distributor of the embodiment of the present invention four;
Fig. 5 is the structural representation of the required thread acquisition module in the embodiment of the present invention four;
Fig. 6 is the structural representation of the thread distributor of the embodiment of the present invention five.
Embodiment
Thread distribution method provided in an embodiment of the present invention and device are described in detail below in conjunction with the accompanying drawings.
Embodiment one
As shown in figure 1, its schematic flow sheet for the thread distribution method of the embodiment of the present invention one.The thread distribution method
Comprise the following steps:
S101, obtain the maximum query rate per second for relying on cluster and allowing that target cluster is relied on.
In the present embodiment, target cluster obtains the relied on maximum query rate per second for relying on cluster and allowing.Wherein, it is per second
Query rate (Query Per Second, abbreviation QPS) is specifically to inquire about server handled stream at the appointed time to one
Measure how many criterions.QPS correspondingly obtains the second (fetches/sec), i.e., respond request number per second, that is to say maximum throughput
Ability.
When target cluster to rely on cluster concurrent request quantity, no more than rely on cluster allowed number of requests when, then
Target cluster, which will not cause, to be relied on cluster and the unstable phenomenon such as occurs shaking.And when target cluster is to relying on cluster concurrent request
Quantity, beyond when relying on number of requests that cluster is allowed, then target cluster, which may cause, relies on cluster and occurs shaking etc. no
Stable phenomenon.Wherein, the number of requests that relying on cluster is allowed can be got by the maximum query rate per second of permission.
Alternatively, after the maximum query rate per second for relying on cluster is got, for the concurrent request quantity to itself
Limited, the maximum query rate per second that target cluster can be allowed, be arranged to the maximum inquiry per second of the dependence cluster
Rate, concurrent number of requests can thus be limited from target cluster side, avoid the occurrence of concurrent request excessive number, it is right
Rely on the risk that cluster impacts.
S102, when distributing thread to pending destination request, obtain target cluster and rely on the response between cluster
Time.
Preferably, by way of sampling, the historical responses time is obtained, when extracting response according to the historical responses time
Between.Specifically, the historical responses time in preset duration is obtained, it is regular to carry out data to the historical responses time, first can be with
The exceptional sample in the historical responses time is first rejected, to obtain the remaining historical responses time, remaining history is then calculated and rings
Arithmetic mean of instantaneous value between seasonable, using the arithmetic mean of instantaneous value as response time (Response Time, abbreviation RT).
For example, being based on standard deviation formula, the standard deviation sigma and arithmetic mean of instantaneous value μ of historical responses time are obtained, utilizes mark
Accurate poor σ and arithmetic mean of instantaneous value μ, the normal distribution of historical responses time is obtained, the history outside (μ -3 σ, μ+3 σ) will be fallen and rung
It is used as the exception response time, after the exception response time is weeded out, obtain remaining historical responses time, Ran Hou between seasonable
The arithmetic mean of instantaneous value of remaining historical responses time is calculated, using the arithmetic mean of instantaneous value as response time RT.
Alternatively, a dedicated thread of target cluster is enabled, the response time is specially measured in real time using the thread, is set
In real time after measurement RT dedicated thread, certain test parameter can be pre-set, is then based on test parameter according to the time
It is spaced the Dependency Set relied on to target cluster and has mass-sended calling, records after repeatedly test, what special county town measured in real time
Measure the response time meeting stable value in one, region, the response time RT using the amount response time after stabilization as target cluster.
S103, obtain the current thread number that target cluster is used.
In the running of target cluster, the host node (Master Node) in target cluster can be to being used
Current thread number recorded, the current thread number that the target cluster is used can be got from host node.
S104, based on maximum query rate, response time and current thread number per second, obtain target cluster distributes line
Number of passes.
When pending processing destination request, in order to perform the destination request, it is necessary to distribute thread for destination request.Tool
Body, single thread query rate per second is calculated according to the response time, it is then per second according to maximum query rate per second and single thread
Query rate, obtain maximum thread.Maximum thread=maximum query rate/single thread query rate per second per second.Further, root
According to maximum thread and current thread number, the Thread Count that distributes of target cluster is calculated, i.e., by maximum thread and current
The difference of Thread Count, Thread Count is distributed as target cluster.
Specific formula is as follows:
N=(M-Qt*Ct)/Qt;
Wherein, N represents that Thread Count can be distributed;M represents maximum query rate per second;Ct represents current thread number;Qt represents single
Thread query rate per second, Qt=1/RT, RT represent the response time.
According to above-mentioned formula as can be seen that M/Qt ratio is the maximum thread of target cluster.
In the present embodiment, the max line of the target cluster is limited according to the maximum query rate per second that is allowed of cluster is relied on
Number of passes, so as to play the purpose that target cluster is limited concurrent request quantity itself, and then it can reduce to relying on
Impact caused by cluster.
S105, the required Thread Count for obtaining destination request.
In the present embodiment, destination request can be disassembled, obtain disassembling task amount corresponding to destination request.Specifically
Ground, data volume corresponding to destination request is obtained, by the data volume of destination request data volume corresponding with default individual task
Radix does ratio, and task amount is disassembled using the ratio as destination request.It is possible to further preset each task by more
Few thread goes to be executed concurrently, you can with the default Thread Count performed needed for individual task, destination request is disassembled into task amount
Product is done with the Thread Count needed for individual task, it is possible to obtains the required Thread Count of destination request.
Alternatively, in order to avoid occurring impacting to relying on cluster, a maximum task amount can be preset, is being got
After disassembling task amount, judge that this disassembles whether task amount exceeds default maximum task amount, if it is judged that to disassemble task
Amount exceeds the maximum task amount, then the goal task amount using the maximum task amount as destination request, then according to default list
The Thread Count and goal task amount of individual required by task, calculate the required Thread Count of the destination request.
Further, if it is judged that to disassemble task amount without departing from maximum task amount, then according to needed for individual task
Thread Count and disassemble task amount, calculate the required Thread Count of destination request.
In distributed type assemblies, it can fix each task is gone to be executed concurrently by how many thread, for example, list can be set
The Thread Count of individual required by task is 4, is that 4 threads concurrently perform completion individual task by this.The data volume of destination request is
80005, data volume radix corresponding to individual task is 10000, then the task amount of disassembling of destination request is 80005/10000=
8.0005, it is 9 after value.In order to ensure that larger impact is not caused to relied on cluster, the maximum task amount pre-set is
6, then the goal task amount of the destination request be arranged to 6, then the Thread Count taken needed for the pending request is 4*6=24, i.e.,
Need to distribute 24 threads, to perform the destination request.
S106, judge whether Thread Count needed for destination request is less than or equal to that Thread Count can be distributed.
After Thread Count needed for destination request is got, in order to guarantee to be processed, it is necessary to there is foot for destination request
Enough distributes Thread Count, it is therefore desirable to by Thread Count needed for destination request compared with it can distribute Thread Count, judges target
Whether Thread Count needed for request is less than or equal to that Thread Count can be distributed.If Thread Count needed for destination request is less than or equal to that line can be distributed
During number of passes, then S107 is performed.If Thread Count needed for destination request performs S108 more than when can distribute Thread Count.
S107, it is that destination request distributes corresponding thread.
When Thread Count needed for destination request is less than or equal to that Thread Count can be distributed, illustrate that target cluster can currently distribute thread
Number is more, is limited due to that can distribute Thread Count by the maximum query rate per second of cluster is relied on, so target cluster is the target
After request distribution thread, the destination request will not impact to relying on cluster, then to destination request according to its required Thread Count
It is allocated thread.
S108, destination request is placed into waiting list and ranked, wait next thread to distribute.
When Thread Count needed for destination request be more than can distribute Thread Count when, illustrate target cluster can currently distribute Thread Count compared with
It is few, limited due to Thread Count can be distributed by the maximum query rate per second of cluster is relied on, so target cluster is the destination request
After distributing thread, the destination request may impact to relying on cluster, now thread will not be distributed to destination request, by mesh
Mark request, which is placed into waiting list, ranks, and waits next thread to distribute.
The thread distribution method that the present embodiment provides, the maximum for relying on cluster and allowing relied on by obtaining target cluster
Query rate per second, when destination request distributes thread, according between maximum query rate per second, target cluster and dependence cluster
The current thread number that response time and target cluster are used, the Thread Count that distributes of target cluster is obtained, obtains target
The required Thread Count of request, when Thread Count needed for destination request is less than or equal to that Thread Count can be distributed, then distribute phase for destination request
The thread answered.In the present embodiment, target cluster according to rely on the maximum query rate per second that is allowed of cluster can come limit itself
Number of passes is distributed, that is, realizes that itself is limited concurrent request quantity, plays a part of protection and relies on cluster, reduce to Dependency Set
Impact caused by group, reduce and rely on the risk that cluster occurs shaking or collapsed.
Embodiment two
As shown in Fig. 2 its schematic flow sheet for the thread distribution method of the embodiment of the present invention two.In above-described embodiment
On basis, judge thread needed for destination request be more than or equal to it is described can distribute thread, then be destination request distribution
Its respective thread, comprise the following steps:
S201, when Thread Count is less than or equal to that Thread Count can be distributed needed for judge, obtain needed for processing destination request
Processing time.
On before the step of, here is omitted, reference can be made in above-described embodiment one related content record, herein not
Repeat again.
After ensureing destination request distribution thread, destination request will not impact to relying on cluster, can be further
Ground obtains the processing time needed for processing destination request.Specifically, single thread query rate per second is calculated according to the response time, so
Obtain single thread query rate per second afterwards and the product of Thread Count can be distributed, by the corresponding data volume of destination request and the product
Do ratio, it is possible to the processing time of destination request.
Specifically formula is:
T=RS/N*Qt;
Wherein, T represents processing time, and RS represents the sample size of destination request, and N represents that Thread Count can be distributed, and Qt represents single
The query rate per second of individual thread, Qt=1/RT, RT represent the response time.
S202, by processing time compared with default time threshold.
In the present embodiment, the time needed for the processing of historical requests can be obtained, according to the time needed for these history, system
Meter obtains the required time of an experience, using the required time of the experience as time threshold.
After processing time is got, by processing time compared with default time threshold, when treated between be less than
During time threshold, S203 is performed;When being more than or equal to time threshold between when treated, S204 is performed.
If S203, processing time are less than time threshold, corresponding thread is distributed for destination request.
When being less than time threshold between when treated, then it represents that for destination request distribute thread after, destination request will not to according to
Bad cluster impacts, and target cluster distributes its respective thread to destination request, completes being operated when secondary for user.
If S204, processing time is more than or equal to time threshold, destination request is placed into waiting list and ranked,
Wait thread distribution next time.
When being more than or equal to time threshold between when treated, then it represents that target cluster is that destination request distributes corresponding thread,
Participate in calculate will break through rely on cluster safety line number of passes, can to rely on cluster produce large effect, may result according to
Rely the unstable of cluster, phenomena such as occurring shaking or collapse, now destination request will not be allocated its respective thread, destination request
Waiting list can only be placed into, waits thread distribution next time.Alternatively, can be with when destination request is placed into waiting list
The busy reminder message of a system is returned to user, in order to which user carries out other operations within the stand-by period, improves user
Experience.
S205, when destination request waits in line the distribution of next thread, will when meeting that default priority sets condition
The priority of destination request is arranged to highest.
In the present embodiment, in order that destination request is performed or handled as much as possible earlier, pre-set certain excellent
First level sets condition, during destination request waits in line next thread distribution, when meeting that default priority sets bar
After part, the priority of destination request is arranged to highest, it is enough when distributing thread in order to have, it is preferably destination request point
With its respective thread.
Wherein, it can be that the time length that destination request waits exceeds regular hour length that priority, which sets condition, or
The number that destination request waits exceedes default number, or the distribution instruction of destination request decays to minimum value.When in appearance
One of situation is stated, just meets the condition that priority is set, then the priority of destination request is arranged to highest.
S206, when that can distribute Thread Count and be more than or equal to required Thread Count, directly for destination request distribute corresponding to thread.
After the priority of destination request is arranged into highest, when Thread Count can be distributed more than or equal to required Thread Count,
Then it is directly thread corresponding to destination request distribution due to the highest priority of destination request.
The thread distribution method that the present embodiment provides, by when distributing thread to destination request, per second looked into based on maximum
Inquiry rate acquisition target cluster distributes Thread Count, is less than or equal to that Thread Count can be distributed in Thread Count needed for destination request, enters one
Step obtains the processing time performed needed for the destination request, and when processing time being less than time threshold, phase is distributed for destination request
The thread answered, preferably Dependency Set group can be played a protective role.In the present embodiment, target cluster is permitted according to cluster is relied on
Perhaps maximum query rate per second limits the number of passes that distributes of itself, that is, realizes that itself is limited concurrent request quantity, rises
To protection rely on cluster effect, and by the processing time needed for destination request ensure for destination request distribute thread
Afterwards, destination request, which will not trigger, relies on phenomena such as cluster occurs shaking or collapsed, and further reduces target cluster to Dependency Set
Impact caused by group.
Embodiment three
As shown in figure 3, its schematic flow sheet for the thread distribution method of the embodiment of the present invention three.In above-described embodiment
It is further comprising the steps of after corresponding thread is distributed for destination request on basis:
S301, performance objective ask during, monitor the current response time in real time.
After distributing corresponding thread to destination request, then performance objective please in the thread parallel by distribution for can
Ask, during performance objective is asked, the current response time can be monitored in real time.
If S302, current response time are more than the response time in duration time interval, using between the time
Every the current response time of interior monitoring, a revised response time is calculated.
In practical application, in the case where thread is certain, when monitoring that the current response time exceeds the response time
When, illustrate that current point in time relies on the process performance reduction of cluster or is deteriorated, in the present embodiment, the response time is above-mentioned
Response time for being obtained in embodiment according to the historical responses time or to be measured in real time by dedicated thread in above-described embodiment
Response time.
Specifically, by the current response time monitored in duration time interval compared with the response time, if worked as
When the preceding response time is more than the response time in duration time interval, illustrate the place that cluster is relied in this time interval
Rationality can be reduced or be deteriorated, and stable service is enough provided for target cluster in order to ensure Dependency Set group energy,
In the present embodiment, enough current response times real-time monitored are obtained by duration time interval, utilized
The current response time real-time monitored in duration time interval is got, calculates a revised response time, will
The revised response time is as the new response time.
S303, acquisition response time make ratio with the revised response time, using the ratio as correction factor.
The response time and the revised response time that calculate when can distribute Thread Count are done into ratio, using the ratio as repairing
Positive coefficient.
S304, using correction factor the thread needed for individual task is adjusted.
Correction factor and the Thread Count needed for default individual task before are done into product, a new line can be obtained
Number of passes is as the Thread Count needed for individual task, and so as to reduce the Thread Count needed for individual task, target cluster is right again
The Thread Count of itself is limited, and can alleviate the pressure for relying on cluster.
S305, using correction factor the maximum query rate per second of target cluster is adjusted.
, will after the maximum query rate per second for relying on cluster and allowing that target cluster is relied on is obtained in the present embodiment
The maximum query rate per second itself allowed of the target cluster is arranged to rely on the maximum query rate per second of cluster.
Query rate per second can be determined according to the Thread Count and response time of setting in practice, by default thread
Number and the ratio of response time are as query rate per second.In order to save the process performance for relying on cluster, avoid finally leading
Cause dependence cluster to collapse, after correction factor is got, the correction factor is done with maximum query rate per second before and multiplied
Product, the maximum query rate per second after an adjustment can be obtained, and the maximum query rate value per second after adjustment is utilized into network
Host node of the communication synchronization to cluster.
In the present embodiment, target cluster limits dividing for itself according to the maximum query rate per second that is allowed of cluster is relied on
With number of passes, that is, realize that itself is limited concurrent request quantity, play a part of protection and rely on cluster, and in performance objective
During request, by monitoring the change of response time, to understand the situation of change for the process performance for relying on cluster, work as appearance
When process performance is reduced or is deteriorated, saved in time using the current response time monitored, Dependency Set can be reduced
The probability for phenomena such as group occurs shaking or collapsed, reduce the impact to caused by relying on cluster of target cluster.
Example IV
As shown in figure 4, its structural representation for the thread distributor of the embodiment of the present invention four.The thread distributor
Including:Query rate acquisition module 11, response time acquisition module 12, current thread acquisition module 13, distribution threading models 14, institute
Need thread acquisition module 15, judge module 16 and distribute module 17.
Query rate acquisition module 11, the maximum inquiry per second for relying on cluster and allowing relied on for obtaining target cluster
Rate.
Response time acquisition module 12, for when distributing thread to pending destination request, obtaining the object set
Group and the response time relied between cluster.
Current thread acquisition module 13, the current thread number being used for obtaining the target cluster.
Distribute thread acquisition module 14, for based on maximum query rate per second, the response time and it is described ought
Preceding Thread Count, obtain target cluster distributes Thread Count.
Required thread acquisition module 15, for obtaining the required Thread Count of the destination request.
Judge module 16, for judging Thread Count needed for the destination request can distribute thread described in whether being less than or equal to
Number.
Distribute module 17, for judging that the required Thread Count can distribute line described in being less than or equal in the judge module
During number of passes, then corresponding thread is distributed for the destination request.
Thread acquisition module 14 is distributed, Thread Count can be distributed specifically for being obtained based on equation below;
N=(M-Qt*Ct)/Qt;
Wherein, Thread Count can be distributed described in N expressions;M represents the maximum query rate per second;Ct represents current thread number;
Qt represents single thread query rate per second, and Qt=1/RT, RT represent the response time.
In the present embodiment, response time acquisition module 12, specifically for obtaining the historical responses time in preset duration, base
The response time is obtained in the historical responses time.
Response time acquisition module 12, specifically for rejecting the exception history response time in the historical responses time,
To obtain the remaining historical responses time, the arithmetic mean of instantaneous value of the remaining historical responses time is calculated, and by the calculation
Art average value is as the response time.
Alternatively, response time acquisition module 12, specifically for starting the dedicated thread for being used for measuring the response time in real time,
Measured in real time by the dedicated thread, to obtain the response time.
As shown in figure 5, a kind of alternatively frame mode of thread acquisition module 15 needed for the present embodiment, including:Disassemble
TU task unit 151, judging unit 152, setting unit 153 and computing unit 154.
Wherein, TU task unit 151 is disassembled, task amount is disassembled corresponding to the destination request for obtaining.
Judging unit 152, for judging described to disassemble whether task amount exceeds default maximum task amount.
Setting unit 153, exceed the maximum task for the judged result in the judging unit to disassemble task amount
During amount, then the goal task amount using the maximum task amount as the destination request.
Computing unit 154, for the Thread Count according to needed for default individual task and the goal task amount, calculate institute
State the required Thread Count of destination request.
Further, computing unit 154, be additionally operable to the judged result in judging unit 152 for disassemble task amount without departing from
During the maximum task amount, then the Thread Count according to needed for the individual task and it is described disassemble task amount, calculate the target
The required Thread Count of request.
TU task unit 151 is disassembled, specifically for data volume corresponding to destination request is corresponding with default individual task
Data volume radix does ratio, using the ratio as disassembling task amount.
The thread distribution method that the present embodiment provides, the maximum for relying on cluster and allowing relied on by obtaining target cluster
Query rate per second, when destination request distributes thread, according between maximum query rate per second, target cluster and dependence cluster
The current thread number that response time and target cluster are used, the Thread Count that distributes of target cluster is obtained, obtains target
The required Thread Count of request, when Thread Count needed for destination request is less than or equal to that Thread Count can be distributed, then distribute phase for destination request
The thread answered.In the present embodiment, target cluster according to rely on the maximum query rate per second that is allowed of cluster can come limit itself
Number of passes is distributed, that is, realizes that itself is limited concurrent request quantity, plays a part of protection and relies on cluster, reduce to Dependency Set
Impact caused by group, reduce and rely on the risk that cluster occurs shaking or collapsed.
Embodiment five
As shown in fig. 6, its structural representation for the thread distributor of the embodiment of the present invention five.The thread distributor
Processing includes query rate acquisition module 11, response time acquisition module 12, current thread acquisition module in above-described embodiment four
13rd, distribute outside thread acquisition module 14, required thread acquisition module 15, judge module 16 and distribute module 17, in addition to:Place
Reason time-obtaining module 18, comparison module 19, queue module 20, priority setup module 21, setup module 22, mould is monitored in real time
Block 23, response time correcting module 24, correction factor acquisition module 25 and adjusting module 26.
Processing time acquisition module 18, it is described for judging that the required Thread Count is less than or equal in the judge module
When can distribute Thread Count, the processing time handled needed for the destination request is obtained.
Comparison module 19, for by the processing time compared with default time threshold.
Distribute module 17, if being additionally operable to the processing time is less than the time threshold, for the destination request point
With corresponding thread.
Queue module 20, for when the processing time being more than or equal to the time threshold, then by the destination request
It is placed into waiting list and ranks, waits thread distribution next time.
Priority setup module 21, it is default when meeting for when the destination request waits in line the distribution of next thread
Priority set condition when, the priority of the destination request is arranged to highest;
Distribute module 17, be additionally operable to when it is described distribute Thread Count be more than or equal to it is described needed for Thread Count when, be directly institute
State thread corresponding to destination request distribution.
Processing time acquisition module 18, specifically for calculating single thread query rate per second according to the response time, obtain
Take single thread query rate per second and the product for distributing Thread Count;Obtain the sample size of the destination request with it is described
Can product ratio, using the ratio as the processing time.
Setup module 22, the cluster that relies on relied on for query rate acquisition module acquisition target cluster allow most
After big query rate per second, the maximum query rate per second itself allowed of the target cluster is arranged to the dependence cluster
Maximum query rate per second.
Real-time monitoring modular 23, for during the destination request is performed, monitoring the current response time in real time.
Response time correcting module 24, if being more than the response in duration time interval for the current response time
During the time, using the current response time monitored in the time interval, a revised response time is calculated.
Correction factor acquisition module 25, ratio is done with the revised response time for obtaining the response time,
And using the ratio as correction factor.
Adjusting module 26, for being adjusted using coefficient after the amendment to the thread needed for the individual task, with
And repair coefficient described in utilizing and the maximum query rate per second of the target cluster is adjusted.
In the present embodiment, target cluster limits dividing for itself according to the maximum query rate per second that is allowed of cluster is relied on
With number of passes, that is, realize that itself is limited concurrent request quantity, play a part of protection and rely on cluster, and in performance objective
During request, by monitoring the change of response time, to understand the situation of change for the process performance for relying on cluster, work as appearance
When process performance is reduced or is deteriorated, saved in time using the current response time monitored, Dependency Set can be reduced
The probability for phenomena such as group occurs shaking or collapsed, reduce the impact to caused by relying on cluster of target cluster.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above-mentioned each method embodiment can lead to
The related hardware of programmed instruction is crossed to complete.Foregoing program can be stored in a computer read/write memory medium.The journey
Sequence upon execution, execution the step of including above-mentioned each method embodiment;And foregoing storage medium includes:ROM, RAM, magnetic disc or
Person's CD etc. is various can be with the medium of store program codes.
Finally it should be noted that:Various embodiments above is merely illustrative of the technical solution of the present invention, rather than its limitations;To the greatest extent
The present invention is described in detail with reference to foregoing embodiments for pipe, it will be understood by those within the art that:Its according to
The technical scheme described in foregoing embodiments can so be modified, either which part or all technical characteristic are entered
Row equivalent substitution;And these modifications or replacement, the essence of appropriate technical solution is departed from various embodiments of the present invention technology
The scope of scheme.