基于linux的3款压力测试工具:Siege,webbench,ab

 基于linux的3款压力测试工具:Siege,webbench,ab

基于linux的3款压力测试工具:Siege,webbench,ab
1.Siege
一款开源的压力测试工具,可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。
获取:
http://www.joedog.org/
官方提供ftp下载

解压:
# tar -zxf siege-latest.tar.gz
进入解压目录:
# cd siege-2.65/
安装:
#./configure ; make
#make install

使用
siege -c 200 -r 10 -f example.url
-c是并发量,-r是重复次数。 url文件就是一个文本,每行都是一个url,它会从里面随机访问的。

example.url内容:

http://www.taoav.com
http://www.tuhaoduo.com
http://www.tiaonv.com

结果说明
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 //每次传输所花最短时间

2.webbench

获取并安装
wget 
http://home.tiscali.cz:8080/~cz210552/distfiles/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make && make install
如果找不到源就网上搜个吧

使用:
webbench -c 500 -t 30 
http://www.taoav.com
参数说明:-c表示并发数,-t表示时间(秒)
4测试结果示例:
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://www.taoav.com
500 clients, running 30 sec.

Speed=3230 pages/min, 11614212 bytes/sec.
Requests: 1615 susceed, 0 failed.

3.ab
apache自带测试工具,在apache2的bin目录里

测试例子: ab -n 10000 -c 100 -t 10 http://www.taoav.com/index.php
参数: -n 表示请求总数, -c 表示并发数. -t 表示请求时间限制

以下为结果
Server Software: Apache/2.0.53
Server Hostname: 
www.taoav.com
Server Port: 80

Document Path: /index.php
Document Length: 17998 bytes

Concurrency Level: 100
Time taken for tests: 660.930623 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 181850000 bytes
HTML transferred: 179980000 bytes
Requests per second: 15.13 [#/sec] (mean)
Time per request: 6609.306 [ms] (mean)
Time per request: 66.093 [ms] (mean, across all concurrent requests)
Transfer rate: 268.69 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 15 117.6 0 1730
Processing: 436 6564 1142.2 6517 15395
Waiting: 340 4164 1512.2 3906 14973
Total: 436 6579 1143.4 6526 15395

Percentage of the requests served within a certain time (ms)
50% 6526
66% 6972
75% 7262
80% 7377
90% 7755
95% 8295
98% 8683
99% 9815
100% 15395 (longest request)


本文来自: (
www.91linux.com) 详细出处参考:http://www.91linux.com/html/article/guanli/20090307/15955.html


========================================
linux下网站压力测试工具webbench

webbench最多可以模拟3万个并发连接去测试网站的负载能力,个人感觉要比Apache自带的ab压力测试工具好,安装使用也特别方便。

1、适用系统:Linux

2、编译安装:
引用
wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make && make install

3、使用:
引用
webbench -c 500 -t 30 http://127.0.0.1/test.jpg
参数说明:-c表示并发数,-t表示时间(秒)

4、测试结果示例:
引用
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://127.0.0.1/test.jpg
500 clients, running 30 sec.

Speed=3230 pages/min, 11614212 bytes/sec.
Requests: 1615 susceed, 0 failed.
========================================
1]介绍
webbench最多可以模拟3万个并发连接去测试网站的负载能力,个人感觉要比Apache自带的ab压力测试工具好,安装使用也特别方便。
适用系统:Linux
[2]下载
[root@localhost src]# wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz ←下载源程序
–15:46:22– http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
=> `webbench-1.5.tar.gz’
Resolving blog.s135.com… 122.200.66.145
Connecting to blog.s135.com|122.200.66.145|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 7,675 (7.5K) [application/octet-stream]
100%[====================================>] 7,675 8.62K/s
15:46:30 (8.62 KB/s) - `webbench-1.5.tar.gz’ saved [7675/7675]
[3]解压、编译和安装
[root@localhost src]# tar zxvf webbench-1.5.tar.gz ←解压源文件
webbench-1.5/
webbench-1.5/webbench.1
webbench-1.5/socket.c
webbench-1.5/webbench.c
webbench-1.5/Makefile
webbench-1.5/debian/
webbench-1.5/debian/rules
webbench-1.5/debian/dirs
webbench-1.5/debian/copyright
webbench-1.5/debian/control
webbench-1.5/debian/changelog
webbench-1.5/COPYRIGHT
webbench-1.5/ChangeLog
[root@localhost src]# cd webbench-1.5
[root@localhost webbench-1.5]# make ←编译程序
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c
webbench.c:77: warning: unused parameter ’signal’
cc -Wall -ggdb -W -O -o webbench webbench.o
ctags *.c
[root@localhost webbench-1.5]# mkdir /usr/local/man ←建立相应目录(否则导致无法正常安装)
[root@localhost webbench-1.5]# make install ←安装程序
install -s webbench /usr/local/bin
install -m 644 webbench.1 /usr/local/man/man1
install -d /usr/local/share/doc/webbench
install -m 644 debian/copyright /usr/local/share/doc/webbench
install -m 644 debian/changelog /usr/local/share/doc/webbench
[4]运行和显示运行结果
[root@localhost html]# webbench -c 100 -t 30 http://192.168.1.235/index.html ←参数说明:
-c表示并发数,-t表示时间(秒)
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://192.168.1.235/index.html
100 clients, running 30 sec.
Speed=16084 pages/min, 152872 bytes/sec. ←运行结果显示
Requests: 8042 susceed, 0 failed.
================================
如果遇到以下错误:
[root@localhost webbench-1.5]# make && make install
cc -Wall -ggdb -W -O   -c -o webbench.o webbench.c
make: cc: Command not found
make: *** [webbench.o] Error 127
表示需要安装 gcc  aptitude install gcc

你可能感兴趣的:(linux,职场,压力测试,休闲)