linux 压力测试命令 ab

ApacheBench

ab是apacheBench的缩写,是一个单线程命令,是Apache服务器自带的一个web压力测试工具,最初是用于测试Apache HTTP Server。使用时,ab命令会创建并发访问线程,模拟多个访问者同时对某一个URL地址进行访问。

安装

yum -y install httpd-tools

使用的方法:

ab [option] [http://]host[:port]/path

其中[option]是ab命令提供的可选参数,常用的参数:

-n 指定压力测试总共访问页面的次数,默认是1

-c 用于一次产生请求的并发数,默认是1

应用

测试IP地址为192.168.153.185上的web服务

[root@localhost ~]# ab -c 200 -n 10000 http://192.168.153.185/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.153.185 (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:        nginx/1.18.0
Server Hostname:        192.168.153.185
Server Port:            80

Document Path:          /
Document Length:        612 bytes

Concurrency Level:      200
Time taken for tests:   3.133 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      8450000 bytes
HTML transferred:       6120000 bytes
Requests per second:    3191.77 [#/sec] (mean)
Time per request:       62.661 [ms] (mean)
Time per request:       0.313 [ms] (mean, across all concurrent requests)
Transfer rate:          2633.83 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   21  82.3     12    1032
Processing:     4   31  35.7     25     858
Waiting:        4   30  35.6     24     858
Total:         10   52  91.2     40    1236

Percentage of the requests served within a certain time (ms)
  50%     40
  66%     46
  75%     51
  80%     54
  90%     66
  95%     91
  98%    212
  99%    264
 100%   1236 (longest request)
[root@localhost ~]# 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值