- AB is a powerful test tool that comes with Apache, is very easy to use, and can fully simulate various conditions to initiate test requests to the Web server
- AB can initiate test requests locally directly on the Web server, which is critical to understanding the processing performance of the server, because it does not include the network transfer time of the data and the local computing time of the user's PC
- Apache has been installed to bring your own
Usage of AB
- AB [Options] [http://]hostname[:p Ort]/path
- Example: Ab-n 10000-c http://localhost/index.php
- The above example shows a total of 10,000 accesses to the http://localhost/index.php script, and 200 concurrent execution at the same time.
introduction of the common parameters of AB:
- -N: Total number of request executions, default is 1
- -C: Concurrency number, default is 1
- -T: Total time to test, seconds, default 50000s
- Data files when-p:post
- -W: Output results in HTML table format
start to simulate the pressure
1 [[email protected] ~]# ab-n 1000-c 100-w http://192.168.1.187/phpinfo.php >>/test/1.html
In the case where the test represents 100 concurrency, the test accesses the phpinfo.php script 1000 times and appends the test results to the/test/1.html file.
-----------------------------------------------------------------------------------------------2This is Apachebench, Version2.3< $Revision:655654$>3Copyright1996Adam Twiss, Zeus technology LTD, http://www.zeustech.net/4Licensed to the Apache software Foundation, http://www.apache.org/5Server software:apache/2.2. the6Server hostname:192.168.7Server Port:8Document Path:/phpinfo.php <--- the root absolute path in the requested URL9Document length:55814bytes <--- the body length of the HTTP response dataTenConcurrency level:100<---Number of concurrent users, which is the parameter of our custom setting OneTime taken forTests:1.123seconds <--- the time it takes for all these requests to be processed AComplete requests:1000<---The total number of requests, and here are the parameters of our custom settings -Failed requests:0<---The number of failed requests, where the failure refers to the request to connect to the server, send data, receive data link send exception, and no response timeout, etc. -Total transferred:56044544bytes <--- the sum of the response data length for all requests, including the header information of the HTTP response and the length of the body data theHTML transferred:55872200bytes <--- the sum of the body data in response data for all requests -Requests per second:890239.68<---Server throughput (which we need to focus on) -Transfer rate:49893076.87 kb/s received <--- user average request waiting time - connnection Times (ms) <--- network consumption of time decomposition, not very clear + min avg Max -Connect:0 3 32 +PROCESSING:43 102 113 ATOTAL:43 105 145
- In the case of 100 concurrent accesses, the total test access was 1000 times and failed 0 times. The script satisfies 100 concurrent access requirements in this environment.
Summarize:
- If the remote Web server test, the effect is not obvious, mainly the network delay is too large
- The author recommends using the intranet of another or more servers to test through the intranet, so that the resulting data, more accurate than the remote high
- If there is a single server, do not perform remote testing, you can test directly locally
Web Stress Test Tool AB