Apache 压力测试工具ab
在 Apache 有个叫 ab(ApacheBench) 的程序, 此程序是专门用在做压力测试用的软件. ApacheBench(ab) 用来测试 apache 执行效率,可以用来测试网站的压力工具.
ab 参数
ab 参数:
Usage: /usr/sbin/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
§ -p postfile File containg data to POST
§ -T content-type Content-type header for POSTing
§ -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: zop'
§ 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
§ -s Use httpS instead of HTTP (SSL)
§ -h Display usage information (this message)
ab 使用
ab使用范例: 要执行 1000 次的 connection, 20 次的 concurrent (并行, 同时):
语法: ab -n 1000 -c 20
http://localhost/
产生出来的结果. 要注意的是以下几个:
§ Time taken for tests
: 总共执行花了多久的时间.(以上 1000 次共多久)
§ Requests per second
: 每秒平均可以处理多少个 connection.
下面是一个在Windows Azure虚拟机上做的测试,虚拟机性能不怎么样呀(和这个测试相比 ASP.NET Web Api vs Node.js Benchmark, Take 2)。
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
D:runnabletest>ab -n 100000 -c 80 -p test.dat -T 'application/json' http://loc
alhost/
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 localhost (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests
Server Software: Microsoft-IIS/8.0
Server Hostname: localhost
Server Port: 80
Document Path: /
Document Length: 5269 bytes
Concurrency Level: 80
Time taken for tests: 112.004 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Non-2xx responses: 100000
Total transferred: 553000000 bytes
Total POSTed: 62200000
HTML transferred: 526900000 bytes
Requests per second: 892.83 [#/sec] (mean)
Time per request: 89.603 [ms] (mean)
Time per request: 1.120 [ms] (mean, across all concurrent requests)
Transfer rate: 4821.62 [Kbytes/sec] received
542.32 kb/s sent
5363.94 kb/s total
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.3 0 16
Processing: 0 89 65.5 63 532
Waiting: 0 89 65.5 63 532
Total: 0 89 65.5 63 532
Percentage of the requests served within a certain time (ms)
50% 63
66% 78
75% 94
80% 94
90% 141
95% 235
98% 344
99% 407
100% 532 (longest request)
相关文章 :
ASP.NET Web Api vs Node.js Benchmark, Take 2
- 全球AI新闻创新实践系列③:华邮、雅虎、美联社、Quartz怎么干!
- nginx+php负载均衡集群环境中的session共享方案梳理
- PowerPoint发布及链接图片的处理
- EXCEL单元格的引用方式
- SqlDependency学习笔记
- linux系统下对网站实施负载均衡+高可用集群需要考虑的几点
- 运维利器-ClusterShell集群管理操作记录
- img标签的src=""会引起的Page_Load多次执行
- 2017影响扑克圈的黑暗事件
- 全量备份/增量备份/差异备份说明
- 子分类的合计
- FckEditor 2.6.4升级手记
- 负载均衡环境下的web服务器处理
- 不止抢工作 人工智能还有了“小情绪”
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Magicodes.IE之导入导出筛选器
- 一文搞懂Flink生成StreamGraph
- 知识全聚集 .Net Core 技术突破 | 如何实现一个模块化方案一
- ESP8266和ROS调试一些问题汇总
- tianbot_mini机器人上手ROS/SLAM/Navigation究竟有多简单???
- 如何知道我们的E2E测试覆盖率?
- tf.add_n函数的用法
- tensorflow 生成指定大小的赋值0的张量 np.zeros 在TF中对应的语句 生成全0张量
- Qt音视频开发25-ffmpeg音量设置
- 从HelloWorld开始了解Android
- 探究活动Activity
- 探究活动Activity(2)界面跳转及生命周期
- Android-MediaPlayer
- 如何友好的把Python和Bash结合在一起
- Android-MediaPlayer(2)加进度条和时间显示