Web Prerequisite Performance Stress test Tool webbench and Apchebench (AB)

Source: Internet
Author: User
Tags benchmark phpinfo server port website performance

in operation and maintenance work, stress testing is a very important work. For example, before a website online, can withstand how much traffic, in the case of large traffic performance, these data indicators will directly affect the user experience. However, in the stress test there is a common denominator, that is, the results of the stress test and the actual load results will not be identical, even if the pressure test work done better, there is no guarantee that the 100% and the same performance indicators on the line. Faced with these problems, we can only try to find ways to simulate. Therefore, stress testing is very necessary, with these data, we can do the maintenance of our platform to be aware of. Website Performance Stress testing is an essential part of the performance tuning process, only to allow the server to be in high-pressure situations can truly reflect the various settings exposed problems.


The following is a general introduction to the two most useful Web performance stress testing tools

Directory:

1.Web Required Performance pressure test Tool Webbench detailed

2.Web Required Performance pressure test Tool Apchebench detailed



A: Web prerequisite performance Stress test Tool Webbench Detailed

Webbench is a well-known website stress testing tool that was developed by Lionbridge Inc. (http://www.lionbridge.com).

Webbench can test the performance of different services on the same hardware, as well as the health of the same service on different hardware. The standard test of Webbench can show us two things about the server: the corresponding requests per second and the amount of data transferred per second. Webbench can not only have the ability to test the static pages, but also the ability to test dynamic pages (asp,php,java,cgi). And he supports static or dynamic performance testing of secure websites that contain SSL, such as e-commerce sites. Webbench can simulate up to 30,000 concurrent connections to test the load capacity of the Web site.

Official homepage: http://home.tiscali.cz/~cz210552/webbench.html


1, Webbench Installation:

wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gzmkdir/usr/local/man/man1-p Tar zxvf WEBBENCH-1.5.TAR.GZCD Webbench-1.5makemake Install


2. Webbench Usage:

webbench-c Concurrency number-t run Test time URL usage examples are as follows: Webbench-c 1000-t http://192.168.1.8/phpinfo.php


Apache Test Example results:
#当并发300时, shown as having 0 links failed, indicating no overload

[Email protected] webbench-1.5]# webbench-c 300-t http://192.168.80.157/phpinfo.php
Webbench-simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source software.


Benchmarking:get http://192.168.80.157/phpinfo.php
Clients, running Sec.

speed=24525 pages/min, 20794612 bytes/sec.
requests:24525 Susceed, 0 failed.

#当并发1000时, 87 connection failed have been shown, indicating overload.

[Email protected] webbench-1.5]# webbench-c 1000-t http://192.168.80.157/phpinfo.php
Webbench-simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source software.


Benchmarking:get http://192.168.80.157/phpinfo.php
Clients, running Sec.

speed=24920 pages/min, 21037312 bytes/sec.
requests:24833 Susceed, failed.

The number of TCP connections generated after concurrent 1000 runs for 60 seconds is more than 27,000:

[Email protected] ~]# netstat-nat|grep-i "|wc-l27391"


Use the webbench tool to summarize:
1, the pressure test work must be put on the product before the launch, rather than on-line after.
2, the test concurrency should be increased by small gradually, such as 100 when observing the site load is how much, open the page is fluent, concurrency 200 is how much, the site is slow when the concurrency is how much, the site is not open when concurrency is how much, and finally do data statistics. More detailed analysis of the results
3, a more detailed test of a page, the access to a larger proportion of the file. such as e-commerce website can focus on testing shopping carts, promotional pages, etc., because these pages accounted for the overall site visits a large proportion.


II: Web Essential Performance Stress test tool Apchebench Detailed

Apachebench Command principle:

The AB command creates many concurrent access threads, simulating multiple visitors accessing a URL address at the same time. Its test target is URL-based, so it can be used to test the load pressure of Apache, as well as other Web servers such as Nginx, Lighthttp, Tomcat, and IIS.

The AB command is very low on the computer that emits the load, does not occupy a high CPU, and does not consume a lot of memory, but it creates a huge load on the target server, which is similar in principle to ccxxx. The use of their own testing should also be noted, or too much load at a time, may cause the target server due to resource consumption, serious even caused the crash.


