Web性能测试工具之ab入门篇
1. ab简介
2. ab下载
2.1 Windows系统
2.2 linux系统
yum install httpd
3. ab运行
4. 使用ab进行性能测试
ab -n -c http://www.cnblogs.com
# -n 总共10次请求,-c 模拟10个并发用户,即10个并发请求博客园首页,共请求10次 ab -t -c http://www.cnblogs.com
# -t 是测试执行时间,-c 模拟10个并发用户,即10个并发请求博客园首页,持续10秒
5. 测试结果

6. 结果解析
Server Software:
Server Hostname: www.cnblogs.com
Server Port: Document Path: /
Document Length: bytes #HTTP响应数据的正文长度 Concurrency Level: #并发数
Time taken for tests: 10.183 seconds #测试执行时间
Complete requests: #完成请求数
Failed requests: #失败请求数
Non-2xx responses:
Total transferred: bytes #网络总传输量
HTML transferred: bytes #HTML内容传输量
Requests per second: 16.60 [#/sec] (mean) #每秒请求数
Time per request: 602.545 [ms] (mean) #用户平均请求等待时间,计算公式:测试执行总时间/(总请求数/并发用户数)
Time per request: 60.254 [ms] (mean, across all concurrent requests) #服务器平均请求等待时间,计算公式:测试执行总时间/总请求数
Transfer rate: 6.27 [Kbytes/sec] received #平均传输速率 Connection Times (ms) #响应时间小、中、大值
min mean[+/-sd] median max
Connect: 325.5
Processing: 928.1
Waiting: 922.1
Total: 971.5 Percentage of the requests served within a certain time (ms) #一定时间内请求完成的百分比,如50%用户完成的响应时间在68ms内, %用户完成的响应时间在73ms内,%用户在3075ms内完成
%
%
%
%
%
%
%
%
% (longest request)
7. ab运行参数详解
Usage: ab [options] [http://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make at a time
-t timelimit Seconds to max. to spend on benchmarking
This implies -n
-s timeout Seconds to max. wait for each response
Default is seconds
-b windowsize Size of TCP send/receive buffer, in bytes
-B address Address to bind to when making outgoing connections
-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 to use for POST/PUT data, 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.
-q Do not show progress when doing more than requests
-l Accept variable document length (use this for dynamic pages)
-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.
-m method Method name
-h Display usage information (this message)
-n 即requests,用于指定压力测试/总请求数。
-c 即concurrency,用于指定压力测试的并发数。
-t 即timelimit,测试执行最大秒数,它可以让测试限制在一个固定的总时间以内,默认值为50000。
-s 即timeout,请求最大等待时长,默认30s
-b 即windowsize,TCP发送/接收的缓冲大小(单位:字节)。
-p 即postfile,发送POST请求时需要上传的文件,文件格式如"p1=1&p2=2"。使用方法是 -p .txt 。 (配合-T)
-u 即putfile,发送PUT请求时需要上传的文件。(配合-T)
-T 即content-type,用于设置Content-Type请求头信息,如 -T "application/x-www-form-urlencoded”,默认值为text/plain。(配合-p)
-v 即verbosity,设置显示信息的详细程度 – 4或更大值会显示头信息, 3或更大值可以显示响应代码(, 200等), 2或更大值可以显示警告和其他信息。
-w 以HTML表格形式打印结果。
-i 使用HEAD请求代替GET请求。
-x 插入字符串作为table标签的属性。
-y 插入字符串作为tr标签的属性。
-z 插入字符串作为td标签的属性。
-C 添加cookie信息,例如:"Apache=1234"。此参数可以重复,用逗号分割。提示:可以借助session实现原理传递 JSESSIONID参数, 实现保持会话的功能,如-C "c1=1234,c2=2,c3=3, JSESSIONID=FF056CD16DA9D71CB131C1D56F0319F8"。
-H 添加任意的请求头,例如:"Accept-Encoding: gzip",请求头将会添加在现有的多个请求头之后(可以重复该参数选项以添加多个)。
-A 添加一个基本的网络认证信息,用户名和密码之间用英文冒号隔开。
-P 添加一个基本的代理认证信息,用户名和密码之间用英文冒号隔开。如-P proxy-auth-username:password
-X 指定使用的代理服务器和端口号,例如:"126.10.10.3:88"。
-V 显示版本号并退出。
-k 使用HTTP的KeepAlive特性。
-d 不显示百分比。
-S 不显示预估和警告信息。
-q 超过150个请求后不显示进度
-l 接受可变文档长度(用于动态页面)
-g filename 输出结果信息到gnuplot格式的文件中。
-e filename 输出结果信息到CSV格式的文件中。
-r 指定接收到错误信息时不退出程序。
-m method 方法名
-h 帮助
Web性能测试工具之ab入门篇的更多相关文章
- pylot是一款开源的web性能测试工具
pylot是一款开源的web性能测试工具,http://www.pylot.org/ 参考文档:http://www.pylot.org/gettingstarted.html很容易上手 使用分为以下 ...
- 【web性能】web性能测试工具推荐
WEB性能测试工具主要分为三种,一种是测试页面资源加载速度的,一种是测试页面加载完毕后页面呈现.JS操作速度的,还有一种是总体上对页面进行评价分析,下面分别对这些工具进行介绍,如果谁有更好的工具也请一 ...
- Web性能测试工具:http_load安装&使用简介
除了siege,在Web性能测试工具中,http_load也是比较热门和常见的一款,有时因为种种原因,只能使用现成的工具,所以多了解和掌握一种Web性能测试工具是很有必要的. 1.下载安装包 略过 2 ...
- Web性能测试工具:Siege安装&使用简介
在Web性能测试工具中,siege是比较热门和常见的,它有安装简单,使用简单,测试报告详细的特点. 并且可以在文本中预定义一系列待测试url模拟,并可设定一定并发量下持续指定时间or测试进行测试. 比 ...
- Web性能测试工具推荐
WEB性能测试工具主要分为三种: 一种是测试页面资源加载速度的: 一种是测试页面加载完毕后页面呈现.JS操作速度的: 一种是总体上对页面进行评价分析. ~~~如果谁有更好的工具也请一起分享下 1. ...
- Web性能测试工具JMeter
做Web方面的黑盒测试,也就是功能测试,基本不需要什么测试工具,都是直接打开浏览器访问,点一点界面就行. 现在流行的移动互联网应用,客户端和服务端的开发是分离的,两者开发进度肯定不一样,可能存在服务端 ...
- 【转】开源性能测试工具 - Apache ab 介绍
版权声明:本文可以被转载,但是在未经本人许可前,不得用于任何商业用途或其他以盈利为目的的用途.本人保留对本文的一切权利.如需转载,请在转载是保留此版权声明,并保证本文的完整性.也请转贴者理解创作的辛劳 ...
- web性能测试工具——http_load
http_load是一款基于Linux平台的web服务器性能测试工具,用于测试web服务器的吞吐量与负载,web页面的性能. http_load是基于linux.unix平台的一种性能测工具 它以并行 ...
- 2015第22周一Web性能测试工具及IE扩展区别
在高性能web测试工具推荐http://www.jb51.net/article/23034.htm中发现了dynaTrace 感觉很不错,不但可以检测资源加载瀑布图,而且还能监控页面呈现时间,CPU ...
随机推荐
- sourcetree和gitlab配置图解
一.前期准备安装 1.git客户端(1.产生gitlab服务端和本地git相互传输时所需要校验的私钥和公钥 2.直接在Idea中使用git提交和push代码,当然也可以用sourcetree提交 ...
- 源码安装H2O Http 服务端程序到Ubuntu服务器
首先安装全家桶 apt install -y build-essential zlib1g-dev libpcre3 libpcre3-dev unzip cmake libncurses5-dev ...
- GCD之死锁体会
1.先看下几句代码 1 2 3 4 5 6 7 dispatch_queue_t serialqueue=dispatch_queue_create("serialqueue", ...
- 使用 TUN 设备实现一个简单的 UDP 代理隧道
若要实现在 Linux 下的代理程序,方法有很多,比如看着 RFC 1928 来实现一个 socks5 代理并自行设置程序经过 socks5 代理等方式,下文是使用 Linux 提供的 tun/tap ...
- Query DSL(2)----Full text queries
Match Query match查询接受文本/数值/日期 { "match" : { "message" : "this is a test&quo ...
- asp.net web api 2.2 基础框架(带例子)
链接:https://github.com/solenovex/asp.net-web-api-2.2-starter-template 简介 这个是我自己编写的asp.net web api 2.2 ...
- 51 nod 1495 中国好区间 奇葩卡时间题 700ms 卡O(n*log(n)), 思路:O(n)尺取法
题目: 这个题目竟然叫中国好区间,要不要脸.欸,不得不说还蛮顺口的,哈哈哈. 首先我们有一个数组a.可以递推得来,O(n)时间复杂度. 定义left(有效区间的左端点),bigger(有效区间中大于等 ...
- struts2中的Ajax异步校验
登录时验证码的异步校验: 1.验证码生成的是图片因此在struts.xml文件里面配置action 时,result标签中type 属性是stream 2.验证码图片的src的值为配置action名字 ...
- ios实现无限后台任务
需求 我们的app是使用心跳机制来保持用户的登陆状态,这样才能收到服务器发来的消息和命令,但是当app进入后台以后大约3分钟或者10分钟之后app就会被系统挂起,用户就会超时下线,这样就必须保持app ...
- “一切都是消息”--MSF(消息服务框架)之【发布-订阅】模式
在上一篇,“一切都是消息”--MSF(消息服务框架)之[请求-响应]模式 ,我们演示了MSF实现简单的请求-响应模式的示例,今天来看看如何实现[发布-订阅]模式.简单来说,该模式的工作过程是: 客户端 ...