Summary of the invention
For the deficiencies in the prior art, the present invention proposes a kind of powerline network application server overload controlling method based on hybrid optimization, to reach, realizes the object that overload is controlled, reduced energy consumption and raise the efficiency.
A powerline network application server overload controlling method for hybrid optimization, comprises the following steps:
Step 1, be set the sampling interval, according to sampling interval and random coefficient, determine actual samples spacing, and in this actual samples spacing arrival rate and the processing speed of number of services, different business in sense cycle, obtain the utilance of CPU, and according to the free space of service spatial cache, obtain service spatial cache utilance;
Step 2, judge whether application server transships, whether the utilance that judges CPU is greater than the threshold value setting according to demand, whether the spatial cache of judgement service simultaneously utilance is greater than the threshold value setting according to demand, if above-mentioned, both are greater than threshold value simultaneously, application server transships, stop receiving the business in next cycle and perform step 3, otherwise, will add in the sampling interval and return in the lump execution step 1;
Step 3, all business are sorted according to the priority of setting, and the cpu busy percentage of each business after acquisition sequence, in all business, select cpu busy percentage and be greater than the business of cpu busy percentage threshold value separately, as controlled different priorities overload business;
Step 4, the total energy consumption consuming according to the whole business of application server processes, in conjunction with the restrictive condition of different business speed control, set up efficiency Optimized model, is specially:
Step 4-1, according to the maximum traffic processing speed of server and the shared ratio of server basal energy expenditure, set up the relation between energy consumption and speed control;
Step 4-2, the total energy consumption consuming according to the total speed control of overload business and the whole business of application server processes, set up the relation between efficiency and service with different priority levels speed control;
Step 4-3, be set in the qualifications of overload in control procedure, the speed control that the cpu busy percentage that comprises service with different priority levels is less than its cpu busy percentage threshold value, service with different priority levels is all greater than two service with different priority levels speed control ratios of zero-sum in scope is set;
Qualifications in step 4-4, combination overload control procedure is set up the relation between efficiency and service with different priority levels speed control;
Different priorities overload Service control speed when step 5, employing Hybrid Particle Swarm obtain efficiency maximum;
The speed control optimal solution of different priorities overload business when step 6, employing genetic algorithm for solving efficiency maximum, by the final speed control of selection, intersection, mutation operation acquisition different priorities overload business;
Step 7, according to the final speed control of the different priorities overload business obtaining, counter is set, set the quantity of reception business in next cycle, realize the control of application server overload;
Step 8, judge in this sampling interval whether all business all finish dealing with, and if so, will the sampling interval subtract one, wait for and receive new business, and return to execution step 1; Otherwise continue surplus lines to process.
Described in step 1 according to sampling interval and random coefficient, determine actual samples spacing, be specially: sampling interval and random coefficient are multiplied each other and obtain actual samples spacing, and described random coefficient span is 0~1.
Described in step 1 according to the arrival rate of number of services, different business and processing speed, obtain the utilance of CPU;
Cpu busy percentage r
1formula is as follows:
Wherein, w represents number of services, v
ethe arrival rate of expression business e,
the processing speed of expression to business e;
Described according to the free space of service spatial cache, obtain service spatial cache utilance r
2, formula is as follows:
r
2=(P
o-P
c)/P
o (2)
Wherein, P
ofor service buffer queue total length; P
cthe free space that represents service spatial cache.
Qualifications in combination overload control procedure described in step 4-4 is set up the relation between efficiency and service with different priority levels speed control, is specially and sets up efficiency Optimized model, and formula is as follows:
Wherein, S
ithe speed control that represents the overload business that when efficiency is maximum, priority is i; E(S
i) represent the efficiency of the overload business that priority is i, φ
ithe processing speed that represents the overload business that application server is i to priority, u
ithe threshold value that represents the cpu busy percentage of the business that priority is i, O represents the set of the business of transshipping, S
ithe speed control that represents the business that priority is i, S
jthe speed control that represents the business that priority is j, n
ithe business that expression priority is i accounts for the percentage of overload business sum, n
jthe business that expression priority is j accounts for the percentage of overload business sum;
Two service with different priority levels speed control ratios described in step 4-3 are in arranging scope,
Difference overload Service control speed when step 5 adopts Hybrid Particle Swarm to obtain efficiency maximum, specifically comprises the following steps:
Step 5-1, according to Hybrid Particle Swarm, the speed control of different priorities overload business is carried out to initialization, comprise the speed control that M group different priorities overload business is set, the speed control that M group different priorities overload business is set changes size, generates at random initialization speed control matrix S
mNand rate variation rate matrix V
mN:
Wherein, s
iii the business initializtion speed control that represents the business that priority is i, I=1,2 ..., M, i=1,2 ..., N, v
iispeed control corresponding to I business that represents the business that priority is i changes size, and N represents the priority of the business of transshipping;
Step 5-2, according to the speed control of the overload business of M group different priorities, calculate respectively the efficiency value of each business, from calculate the efficiency value obtaining, select the efficiency maximum of every group of business, and above-mentioned efficiency maximum is positioned in the vector of corresponding Service control speed, obtain M group vector, be specially:
By the maximum efficiency value E of Group I different priorities overload business
iand speed control is deposited in vectorial p
iin, i.e. vectorial p
i=[s
i1, s
i2..., s
iN, E
i];
According to efficiency value size, from vectorial p
iin choose initial optimal vector p
g, i.e. efficiency value maximum vector, p
g=[s
g1, s
g2..., s
gN, E
max], 1≤g≤M, E
maxfor M optimum efficiency value E
imiddle efficiency value maximum;
Step 5-3, determine initial temperature;
Formula is as follows:
T
0=E
max/ln5 (6)
Wherein, T
0represent initial temperature;
Step 5-4, determine each vectorial p under Current Temperatures
iadaptation value TF (p
i):
Wherein, e represents natural logrithm, T
ttemperature while representing current iteration, during t=1, T
t=T
0;
And according to vectorial p
iadaptation value, adopt roulette method to select one group of vector to upgrade initial optimal vector p from M group vector
g;
Step 5-5, to vectorial p
iwith optimal vector p
gupgrade, specific as follows:
More new formula is as follows:
Wherein, v
ii(t) represent the speed control variation size corresponding to I business of the business that the priority in this iteration is i; v
ii(t+1) represent the speed control variation size corresponding to I business of the business that the priority in next iteration is i; p
iirepresent vectorial p
ithe speed control of middle efficiency maximum; p
githe speed control that represents overall efficiency maximum, s
ii(t) represent I the speed control that business is corresponding of the business that the priority in this iteration is i; s
ii(t+1) represent I the speed control that business is corresponding of the business that the priority in next iteration is i;
represent the speed compression factor, ω
1, ω
2for the study factor, be set to 2, r
1, r
2for the random number between [0,1], t represents iterations;
The speed control and the speed control changing value that upgrade the new different priorities overload business obtaining are replaced to matrix S
mNand matrix V
mNin, and then to vectorial p
iupgrade, and from upgrading all groups vector p
iin select efficiency value maximum vector, by efficiency value and the vectorial p of the efficiency value maximum vector obtaining after upgrading
gefficiency value compare, if the efficiency value of efficiency value maximum vector is greater than vectorial p after upgrading
gefficiency value, to vectorial p
greplace renewal; Otherwise do not upgrade;
Step 5-6, move back temperature operation, upgrade temperature value;
T
t+1=λT
t
T
t+1temperature while representing next iteration; λ represents to move back warm coefficient, and span is 0~1;
Step 5-7, judge whether to reach iterations threshold value, if so, obtain final optimal vector, obtain middle the speed control of different priorities overload business, otherwise return, perform step 5-4;
Sampling interval described in step 2 adds one, when the sampling interval, is greater than the sampling interval during higher limit, and the sampling interval is set to higher limit; Sampling interval described in step 8 subtracts one, when the sampling interval is less than 1, says that the sampling interval is set to 1.
Advantage of the present invention:
A kind of powerline network application server overload controlling method based on hybrid optimization of the present invention, by setting up the relation function between speed control and efficiency, it is constraints that the overload of take is controlled, consider the overload control and efficiency problem of application server simultaneously, build the optimization Overload Control Model of efficiency.Utilize Hybrid Particle Swarm and genetic algorithm to transship control, particle cluster algorithm search efficiency is high, through less algebraically, evolve and just can converge near minimax solution, and use simulated annealing strategy to do the position of particle, upgrade restriction, make particle jump out local optimum, increase hunting zone, break away from precocious phenomenon, finally with relevance grade function, carry out individuality assessment, carry out on this basis genetic manipulation, obtain accurate optimal solution, utilize the present invention can be effectively application server in powerline network to be transshipped to control.
Embodiment
Below in conjunction with accompanying drawing, an embodiment of the present invention is described further.
A powerline network application server overload controlling method for hybrid optimization, method flow diagram as shown in Figure 1, comprises the following steps:
Step 1, be set the sampling interval, according to sampling interval and random coefficient, determine actual samples spacing, and in this actual samples spacing arrival rate and the processing speed of number of services, different business in sense cycle, obtain the utilance of CPU, and according to the free space of service spatial cache, obtain service spatial cache utilance;
In the embodiment of the present invention, network diagram as shown in Figure 2, structure sampling interval λ=15, produce random number α ∈ (0,1], with step-length (actual samples spacing) α λ, carry out unequal-interval and measure the service rate that arrives application server, measure service buffer queue size, the input parameter whether transshipping as Analysis server; As shown in Figure 3,6 kinds of business arrival rates that collect, under normal circumstances, the service rate that arrives server is more stably, when some service rate value of constantly locating increases suddenly, service rate departs from normal value, can tentatively judge this place's application server overload.
Cpu busy percentage r
1formula is as follows:
Wherein, w represents number of services, v
ethe arrival rate of expression business e,
the processing speed of expression to business e;
Service spatial cache utilance r
2, formula is as follows:
r
2=(P
o-P
c)/P
o (2)
Wherein, P
ofor service buffer queue total length; P
cthe free space that represents service spatial cache.
Step 2, judge whether application server transships, whether the utilance that judges CPU is greater than the threshold value setting according to demand, whether the spatial cache of judgement service simultaneously utilance is greater than the threshold value setting according to demand, if above-mentioned, both are greater than threshold value simultaneously, application server transships, stop receiving the business in next cycle and perform step 3, otherwise, will add in the sampling interval and return in the lump execution step 1;
In the embodiment of the present invention, in conjunction with cpu busy percentage r
1compare r with the buffer queue free time
2judge whether application server transships, if r
1> η
1and r
2> η
2(η wherein
1and η
2for decision threshold, η
1=0.9, η
2=0.9), traffic overload, otherwise nonoverload.When business nonoverload, if λ is >m, allow λ=m, m is maximum step-length, in the embodiment of the present invention, λ=30, otherwise adjust λ=λ+1, return to step 1; When traffic overload, if λ≤1 allows λ=1, otherwise adjust λ=λ-1, perform step 3.
Step 3, all business are sorted according to the priority of setting, and the cpu busy percentage of each business after acquisition sequence, in all business, select cpu busy percentage and be greater than the business of cpu busy percentage threshold value separately, as controlled different priorities overload business;
In the embodiment of the present invention, all types of service are set up to priority list s={s from low to high
1, s
2, s
3, and setting up corresponding cpu resource occupancy thresholding list u={0.4,0.3,0.2}, sets up and each business CPU utilance list of initialization
upgrade
if
priority s
qcorresponding traffic overload, q=1 wherein, 2 ..., 3;
In the embodiment of the present invention, business 1 and business 2 are 2 kinds of the highest business of priority, and the quantitative proportion of the quantity of business 1 and business 2 is 1:2; Business 3 and business 4 are the business of 2 kinds high priorities, and the quantitative proportion of the quantity of business 3 and business 4 is 1:2, and business 5 and business 6 are 2 kinds of business that priority is minimum, and the quantitative proportion of the quantity of business 5 and business 6 is 1:2.Application server is respectively 40,80,50,100,60,120 to the processing speed of business 1,2,3,4,5,6.As shown in Figure 4, as shown in Figure 5, as can be seen from Figure 4 and Figure 5, there is overload second at 51-200 in application server to the utilance of the CPU of the business of different priorities to the cpu busy percentage of all kinds of business.
Step 4, the total energy consumption consuming according to the whole business of application server processes, in conjunction with the restrictive condition of different business speed control, set up efficiency Optimized model, is specially:
Step 4-1, according to the maximum traffic processing speed of server and the shared ratio of server basal energy expenditure, set up the relation between energy consumption f (S) and speed control S;
Wherein, c represents server capacity, and S represents service control speed, and δ is used for describing the shared ratio of basal energy expenditure of server, in embodiment, and c=200, δ=0.2.
Step 4-2, the total energy consumption consuming according to the total speed control of overload business and the whole business of application server processes, set up the relation between efficiency and service with different priority levels speed control;
From (12)~(13),
o represents the set of the business of transshipping, and C represents total arrival rate of the business of transshipping.
Step 4-3, be set in the qualifications of overload in control procedure, the speed control that the cpu busy percentage that comprises service with different priority levels is less than its cpu busy percentage threshold value, service with different priority levels is all greater than two service with different priority levels speed control ratios of zero-sum in scope is set;
Qualifications in step 4-4, combination overload control procedure and the relation between efficiency and service with different priority levels speed control, set up efficiency Optimized model;
Formula is as follows:
Different priorities overload Service control speed when step 5, employing Hybrid Particle Swarm obtain efficiency maximum;
Specifically comprise the following steps:
Step 5-1, according to Hybrid Particle Swarm, the speed control of different priorities overload business is carried out to initialization, comprise M(M=50 be set) speed control of group different priorities overload business, the speed control that M group different priorities overload business is set changes size, generates at random initialization speed control matrix S
mNand rate variation rate matrix V
mN:
Wherein, s
iii the business initializtion speed control that represents the business that priority is i, I=1,2 ..., M, i=1,2 ..., N, v
iispeed control corresponding to I business that represents the business that priority is i changes size, and N represents the priority of the business of transshipping, N=6;
Step 5-2, according to the speed control of the overload business of M group different priorities, calculate respectively the efficiency value of each business, from calculate the efficiency value obtaining, select the efficiency maximum of every group of business, and above-mentioned efficiency maximum is positioned in the vector of corresponding Service control speed, obtain M group vector, be specially:
By the maximum efficiency value E of Group I different priorities overload business
iand speed control is deposited in vectorial p
iin, i.e. vectorial p
i=[s
i1, s
i2..., s
iN, E
i];
According to efficiency value size, from vectorial p
iin choose initial optimal vector p
g, i.e. efficiency value maximum vector, p
g=[s
g1, s
g2..., s
gN, E
max], 1≤g≤M, E
maxfor M optimum efficiency value E
imiddle efficiency value maximum;
Step 5-3, determine initial temperature;
Formula is as follows:
T
0=E
max/ln5 (6)
Wherein, T
0represent initial temperature; For the first time in iteration, T
0=100
Step 5-4, determine each vectorial p under Current Temperatures
iadaptation value TF (p
i):
Wherein, e represents natural logrithm, T
ttemperature while representing current iteration, during t=1, T
t=T
0;
And according to vectorial p
iadaptation value, adopt roulette method to select one group of vector to upgrade initial optimal vector p from M group vector
g;
Step 5-5, to vectorial p
iwith optimal vector p
gupgrade, specific as follows:
More new formula is as follows:
Wherein, v
ii(t) represent the speed control variation size corresponding to I business of the business that the priority in this iteration is i; v
ii(t+1) represent the speed control variation size corresponding to I business of the business that the priority in next iteration is i; p
iirepresent vectorial p
ithe speed control of middle efficiency maximum; p
githe speed control that represents overall efficiency maximum, s
ii(t) represent I the speed control that business is corresponding of the business that the priority in this iteration is i; s
ii(t+1) represent I the speed control that business is corresponding of the business that the priority in next iteration is i;
represent the speed compression factor, ω
1, ω
2for the study factor, be set to 2, r
1, r
2for the random number between [0,1], t represents iterations;
The speed control and the speed control changing value that upgrade the new different priorities overload business obtaining are replaced to matrix S
mNand matrix V
mNin, and then to vectorial p
iupgrade, and from upgrading all groups vector p
iin select efficiency value maximum vector, by efficiency value and the vectorial p of the efficiency value maximum vector obtaining after upgrading
gefficiency value compare, if the efficiency value of efficiency value maximum vector is greater than vectorial p after upgrading
gefficiency value, to vectorial p
greplace renewal; Otherwise do not upgrade;
Step 5-6, move back temperature operation, upgrade temperature value;
T
t+1=λT
t
T
t+1temperature while representing next iteration; λ represents to move back warm coefficient, and span is λ=0.99 in 0~1, embodiment;
Step 5-7, judge whether to reach iterations threshold value 500, if so, obtain final optimal vector, obtain middle the speed control of different priorities overload business, otherwise return, perform step 5-4;
The speed control optimal solution of different priorities overload business when step 6, employing genetic algorithm for solving efficiency maximum, the final speed control of acquisition different priorities overload business;
When efficiency is maximum, the speed control of different priorities overload business, as the initial population of genetic algorithm, obtains the exact solution of model by selection, intersection, the mutation operation of genetic algorithm
the final speed control that represents i business.
Step 7, according to the final speed control of the different priorities overload business obtaining, counter is set, set the quantity of reception business in next cycle, realize the control of application server overload;
Counter is arranged, with this, transship control;
Within each sampling interval, according to class of service, upgrade different business priority, upgrade each business stand-by period in buffer queue simultaneously.Service request of every arrival is just taken out a token and is presented to this business from token bucket, and counter values subtracts one; CPU handles a service request and its token is turned back in token bucket, and counter values adds one.When in token bucket, token number is 0, be that counter values is 0, if existed in existing buffer memory than the new low business of service priority that arrives, by buffer memory medium priority minimum and the shortest business of stand-by period from buffer queue, delete, and give new arrival business by its token, newly arrival business is put into buffer queue simultaneously.Otherwise, abandon this business.
Step 8, judge in this sampling interval whether all business all finish dealing with, and if so, will the sampling interval subtract one, wait for and receive new business, and return to execution step 1; Otherwise continue surplus lines to process.
As shown in Figure 6, application server transships at 51~200s, and the present invention has successfully been controlled at the arrival rate of business in a rational scope, and speed control maintenance is stable, meets certain validity and fairness simultaneously.
Fig. 7 and Fig. 8 are the cpu busy percentage of 3 kinds of priority services under the present invention controls and the cpu busy percentage of 6 kinds of business, as seen from the figure, the embodiment of the present invention is limited in the cpu busy percentage of business near threshold value, the cpu busy percentage of service with different priority levels remains near threshold value, total cpu utilization remains on 0.9 left and right, and the cpu busy percentage of high and low priority meets respectively default requirement, the cpu busy percentage separately of 6 kinds of business remains in rational scope.
Fig. 9 is efficiency of the present invention and the comparison of the efficiency of controlling without overload, can find, efficiency of the present invention is more superior, has successfully reduced the demand of application server to resource, make application server more energy-conservation, further show robustness of the present invention and superiority.
When Figure 10 is cpu busy percentage thresholding difference, the relation of network energy efficiency and iterations, can find out that network energy efficiency is more superior along with the increase of CPU threshold value.