使用Apache ab进行压力测试(参数说明)
我们一般会使用Apache自带的ab来对项目进行压力测试,看项目的执行情况如何.
我们可以使用 ab -v 来查看ab的详细参数使用方法.
- [root@node234 bin]# ./ab -v
- ab: option requires an argument -- v
- ./ab: wrong number of arguments
- Usage: ./ab [options] [http[s]://]hostname[:port]/path
- Options are:
- -n requests Number of requests to perform
- -c concurrency Number of multiple requests to make
- -t timelimit Seconds to max. wait for responses
- -b windowsize Size of TCP send/receive buffer, in bytes
- -p postfile File containing data to POST. Remember also to set -T
- -u putfile File containing data to PUT. Remember also to set -T
- -T content-type Content-type header for POSTing, eg.
- 'application/x-www-form-urlencoded'
- Default is 'text/plain'
- -v verbosity How much troubleshooting info to print
- -w Print out results in HTML tables
- -i Use HEAD instead of GET
- -x attributes String to insert as table attributes
- -y attributes String to insert as tr attributes
- -z attributes String to insert as td or th attributes
- -C attribute Add cookie, eg. 'Apache=1234. (repeatable)
- -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
- Inserted after all normal header lines. (repeatable)
- -A attribute Add Basic WWW Authentication, the attributes
- are a colon separated username and password.
- -P attribute Add Basic Proxy Authentication, the attributes
- are a colon separated username and password.
- -X proxy:port Proxyserver and port number to use
- -V Print version number and exit
- -k Use HTTP KeepAlive feature
- -d Do not show percentiles served table.
- -S Do not show confidence estimators and warnings.
- -g filename Output collected data to gnuplot format file.
- -e filename Output CSV file with percentages served
- -r Don't exit on socket receive errors.
- -h Display usage information (this message)
- -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
- -f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)
要进行压力测试可以执行以下命令,可以修改相应的参数:
ab -n1000 -c10 http://e60.chenwd.xxx.com/carindex.phpApache常用参数说明:
-n: 标识请求的总数.
-c: 标识请求的总用户 (如果请求的总数是1000,请求的总用户是10,那么平均每个用户执行100次请求)
-t: 请求的超时时间, 单位是秒.
执行结果:
- [root@node234 bin]# ./ab -n1000 -c10 http://e60.chenwd.xxx/carindex.php
- 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/
- Benchmarking e60.chenwd.dev.eebaobao.com (be patient)
- Completed 100 requests
- Completed 200 requests
- Completed 300 requests
- Completed 400 requests
- Completed 500 requests
- Completed 600 requests
- Completed 700 requests
- Completed 800 requests
- Completed 900 requests
- Completed 1000 requests
- Finished 1000 requests
- Server Software: nginx/0.9.4
- Server Hostname: e60.xxx.com
- Server Port: 80
- Document Path: /carindex.php
- Document Length: 5722 bytes
- Concurrency Level: 10
- Time taken for tests: 19.445 seconds
- Complete requests: 1000
- Failed requests: 0
- Write errors: 0
- Total transferred: 5990000 bytes
- HTML transferred: 5722000 bytes
- Requests per second: 51.43 [#/sec] (mean)
- Time per request: 194.446 [ms] (mean)
- Time per request: 19.445 [ms] (mean, across all concurrent requests)
- Transfer rate: 300.84 [Kbytes/sec] received
- Connection Times (ms)
- min mean[+/-sd] median max
- Connect: 12 60 19.8 58 205
- Processing: 47 133 32.9 126 298
- Waiting: 22 75 27.8 68 219
- Total: 112 193 36.8 183 374
- Percentage of the requests served within a certain time (ms)
- 50% 183
- 66% 195
- 75% 204
- 80% 214
- 90% 249
- 95% 270
- 98% 293
- 99% 304
- 100% 374 (longest request)
执行结果说明:
Server Software: 测试服务器的Web服务器软件名字
Server Hostname: 请求的域名
Server Port: 测试的访问端口
Document Path: 请求URL的绝问文件路径
Document Length: 表示HTTP相应的正文的长度
Concurrency Level: 标识并发的用户数(-c属性来设置)
Time taken for tests: 执行完所有的请求所花费的时间
Complete requests: 表示测试的总请求数
Failed requests: 失败的请求
Total transferred: 表示所有请求的响应数据的总和,包含头信息和正文长度.
HTML transferred: 表示所有请求中响应数据的正文长度 (不包含头信息的长度)
Requests per second: 这个就是我们要的吞吐率,表示每秒处理的请求数
Time per request: 表示每个用户平均等待的时间. 等于 Time taken for tests / (Complete requests / Concurrency Level)
Time per request:(mean, across all concurrent requests) 服务器平均请求处理的时间. 正是吞详细地址的倒数,为:Time per request / Concurrency Level 每个请求花费了多少秒
Transfer rate: 这些请求在单位内,从服务器获取的数据长度. 等于: Total transferred / Time taken for tests
Percentage of the requests served within a certain time (ms): 这部分数据用于描述每个请求处理时间的分页情况,百分之五十不超过183毫秒,. 百分之九十不超过249毫秒,百分百不超过374毫秒.
使用Apache ab进行压力测试(参数说明)的更多相关文章
- Apache ab参数--压力测试
Apache附带的ab,它非常容易使用,ab可以直接在Web服务器本地发起测试请求.这至关重要,因为我们希望测试的服务器的处理时间,而不包含数据的网络传输时间以及用户PC本地的计算时间. 需要清楚的是 ...
- Apache自带压力测试工具ab用法简介
ab命令原理 ab命令会创建很多的并发访问线程,模拟多个访问者同时对某一URL进行访问.它的测试目标是基于URL的,因此,既可以用来测试Apache的负载压力,也可以测试nginx.lighthttp ...
- PHP性能:序——谈ab(Apache Bench)压力测试工具
PHP性能:序——谈ab(Apache Bench)压力测试工具 ab(Apache Bench)是啥? ab是Apache自带的一个压力测试软件,可以通过ab命令和选项对某个URL进行压力测试.a ...
- 转:PHP性能:序——谈ab(Apache Bench)压力测试工具
PHP性能:序——谈ab(Apache Bench)压力测试工具 ab(Apache Bench)是啥? ab是Apache自带的一个压力测试软件,可以通过ab命令和选项对某个URL进行压力测试.a ...
- 开源的类似于Apache ab的压力测试命令行工具SuperBenchmarker
SuperBenchmarker 是ㄧ个开源的类似于Apache ab的压力测试命令行工具.可以在 .NET 4.52+ 或者 .NET Core 2.0+ 平台上运行. 可支持Get.Post.Pu ...
- 使用Apache Benchmark做压力测试遇上的5个常见问题
这一篇文章主要记录我在使用Apache Benchmark(一下检测ab)做网站压力测试的过程中,遇到的一些问题以及解决办法,方便日后使用. 这一篇文章主要记录我在使用Apache Benchmark ...
- kubernetes:基于ab的压力测试
基于ab的压力测试 # cat apache-test.yaml ################################################################### ...
- 使用Apache的ab进行压力测试
概述 ab是apache自带的压力测试工具,当安装完apache的时候,就可以在bin下面找到ab然后进行apache 负载压力测试. 后台测试开发中,常用的压力测试服务,php一般选择xampp,下 ...
- Apache自带压力测试工具----linux环境中ab命令简介及结果分析
ab(apache bench)是apache下的一个工具,主要用于对web站点做压力测试, 基础用法: 其中-c选项为一次发送的请求数量,及并发量.-n选项为请求次数. 实验测试: [dev@web ...
随机推荐
- 【学】SoapExtension 学习
http://msdn.microsoft.com/zh-cn/library/System.Web.Services.Protocols.SoapExtension_methods(v=vs.80) ...
- using-ef-code-first-with-an-existing-database
http://weblogs.asp.net/scottgu/using-ef-code-first-with-an-existing-database http://weblogs.asp.net/ ...
- NSString Byte NSData 字节(字符)字符串
NSUTF8StringEncoding 3个字节(字符)一个中文字符 一个字节一个英文字符
- Apache2.4为什么启动报错Cannot load php5apache2_4.dll into server
最近学习php,按照书上的描述,下载好apache和php后,按照其中配置进行,结果遇到了上述问题.花费了近一个半小时的时间解决了上述问题.现把解决问题过程中看到的方法总结如下. 最先肯定是一定要注 ...
- 惊涛怪浪(double dam-break) -- position based fluids
切入正题之前,先胡说八道几句. 据说爱因斯坦讲过:关于这个世界最难以理解的就是它是可以被理解的.人类在很长的时间里,都无法认知周围变幻莫测的世界,只能编造出无数的神祗来掌控世上万物的运行.到了近 ...
- [0x01 用Python讲解数据结构与算法] 关于数据结构和算法还有编程
忍耐和坚持虽是痛苦的事情,但却能渐渐地为你带来好处. ——奥维德 一.学习目标 · 回顾在计算机科学.编程和问题解决过程中的基本知识: · 理解“抽象”在问题解决过程中的重要作用: · 理解并实现抽象 ...
- MyBatis知多少(25)动态SQL
使用动态查询是MyBatis一个非常强大的功能.有时你已经改变WHERE子句条件的基础上你的参数对象的状态.在这种情况下的MyBatis提供了一组可以映射语句中使用,以提高SQL语句的重用性和灵活性的 ...
- bash的一些小技巧
1.从输入读入变量 eg:read -ep "input yes or no: " flag 用e选项表示编辑,可以使用backspace删除 2.数组 a.索引数组 declar ...
- AC_Dream 1224 Robbers(贪心)
题意:n个抢劫犯分别抢到的金钱是k1, k2, k3,...,一共得到的金钱是m, 但是在分钱的时候是按照x1/y, x2/y, x3/y,....的比例进行分配的!这样的话 一些抢劫犯就会觉得不公平 ...
- iOS二十种超酷时尚艺术滤镜汇总【附源码】
本文总结了20种ios滤镜都是基于GPUImage的,有3种滤镜是GPUImage库中包含的,还有17种是Instagram中的经典滤镜,集成在一个项目中.使用GPUImage可以非常容易创建我们自己 ...