Before learning AB tools, we need to know a few concepts about stress testing
Throughput rate (requests per second)
Concept: A quantitative description of the server concurrency processing capability, in reqs/s, refers to the number of requests processed per unit of time for a concurrent user. The maximum number of requests per unit of time that a concurrent user could process, called the maximum throughput rate.
Calculation formula: Total number of requests/time taken to complete these requests, i.e.
Request per second = complete Requests/time taken for tests
Concurrent connections (the number of concurrent connections)
Concept: The number of requests received by the server at some point, simply speaking, is a conversation.
Concurrent users (the number of concurrent users,concurrency level)
Concept: To be aware of the difference between this concept and the number of concurrent connections, a user may produce multiple sessions at the same time, that is, the number of connections.
Average user request wait time (times per request)
Calculation formula: The amount of time spent processing all requests (total number of requests/concurrent users), i.e.
Time per request = time taken for tests/(complete requests/concurrency level)
Average Server request latency (time per request:across all concurrent requests)
Calculation formula: The amount of time/Total requests processed to complete all requests, i.e.
Time taken For/testscomplete requests
As you can see, it is the reciprocal of the throughput rate.
At the same time, it also = user average request waiting time/number of concurrent users, i.e.
Time per request/concurrency level
Introduction to AB Tools
AB all called: Apache bench
Download AB Tools
Go to Apache official website http://httpd.apache.org/download Apache
Start AB tool
In Windows environment, Apache installation path is C:\apache\Apache24\ for example
Open terminal, enter command
cd C:\apache\Apache24\bin
You can start AB
Start testing
Input command
ab -n 100 -c 10 http://test.com/
Where-n indicates the number of requests, and-C represents the number of concurrent
Test results Analysis
When the above command runs, it's out of the test report.
Full Test Report
- This section shows the Web server information, you can see the server is using Nginx, the domain name is wan.bigertech.com, the port is 80
Server information
- This is information about the requested document, where "/", the size of the document is 338436 bytes (this is the body length of the HTTP response)
Document Information
- This section shows a few important indicators of stress testing
Key indicators
Concurrency level:100
Number of concurrent requests
Time taken for tests:50.872 seconds
Duration of the entire test
Complete requests:1000
Number of requests completed
Failed requests:0
Number of failed requests
Total transferred:13701482 bytes
Network traffic in the entire scene
HTML transferred:13197000 bytes
The amount of HTML content transferred throughout the scene
Requests per second:19.66 [#/sec] (mean)
Throughput rate, one of the most concerned indicators, equivalent to the number of transactions per second in LR, followed by mean in parentheses indicates that this is an average
Time per request:5087.180 [MS] (mean)
Average user request Wait time, the two most concerned about the indicator, equivalent to the average transaction response time in LR, the following parentheses in the mean that this is an average
Time per request:50.872 [MS] (mean, across all concurrent requests)
Server average request processing time, the three most concerned about the target
Transfer rate:263.02 [Kbytes/sec] Received
Average traffic on the network per second can help eliminate the problem of extended response times due to excessive network traffic
- This segment represents the decomposition of the time consumed on the network
Network consumption time
- This is the distribution of each request processing time, 50% of the processing time in 4930ms, 66% of the processing time within 5008ms ..., it is important to see the processing time of 90% .
Response information about login issues
Sometimes a stress test requires a user to log in, what to do?
Please refer to the following steps:
- After logging in with your account and password, use the developer tools to find the cookie value (session ID) that identifies the session.
If only one cookie is used, simply type the command:
ab -n 100 -C key=value http://test.com/
If more than one cookie is required, set the header directly:
ab -n 100 -H “Cookie: Key1=Value1; Key2=Value2” http://test.com/
Summarize
In general, AB Tool AB is small and simple, quick to learn, can provide the basic performance indicators needed, but no graphical results, can not be monitored. The AB tool can therefore be used as a temporary emergency task and as a simple test.
The same type of pressure testing tools are: Webbench, siege, Http_load, etc.
Wen/orange sauce (Jane book author)
Original link: http://www.jianshu.com/p/43d04d8baaf7
Copyright belongs to the author, please contact the author to obtain authorization, and Mark "book author".
AB Pressure measuring tool