为了比较网站或者服务器的性能少不了压力测试工具。最受欢迎的是ab测试工具。ab测试工具随apache打包发布,所有应用起来十分方便。而webbench用起来更加的简单,参数很少简单易懂.
1. ab
根目录: 在apache的根目录下面。
测试例子: ab -n 10000 -c 100 -t 10 http://www.test.com/
参数: -n 表示请求总数, -c 表示并发数. -t 表示请求时间限制
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
-p postfile File containing 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: 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
-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)
2.webbench
1)安装:
wget http://www.guogoul.com/wp-content/uploads/2008/07/webbench-15tar.gz
tar -xvvzf webbench-1.5.tar.gz
cd webbench-1.5/
make
sudo make install
安装完毕!
2)例子: webbench -t 10 -c 1000 http://home.ucenter/
参数说明: -t 运行时间。 -c并发数。
3)参数:
webbench [option]… URL
-f|–force Don’t wait for reply from server.
-r|–reload Send reload request – Pragma: no-cache.
-t|–time Run benchmark for seconds. Default 30.
-p|–proxy Use proxy server for request.
-c|–clients Run HTTP clients at once. Default one.
-9|–http09 Use HTTP/0.9 style requests.
-1|–http10 Use HTTP/1.0 protocol.
-2|–http11 Use HTTP/1.1 protocol.
–get Use GET request method.
–head Use HEAD request method.
–options Use OPTIONS request method.
–trace Use TRACE request method.
-?|-h|–help This information.
-V|–version Display program version.
4) 结果;
Webbench – Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://home.ucenter/
1000 clients, running 10 sec.
Speed=80502 pages/min, 287123 bytes/sec.
Requests: 13417 susceed, 0 failed.

0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.