Ubuntu16.04 ab安装以及使用教程
admin
2023-07-31 15:03:08
0
  1. sudo apt-get install apache2-utils

安装ab


2.ab -n 10000 -c 100 https://www.baidu.com/

压力测试www.baidu.com的http访问性能

-n 10000 总共请求数10000

-c 100个并发线程同时访问

性能测试报告如下:

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/


Benchmarking www.baidu.com (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:        bfe/1.0.8.18

Server Hostname:        www.baidu.com

Server Port:            443

SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128


Document Path:          /

Document Length:        227 bytes


Concurrency Level:      100

Time taken for tests:   30.201 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      10326740 bytes

HTML transferred:       2270000 bytes

Requests per second:    331.12 [#/sec] (mean)

Time per request:       302.008 [ms] (mean)

Time per request:       3.020 [ms] (mean, across all concurrent requests)

Transfer rate:          333.92 [Kbytes/sec] received


Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:       20  255 626.4     33   15054

Processing:     7   33  82.0     10    1897

Waiting:        0   32  81.6     10    1895

Total:         27  288 635.1     50   15272


Percentage of the requests served within a certain time (ms)

  50%     50

  66%    241

  75%    257

  80%    293

  90%   1027

  95%   1056

  98%   2030

  99%   2060

 100%  15272 (longest request)


3.测试某个POST请求性能

ab -n 10000 -c 100 -p postfile -m POST localhost:8080/DealerProxySrv/DealerProxySrv/RHPCFollow

-n 10000 总共请求数10000

-c 100个并发线程同时请求

-p postfile

root@ubuntu:~/code# cat postfile 

{

    "TraderId": "200030258",

    "TBrokerId": 1,

    "CustomerId": "200027977",

    "CBrokerId": 1,

    "Strategy": 1,

    "Size": 1,

    "Direction": 1

}

-m POST,method为POST


性能测试报告如下:

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/


Benchmarking localhost (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests



Server Software:        

Server Hostname:        localhost

Server Port:            8080


Document Path:          /DealerProxySrv/DealerProxySrv/RHPCFollow

Document Length:        113 bytes


Concurrency Level:      100

Time taken for tests:   122.149 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      2450000 bytes

Total body sent:        3270000

HTML transferred:       1130000 bytes

Requests per second:    81.87 [#/sec] (mean)

Time per request:       1221.487 [ms] (mean)

Time per request:       12.215 [ms] (mean, across all concurrent requests)

Transfer rate:          19.59 [Kbytes/sec] received

                        26.14 kb/s sent

                        45.73 kb/s total


Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        0    0   0.8      0      26

Processing:    46 1216 184.4   1206    2428

Waiting:       46 1216 184.4   1206    2428

Total:         52 1216 184.2   1206    2428


Percentage of the requests served within a certain time (ms)

  50%   1206

  66%   1261

  75%   1300

  80%   1323

  90%   1391

  95%   1457

  98%   1599

  99%   1995

 100%   2428 (longest request)


相关内容

热门资讯

美官员称对伊朗打击是“惩罚”,... 当地时间7月7日,总台记者获悉,一名美国官员表示,美国正在对伊朗境内目标实施的军事打击“不是对等回应...
伊朗严正警告美国 伊朗外交部副部长加里巴巴迪当地时间8日在社交媒体上表示,美国取消对伊朗石油销售制裁的豁免,构成对美伊...
四川宜宾市发生5.0级地震,震... 中国地震台网正式测定:7月8日6时12分,在四川宜宾市高县(北纬28.52度,东经104.68度)发...
美军发动打击,伊朗多地传出爆炸... 当地时间今天(7月8日)凌晨,伊朗南部格什姆岛及锡里克、阿巴斯港等多地传出爆炸声。据伊朗媒体报道,锡...
瀚云通取得运动型线缆保护拖链专... 国家知识产权局信息显示,深圳市瀚云通科技有限公司取得一项名为“一种运动型线缆的保护拖链”的专利,授权...
第六届成渝双城青少年科技雏鹰研... 人民网重庆7月7日电 (记者胡虹)7月6日,由重庆市科协和成都市科协联合主办的第六届成渝双城青少年科...
三星Galaxy F70 Pr... IT之家 7 月 7 日消息,消息源 Mohammed Khatri 发文,透露三星旗下一款 Gal...
央媒关注!成都太空算力加速布局 7月6日,经济日报发布文章《太空算力加速布局》,其中关注成都构建从卫星制造到算力服务的全链条产业体系...
投资中国,与未来共舞——202... 7月8日下午,一场汇聚顶级资本力量与硬核科技创新力量的盛会——2026新京报贝壳财经年会未来大会 “...
美国恢复对伊朗石油制裁 根据美国财政部外国资产控制办公室当地时间7月7日消息,美国撤销一项授权允许伊朗石油销售的通用许可,相...