一、简介
ApacheBench,简称ab,是 Apache 附带的一个小工具,专门用于 HTTP Server 的压力测试。
二、使用方法
最常用的使用方法如下:
ab -n 10 -c 10 http://www.google.com
这个命令表示向www.google.com发送10个请求,一次并发请求数为10次,即一次发送完10个请求。
所有可用参数如下:
Usage: /usr/local/apache/bin/ab [options] [http://]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
-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
-V Print version number and exit
-k Use HTTP KeepAlive feature
-h Display usage information (this message)