A kind of method of definite Web server performance
Technical field
The invention belongs to the field tests of Web server, particularly relate to a kind of method of definite Web server performance.
Background technology
The Web system is made up of Web server, plurality of client machine and network system, and the quality of its service ability is influenced by the performance of Web server, user's behavioural characteristic and network condition three jointly.In recent years, popular along with Internet, Web are used each corner that is deep into our work, life, and many traditional industries and information system are moved on the Internet, comprise ecommerce, information search and information sharing field.Under a large amount of, dynamic, changeable user's request situation, Web server needs the request of timely process user and returns corresponding information.In order to ensure reliability of system operation, fail safe, stability and high efficiency, we need to the Web server performance carry out one effectively, accurately the evaluation and test.
At present, the method for assessment Web server performance generally can be divided into two kinds, and wherein a kind of is the method for analogue simulation, queueing theory for example, Petri net; And another kind is the method for test monitoring, and its assessment foundation is mainly based on journal file, resource utilization, response time.
The main thought of the method for analogue simulation is: by simplifying the Web system, extract the main factor that influences the Web server performance, comprise that cache size, demand file size, the network bandwidth, user ask feature, hardware resource, and reduce a formula, and use this formula to ask for the Web server performance index, comprise throughput, response time, resource utilization, error rate.This method can be represented the relation between factor of influence and the Web server performance intuitively, helps the more deep Web server performance of understanding, and can instruct the optimization of Web server and the analysis of performance bottleneck.But because these class methods judge with simplified system and by the data that obtain alternately of simulation Virtual User and virtual server whether these class methods are effective, are difficult to real server is carried out Performance Evaluation.
The main thought of the method for test monitoring is: monitor by the Web server to true environment, recording user request amount, user's operation behavior, resource utilization, response time, request error rate, throughput, and assess the performance of Web server by right recorded analysis.This method is according to real data assessment Web server performance, and these class methods are more reliable undoubtedly for the server that is used for actual motion.Three kinds of methods of main flow have following characteristics: analyze the Web server performance according to the Web server journal file, but according to the Web service of log file analysis Web server performance need long-play, be mainly used in the trial run of server, consumed time is longer; According to utilization of resources situation analysis is under the situation of Web server performance bottleneck in resource, guiding assessment that can be correct, yet the factor that causes this decreased performance has a lot, comprises CPU, internal memory, network, operating system, third party software, and is not only resource; Be applicable to the Performance Evaluation of any configuration server according to the service ability of the relation of response time and user's request amount assessment Web server, because the response time is the comprehensive embodiment of server performance, but the selected correctness of response time threshold values has directly determined accuracy and validity according to this method of response time assessment Web server performance.
Summary of the invention
In order to solve above technical problem, the invention provides a kind of method of definite Web server performance.This method is by monitoring utilization rate and user's request responding time and the error rate of Web server and host internal memory, CPU, the relation between they and the user's request amount analyzed is determined the peak load of Web server, thereby assess the performance of Web server fast and accurately, using hardware resource and meet consumers' demand for rational and effective provides accurate, reliable foundation.
The present invention uses two physical machine, and one as server end, and one as client.Dispose Web server at server end with virtual technology; At client installation testing software, come the behavior of analog subscriber visit Web server, thereby server is initiated request by client.The inventive method realizes as follows:
1) selects an initial user request amount, carry out the user then and ask to generate and the performance synchronization observation process;
2), extract resource that institute monitor variation maximum in the resource as reference resource R according to the relation of resource utilization and user's request amount approximately linear
Reference, according to R
ReferenceMaximum U
MaxEstimate next user's request amount P
Next, carry out the user then and ask to generate and the performance synchronization observation process.If calculate next user's request amount P according to the relation of resource utilization and user's request amount approximately linear first
NextThe time, U
MaxGet theoretical maximum, go to step 3); Otherwise jump to step 4);
Described resource utilization comprise host CPU, internal memory utilize situation; The CPU of virtual machine, internal memory utilize situation;
3) if execution result shows reference resources R
ReferenceBe not the Web server performance bottleneck, remember that then this resource utilization is reference resources R
ReferenceActual maximum utilance, note is U
Avaliable, get U
Avaliable60%~90% as U
Max, jump to step 2); If execution result shows reference resources R
ReferenceBe the Web server performance bottleneck, then execution in step 4);
4) according to before the Web server arrival peak load, the relation of approximate index of client user's request amount and response time is monitored user's request amount and the corresponding response time that obtains in the experiment before extracting, and calculates next user's request amount P
Next, carry out the user and ask to generate and the performance synchronization observation process;
5) if the deviation that execution result shows the average response time of request and response time threshold values in setting range and user's request error rate less than the error rate threshold values, then looking this user's request amount is the treatable maximum load of server, also be the peak load of Web server, otherwise execution in step 4);
Described user asks to generate with the performance synchronization observation process: call the workload generator instrument, Web server is produced user's request, the CPU of monitor server end host, internal memory utilizes situation simultaneously; CPU, the internal memory of monitoring virtual machine utilize situation; Monitoring request responding time and error rate;
Because the present invention determines the performance of Web server according to the response time, accurate in order to ensure the result, we set each selected user's request amount, and the execution user need guarantee that the response time in the experimental result has the accuracy of 95% confidence level and 90% after asking generation and performance synchronization observation process.Yet there is contradictory relation in accuracy with the test expense, testing time is long more, and number of times is many more, and accuracy is high more, the present invention is by the dynamic adjustments testing time and select suitable balanced both sides relation of testing time, thereby reaches the purpose of determining the Web server performance fast and accurately.
The present invention compares with the advantage of conventional method as follows:
1) selects U
Avaliable60%-90% calculate next user's request amount P as reference point
NextNo matter whether resource is the Web server performance bottleneck, the request amount that calculates is all less than the server peak responsibility;
2) increase error rate as the regulation and control parameter, can effectively reduce the inaccurate error that causes of response time threshold values value.
In the critical point of Web server bottleneck, error rate compares to the response time and has more notable attribute, when Web server has enough ability process user requests, its error rate is almost 0, the explanation server is near bottleneck point when error rate rises, and the control error rate is less than 1% among the present invention.
3) according to before the Web server arrival peak load, the relation of approximate index of client user's request amount and response time is determined the performance of Web server more fast, and has wider applicability.
4) Dynamic Selection testing time.For different load levels, reach the test expense difference of the required cost of same accuracy.Load is big more, and expense is big more.Adopt dynamic testing time can effectively reduce test expense and assurance result's accuracy.
5) by script control test, can reduce tester's working strength, improved the efficient of test simultaneously.
Description of drawings
Fig. 1 is experimental situation figure of the present invention;
The work sheet that Fig. 2 carries out for the controller CAE that is responsible for scheduling, monitoring resource;
Fig. 3 is a flow chart of the present invention.
Embodiment
The present invention is described further below in conjunction with accompanying drawing:
As shown in Figure 1, we are based upon Web server in the virtualized environment, utilize dynamically regulating characteristics of virtualized hardware resource, test adaptability of the present invention under different server configuring conditions.
Fig. 2 has provided the work sheet that controller CAE carries out, thereby the present invention mainly regulates resource, analog subscriber request generation, monitor system performance and adjusts test case by controller CAE invoke script:
(1) internal memory and the cpu resource amount of regulating host, and the internal memory cpu resource amount of virtual machine by xm mem-set DOMAIN MEM and xm sched-credit – d – w-c, thus realize internal memory and the cpu resource configuration that Web server is different.Wherein DOMAIN is for needing to regulate the territory of internal memory, and MEM is for regulating memory size, and-d is for needing to regulate the territory of cpu, and-w is the relative weighting value, and-c is absolute weighted value.It should be noted that the performance of host can influence the performance of upper strata virtual machine, need guarantee at first that host can normally move.In the present invention, we guarantee that host has the cpu resource of 256 MB of memory and 20% at least.
(2) by calling workload generator httperf modelling customer behavior, Web server is generated load, at least to comprise in every instruction destination server IP address (--server), loadtype ([period [d|u|e] T1[, T2]]) and the load size (--rate), can set think time, concurrent length, maximum number of connections, concurrent request number in addition, send cache size, accept cache size.The present invention uses the httperf instrument that Web server generation arrival rate is met the load of Poisson distribution, and extracts the value of response time, error rate from the test result of returning.
(3) use the operating position of the cpu resource of xentop tool monitors host and virtual machine, it should be noted that the xentop order only in host, carrying out, and the value that obtains of monitoring by the operating position of the cpu resource that is assigned to of monitoring territory.As distribute the 30%CPU resource to give virtual machine, and the utilization rate that monitoring obtains is 70%, then utilization rate is 70% of 30% resource of distributing.The testing time of among the present invention each user's request amount being selected for use is adopted empirical value, in experimental situation of the present invention, continues to generate same user and asks 120s, and server performance tends towards stability.Synchronous monitoring 120s adopts every the 10s once sampling, samples altogether 11 times, because the value that sampling first obtains is 0, so only need be except that 10 times when being averaged.
(4) operating position of use top tool monitors internal memory, computing formula is used/total.Because the consumption of internal memory is to apply for from memory pool, it consumes along with the growth of time accumulation gradually.In order to calculate the operating position of internal memory accurately, we select to carry out monitoring calculation every 1s sampling method once among the last 10s.In addition, the Web server that the present invention adopts is an Apache Server, has memory leak issue, calculates accurately in order to ensure memory usage, in the present invention, restarts Apache Server when we adopt each change user request amount.
As shown in Figure 3, the present invention can be divided into the two large divisions: determine that user's request amount size and execution user ask to generate and the performance synchronization observation process.Is to have 90% accuracy under 95% situation in order to ensure experimental result in confidence level, after we determine user's request amount size at every turn, at least carry out the user and ask generation and performance synchronization observation process three times, and the response time in the extraction experimental result calculate its accuracy, if accuracy is less than 90%, then increase by 1 execution user at every turn and ask to generate and the performance synchronization observation process, up to reaching 90% accuracy.No longer repeat specification in following steps.Concrete steps are as follows:
1) an at first given less value is carried out the user and is asked to generate and the performance synchronization observation process as the initial user request amount, and the response time is to have 90% accuracy under 95% situation in confidence level in experimental result;
2) extract the resource that the resource that changes maximum is considered as most possibly causing the Web server performance bottleneck according to the value of (3) (4) monitoring, be designated as reference resources R
Reference, and, calculate next user's request amount P according to the relation of approximately linear between resource utilization and the user's request amount
NextSize, promptly
U wherein
MaxFor changing maximum resource R
ReferenceTheoretical maximum when becoming the server performance bottleneck, internal memory, CPU theoretical maximum are 90%.C is resource R
ReferenceThe resource utilization of correspondence under Web server 0 loading condition, U (P
1) be that user's request amount is P for the first time
1The time correspondence resource utilization.Carry out the user and ask to generate and the performance synchronization observation process, the response time is to have 90% accuracy under 95% situation in confidence level in experimental result.If calculate next user's request amount P according to the relation of approximately linear between resource utilization and the user's request amount first
Next, then go to step 3); Otherwise jump to step 4);
3) if resource R
ReferenceBe not Web server performance bottleneck point (response time and error rate are far longer than its threshold values and resource utilization much smaller than theoretical value), then writing down this utilance is U
Avaliable, U
MaxGet U
Avaliable60%~90% as reference point, delete this experimental result, jump to step 2); Otherwise go to step 4);
4) arrive peak load according to Web server before, the relation of approximate index of client user's request amount and response time, response time and corresponding user's request amount before extracting in twice experimental result, and substitution following formula calculating factor of influence lnA, the size of B, promptly
P wherein
i, T
iBe user's request amount and corresponding response time size.And calculate next user's request amount P according to factor of influence
NextSize.
T wherein
SatBe the response time threshold values.Carry out the user and ask to generate and the performance synchronization observation process, the response time is to have 90% accuracy under 95% situation in confidence level in experimental result;
5) if average response time and average error rate all less than the threshold values of setting, and next user's request amount P of prediction
NextWith the maximum user's request amount P that satisfies performance requirement
HighBetween error amount in permissible range, then determine to satisfy maximum user's request amount P of performance requirement
HighPeak responsibility P for this server
PeakOtherwise, jump to step 4).