Apachebench parameter description format: ab     [options]     [http:#]hostname[: Port]/path parameter Description:-n requests number of requests to perform# The number of requests executed in the test session (the total number of times the page was visited for this test). By default, only one request is executed. -c concurrency number of multiple requests to make# the number of requests that are generated at a time (number of concurrent). The default is one at a time. The maximum number of seconds that the-t timelimit seconds to max. wait for responses# test takes. Its internal implied value is-n 50000. It allows you to limit the testing of the server to a fixed total time. By default, there is no time limit. -p postfile file containing data to post# contains the files that require POST data, and the file format is "p1=1&p2=2". Use the method is  -p 111.txt .   (with-t)-t content-type content-type header for posting#post data using Content-type header information , such as  -T  "application/x-www-form-urlencoded"  .   (with-p)-v verbosity how much troubleshooting info to print# setting the level of detail to display information  – 4 or larger values display header information,  3 or larger values can display response codes (404, 200, etc.), and  2 or larger values can display warnings and other information. -V  Displays the version number and exits. -w print out results in html tables# output results in HTML table format. By default, it is a table with a two-column width on a white background. -i use head instead of get#  executes the HEAD request instead of GET. -x attributes string to insert as table attributes-y attributes  String to insert as tr attributes-z attributes string to insert  as td or th attributes-C attribute Add cookie, eg. -C  "C1=1234,c2=2,c3=3"   (repeatable) #-c cookie-name=value  attach a cookie to the request: line. Its typical form is a parameter pair of Name=value. This parameter can be repeated, separated by commas. #提示: You can use the session implementation principle to pass Jsessionid parameters, to achieve the function of maintaining the session, such as-c  "c1=1234,c2=2,c3=3,jsessionid= Ff056cd16da9d71cb131c1d56f0319f8 ". -h attribute add arbitrary header line, eg. ' Accept-encoding: gzip '  Inserted after all normal header lines.  ( REPEATABLE)-A ATTRIBUTE ADD BASIC WWW&NBsp Authentication, the attributes are a colon separated username and  password.-p attribute add basic proxy authentication, the attributes  are a colon separated username and password.#-p proxy-auth-username: password  provides a Basic authentication trust to a transit agent. The user name and password are separated by a: and sent in Base64 encoded form. This string is sent regardless of whether the server is required (that is, if the 401 authentication requirement code is sent). -x proxy:port proxyserver and port number to use-v print version  number and exit-k use http keepalive feature-d do not show  percentiles served table.-S Do not show confidence estimators  and warnings.-g filename output collected data to gnuplot format  File.-e filename output csv file with percentages served-h display  usage information  (this message) #-attributes  set the properties of the string .  the bug program has various statically declared fixed-length buffers. In addition, parsing of command-line arguments, the response headers of the server, and other external inputs can be very simple, which may have undesirable consequences. It does not fully implement  HTTP/1.x;  accepts only certain ' expected ' response formats. The frequent use of STRSTR (3) can lead to performance problems, i.e. you may be testing the performance of AB rather than the server.

A lot of parameters, generally we use the-C and-n parameters can be. For example:

# ab-c 5000-n http://127.0.0.1/index.php


Apachebench usage:

#在Linux系统下, the general installation of Apache can be directly executed; Ab-n 4000-c http://192.168.1.3/index.html# If it is a win system, open the CMD Command Line window, CD to the Apache installation directory of the bin directory;-N after the 4000 represents a total of 4,000 requests;-C after 1000 means 1000 concurrent (simulating 1000 people simultaneous access), the following URL represents the target URL of the test.


Wait a moment to get a result similar to the one shown below (Omit section):

[Email protected] html]# ab-n 4000-c http://192.168.1.3/index.htmlThis is apachebench, Version 2.3 < $Revision: 655654 $>copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/Licensed to the Apache software Founda tion, http://www.apache.org/Benchmarking 192.168.1.3 (Be patient) completed-requestscompleted requestscompleted requestscompleted requestscompleted 2400 requestscompleted 2800 requestsCompleted 3200 R equestscompleted 3600 requestscompleted 4000 requestsfinished 4000 requests


The results are analyzed as follows:


This is Apachebench, Version 2.3
Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
Licensed to the Apache software Foundation, http://www.apache.org/

Benchmarking 192.168.1.3 (Be patient)

Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed 2400 Requests
Completed 2800 requests
Completed 3200 Requests
Completed 3600 Requests
Completed 4000 requests
Finished 4000 requests

Server software:apache/2.2.15
Server hostname:192.168.1.3

Server port:80 #测试的页面端口

Document Path:/index.html #测试的页面

Document length:50797 bytes #页面大小

Concurrency level:1000#测试的并发数
Time taken for tests:11.846 seconds#整个测试持续的时间
Complete requests:4000#完成的请求数量
Failed requests:0#失败的请求数量
Write errors:0
Total transferred:204586997 bytes#整个过程中的网络传输量
HTML transferred:203479961 bytes#整个过程中的HTML内容传输量
Requests per second:337.67 [#/sec] (mean)#最重要的指标之一, which is equivalent to the number of transactions per second in LR, the mean in the parentheses below indicates that this is an average
Time per request:2961.449 [MS] (mean)
#最重要的指标之二, which is equivalent to the average transaction response time in LR, the mean in parentheses below indicates that this is an average
Time per request:2.961 [MS] (mean, across all concurrent requests)
#每个连接请求实际运行时间的平均值
Transfer rate:16866.07 [Kbytes/sec] Received
#平均每秒网络上的流量 to help troubleshoot problems with extended response times due to excessive network traffic
Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 483 1773.5 11 9052
Processing:2 556 1459.1 255 11763
Waiting:1 515 1459.8 220 11756
total:139 1039 2296.6 275 11843
#网络上消耗的时间的分解, the specific algorithms for each data are not particularly clear

Percentage of the requests served within a certain time (MS)
50% 275
66% 298
75% 328
80% 373
90% 3260
95% 9075
98% 9267
99% 11713
100% 11843 (Longest request)
#整个场景中所有请求的响应情况. Each request in the scene has a response time, where 50% of the user's response time is less than 275 milliseconds, 66% of the user response time is less than 298 milliseconds, and the maximum response time is less than 11843 milliseconds. In the case of concurrent requests, the CPU is not actually processed at the same time, but is rotated on a per-request basis, so basically the first time of the request is approximately equal to the second time per requests multiplied by the number of concurrent requests.

use Apchebench (AB) Summary: In the remote Web server stress testing, often the effect is not ideal (because the network delay is too large), it is recommended to use the intranet of another or more servers through the intranet to test, so that the data obtained, the accuracy will be much higher. If you have a single server, you can test directly locally, more accurately than the remote test effect. (But be aware that it is not online)




Web Prerequisite Performance Stress test Tool webbench and Apchebench (AB)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.