Under the Windows System command line, go to the directory where the Ab.exe program is located and execute the Ab.exe program. Note the direct double-click does not work correctly.
The parameters of AB are explained in detail
Normal test, with-c-n parameters to complete the task
Format:./ab [Options] [http://]hostname[:p Ort]/path
Parameters:
The total number of requests for the-n test. By default, only one request is executed
-c Number of concurrent requests. The default is one at a time.
-H adds a request header, such as ' Accept-encoding:gzip ', to be requested in gzip mode.
The maximum number of seconds that the-t 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 contains the files that require post data.
The Content-type header information used by the-t post data.
-V Sets the level of detail that displays information –4 or greater displays header information, 3 or greater values can display response codes (404, 200, etc.), and 2 or greater values can display warnings and other information. -V Displays the version number and exits.
-W outputs the result in the format of an HTML table. By default, it is a table with a two-column width on a white background.
-I executes the head request instead of get.
-c-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.
Execute test Case: ab-n 1000-c 100-w http://localhost/index.php >>c:\1.html
The above test case represents 100 concurrent scenarios, a total of test accesses to the index.php script 1000 times, and the test results are saved to the c:\1.html file.
We can understand the output from the literal meaning.
Here's a description of two more important indicators
Like what
Requests per second:16.54 [#/sec] (mean)
Time per request:60443.585 [MS] (mean)
Requests per second:16.54 [#/sec] (mean)
Indicates that the current test server can handle 16.54 static HTML request transactions per second, followed by mean for averaging. This value represents the overall performance of the current machine, and the larger the value the better.
Time per request:60443.585 [MS] (mean)
A single concurrent delay time, followed by a mean representing an average.
The average time required to complete a single request separately from the current concurrency.
Incidentally, two time per request difference
Time per request:60443.585 [MS] (mean)
Time per request:60.444 [MS] (mean, across all concurrent requests)
The previous measure of the delay of a single request, the CPU is divided into time slices to perform the request, multiple concurrent cases, a concurrent request to wait so long to get the next time slice.
Calculation method time per request:60.444 [MS] (mean, across all concurrent requests) * Concurrent number
The popular point is that when you complete the-N 1000 requests with the-C 10 concurrently, add a request to complete the average time required.
The latter measure of performance, which reflects the average time required to complete a request, and the time required to increase a request in the current concurrency situation.
Calculation method time taken for tests:60.444 Seconds/complete requests:1000
The popular point is that when you complete the-N 1001 requests with the-C 10, it takes more time than completing the-n1000 request.
Use AB for stress testing