ABtest 性能测试
ab 模拟 get 性能测试:
-n 请求次数
-c 请求线程数
最后是路径
ab -n 100 -c 10 https://www.baidu.com
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
m
Benchmarkinghttp://127.0.0.1:8002/webapi/ (be patient).....done
Server Software: nginx/1.6.0
Server Hostname: teststaff.91jinrong.com
Server Port: 443
SSL/TLS Protocol: TLSv1/SSLv3,ECDHE-RSA-AES128-GCM-SHA256,2048,128
Document Path: /api/permission_list?username=xueshi123&subsystem=WALLET
Document Length: 63136 bytes
Concurrency Level: 10
Time taken for tests: 69.852 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 6344900 bytes
HTML transferred: 6313600 bytes
Requests per second: 1.43 [#/sec] (mean)
Time per request: 6985.199 [ms] (mean)
Time per request: 698.520 [ms] (mean, across all concurrent requests)
Transfer rate: 88.70 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 24 59 45.7 40 267
Processing: 855 6721 1103.0 6807 8034
Waiting: 694 6418 966.7 6696 7196
Total: 898 6779 1111.2 6832 8125
Percentage of the requests served within a certain time (ms)
50% 6832
66% 7108
75% 7608
80% 7812
90% 7950
95% 8077
98% 8124
99% 8125
100% 8125 (longest request)
Concurrency Level: 并发级别
Time taken for tests :测试消耗时间 seconds/秒
Time taken for tests: s
-----------------------------------------------------------------------------------------------------
ab test 模拟 post data 压测接口性能
ab
-n 请求次数
-c 请求线程数
-p 请求参数文件,文件格式: post_loc.txt
-T 请求数据类型 application/x-www-form-urlencoded 表单提交
cd /tmp
vim post_loc.txt
businessLine=qianbao&uname=714758616345&name=1jHFu3F6&cardId=A4tlZ8nWSY78niYa00iVGA6Q>18=true
发起测试接口
ab -p post_loc.txt -T application/x-www-form-urlencoded -H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' -H 'Accept: application/json' -c 10 -n 100 http://127.0.0.1:8002/webapi/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarkinghttp://127.0.0.1:8002/webapi/ (be patient).....done
Server Software: nginx
Server Hostname: http://127.0.0.1:8002/webapi/
Server Port: 443
SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256
Document Path: http://127.0.0.1:8002/webapi/
Document Length: 100 bytes
Concurrency Level: 10
Time taken for tests: 1.218 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 43000 bytes
Total body sent: 35500
HTML transferred: 10000 bytes
Requests per second: 82.10 [#/sec] (mean)
Time per request: 121.797 [ms] (mean)
Time per request: 12.180 [ms] (mean, across all concurrent requests)
Transfer rate: 34.48 [Kbytes/sec] received
28.46 kb/s sent
62.94 kb/s total
Connection Times (ms)
min mean[+/-sd] median max
Connect: 55 82 13.7 82 119
Processing: 17 35 12.0 33 66
Waiting: 17 33 11.2 31 66
Total: 87 117 13.9 116 159
Percentage of the requests served within a certain time (ms)
50% 116
66% 121
75% 126
80% 128
90% 137
95% 143
98% 148
99% 159
100% 159 (longest request)
-----------------------------------------------------------------------------------------------------
ab test 模拟 post json 压测接口性能
-n 请求次数
-c 请求线程数
-p 请求参数文件,文件格式: post_loc.txt
-T 请求数据类型 application/json json格式提交
ab -n 200 -c 10 -T 'application/json' -p post.json http://127.0.0.1:8002/webapi/
post.json
{
"jsonrpc": "2.0",
"method": "test_method",
"params": [1442885518, 1442892718,"testDomain_80"],
"id": "1"
}
网友评论