unbuntu 下ab 测试工具的安装使用

本文介绍如何使用ApacheBench(ab)进行网站压力测试,并通过实例演示如何对百度首页进行测试,包括安装配置、基本用法及结果解读。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Apache Benchmark(ab) 一款由apache提供的压力测试软件

首先我们先安装 环境

sudo apt-get install apache2-utils
//使用
用法:ab [options][http[s]://]hostname[:port]/path
//  -n 请求数 -c 并发数 url 目标压测地址
ab -n100 -c10 

//对百度进行 压力测试
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
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).....done


Server Software:        BWS/1.1        // 服务器
Server Hostname:        www.baidu.com
Server Port:            80

Document Path:          /
Document Length:        96792 bytes

Concurrency Level:      10
Time taken for tests:   30.740 seconds
Complete requests:      100
Failed requests:        90
   (Connect: 0, Receive: 0, Length: 90, Exceptions: 0)
Total transferred:      9777233 bytes
HTML transferred:       9677750 bytes
Requests per second:    3.25 [#/sec] (mean)   //每秒钟的请求数
Time per request:       3074.004 [ms] (mean)    //时间越短越好
Time per request:       307.400 [ms] (mean, across all concurrent requests)
Transfer rate:          310.61 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       21   31   7.1     30      52
Processing:    82  468 3057.2    123   30717
Waiting:       21   40  30.6     35     321
Total:        114  499 3056.3    157   30740

Percentage of the requests served within a certain time (ms)
  50%    157
  66%    172
  75%    185
  80%    218
  90%    341
  95%    520
  98%    629
  99%  30740
 100%  30740 (longest request)


转载于:https://my.oschina.net/kakoi/blog/520021

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值