ABtest 性能测试

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&gt18=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"
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,868评论 18 139
  • 1. Java基础部分 基础部分的顺序:基本语法,类相关的语法,内部类的语法,继承相关的语法,异常的语法,线程的语...
    子非鱼_t_阅读 31,742评论 18 399
  • 红尘中 寻寻觅觅 碾转几春秋 情难舍 蹉跎岁月 爱恨又几回 谁在轻叹 一生等待 空等一春又一春的年华 桃花开 夏...
    想飞的鱼521314阅读 540评论 1 3
  • 晚上回到家,妈妈做了小鱼最爱吃的番茄圆子汤。饭桌上,小鱼整整齐齐摆放好了碗筷,等待着爸爸回家。小鱼的爸爸在市里一...
    明媚而忧伤的你阅读 139评论 0 0
  • 想你,你却不在我身边。 想你的时候,何止一句我想你。我想见你,带你跨过河流,欣赏山川,踏过草原,嗅嗅草地的芬芳,...
    凌猎阅读 179评论 0 0