一、http_load
程序非常小,解压后也不到100K
http_load以并行复用的方式运行,用以测试web服务器的吞吐量与负载。但是它不同于大多数压力测试工
具,它可以以一个单一的进程运行,一般不会把客户机搞死。还可以测试HTTPS类的网站请求。
下载安装: wget http://www.acme.com/software/http_load/http_load-14aug2014.tar.gz tar zxvf http_load-14aug2014.tar.gz cd http_load-14aug2014 make && make install 命令格式: http_load [-checksum] [-throttle] [-proxy host:port] [-verbose] [-timeout secs] [-sip sip_file] -parallel N | -rate N [-jitter] -fetches N | -seconds N url_file 使用示例: http_load -parallel 10 -fetches 100 url_file url_file文件内容: http://www.baidu.com/ 结果说明: 100 fetches, 10 max parallel,1.06255e+07 bytes, in 2.48953 seconds #请求数,最大进程数,传输数据总计,运行用时 106255 mean bytes/connection #每个请求/连接传输的数据量 40.1683 fetches/sec, 4.26808e+06 bytes/sec #每秒请求数,每秒传输的数据量 msecs/connect: 0.0879 mean, 0.236 max, 0.028 min #平均响应时间,最大响应时间,最小响应时间 msecs/first-response: 238.966 mean, 350.087 max, 98.128 min # HTTP response codes: code 200 -- 100
要注意是否系统遇到了瓶颈。特殊说明:测试结果中主要的指标是 fetches/sec、msecs/connect 这个选项,即服务器每秒能够响应的查询次数,
用这个指标来衡量性能。似乎比 apache的ab准确率要高一些,也更有说服力一些。Qpt-每秒响应用户数和response time,每连接响应用户时间。
测试的结果主要也是看这两个值。当然仅有这两个指标并不能完成对性能的分析,我们还需要对服务器的
cpu、men进行分析,才能得出结论
二、webbench
webbench是Linux下的一个网站压力测试工具,最多可以模拟3万个并发连接去测试网站的负载能力。
下载安装: wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz tar zxvf webbench-1.5.tar.g cd webbench-1.5 make && make install 命令格式: 使用示例: 结果说明:
三、ab
ab是apache自带的一款功能强大的测试工具
命令格式: 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 at a time -t timelimit Seconds to max. to spend on benchmarking This implies -n 50000 -s timeout Seconds to max. wait for each response Default is 30 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 150 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. -h Display usage information (this message) -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers) -f protocol Specify SSL/TLS protocol (SSL3, TLS1, TLS1.1, TLS1.2 or ALL) 使用示例: ab -c10 n100 http://www.baidu.com 结果说明: Benchmarking www.baidu.com (be patient).....done Server Software: BWS/1.1 Server Hostname: www.baidu.com Server Port: 80 Document Path: / Document Length: 95852 bytes Concurrency Level: 10 Time taken for tests: 1.406 seconds Complete requests: 100 Failed requests: 97 (Connect: 0, Receive: 0, Length: 97, Exceptions: 0) Total transferred: 9674753 bytes HTML transferred: 9572326 bytes Requests per second: 71.13 [#/sec] (mean) Time per request: 140.584 [ms] (mean) Time per request: 14.058 [ms] (mean, across all concurrent requests) Transfer rate: 6720.53 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 24 32 4.6 33 41 Processing: 74 102 20.6 101 248 Waiting: 26 37 15.5 35 182 Total: 99 134 24.0 134 281 Percentage of the requests served within a certain time (ms) 50% 134 66% 143 75% 153 80% 154 90% 155 95% 159 98% 170 99% 281 100% 281 (longest request)
四、Siege
一款开源的压力测试工具,可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。
官方:http://www.joedog.org/
下载安装: wget http://download.joedog.org/siege/siege-latest.tar.gz tar -zxvf siege-latest.tar.gz cd siege-latest ./configure make&&make install 命令格式: 使用示例: siege -c 200 -r 10 -f example.url 结果说明: Lifting the server siege… done. Transactions: 3419263 hits #完成419263次处理 Availability: 100.00 % #100.00 % 成功率 Elapsed time: 5999.69 secs #总共用时 Data transferred: 84273.91 MB #共数据传输84273.91 MB Response time: 0.37 secs #相应用时1.65秒:显示网络连接的速度 Transaction rate: 569.91 trans/sec #均每秒完成 569.91 次处理:表示服务器后 Throughput: 14.05 MB/sec #平均每秒传送数据 Concurrency: 213.42 #实际最高并发数 Successful transactions: 2564081 #成功处理次数 Failed transactions: 11 #失败处理次数 Longest transaction: 29.04 #每次传输所花最长时间 Shortest transaction: 0.00 #每次传输所花最短时间
时间: 2024-10-13 07:38:15