Baidu Search: Xiao Qiang test brand
QQ Group: 522720170
What AB is
AB's full name is Apachebench, a gadget that comes with Apache and is designed for HTTP Server benchmark testing, which can simultaneously simulate multiple concurrent requests.
Usage of AB
AB's usage is: AB [options] [http://]hostname[:p Ort]/path
For example:
Ab-n 1000-c http://xqtesting.blog.51cto.com/
The above example shows a total of access to the cockroach's blog this script 1000 times, 200 concurrent execution concurrently.
Ab-n 1000-c 100-w http://xqtesting.blog.51cto.com/>>/root/xiaoqiang.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 xiaoqiang.html file.
Introduction of the common parameters of AB:
-N: Total number of requests executed, default is 1;
-C: Concurrency number, default is 1;
-T: Total time to test, seconds, default 50000s
AB Results Analysis
Too many results after running the above command? Can't you read it? Don't know which one to look at? What does each mean? There are 100,000 of them in your heart. Stop, we just need to pay attention to the following several indicators is good:
Requests per second (mean) corresponds to the number of transactions/sec in LR
Time per request (mean) equivalent to average transaction response times in LR
Percentage of the requests served within a certain time (MS)
How do I pass parameters?
Ab-n 1-c 1 "http://localhost/xiaoqiangshop/goods.php?id=20"
Be sure to have double quotes
Can ab complete the post operation?
Ab-n 10-c 10-k-P "login.ab"-T "application/x-www-form-urlencoded" "http://localhost/xiaoqiangshop/user.php"
-P file is post content (can be in JSON format, can be & format)
-t specifies how the post file is encoded using UrlEncode
-K keepalive Connection
The content in Login.ab is the combination of information required to log in, as follows:
Username=xiaoqiang&password=123123&act=act_login
Precautions
can use AB to complete an uncomplicated performance test, or create data to compare tests for a single URL
AB's success is based only on the status code of 2XX, not the return value of the server, but LR receives the full return of the server. So under the same response time, the number of concurrent tests supported by the AB test would be greater than Lr,tps and would be greater than LR.
When AB runs concurrently, it is related to the number of CPUs on the running machine, and the more the concurrency is. So the concurrency supported under Linux is greater than under Windows
Large concurrency under the data is not allowed, more to see the performance of AB itself rather than the performance of the server side
Extended Reading
Test website performance with Apache's own AB command: http://xqtesting.blog.51cto.com/4626073/1845431
Perform performance tests with Apache AB command