#/bin/bash
LANG=C
#webbench最多可以模拟3万个并发连接去测试网站的负载能力。
yum -y install ctags
mkdir -p /usr/local/man/man1
wget http://blog.zyan.cc/soft/linux/webbench/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz -C /usr/src/ ; cd /usr/src/webbench-1.5/
make && make install 2>> /usr/src/webbench.error
# 测试:
# webbench -c 10000 -t 10 http://192.168.0.50/ //注:URL结尾须家“/”
# 参数说明:-c表示并发数,-t表示时间(秒)
for Time in `seq 2000 500 30000`
do
speed=`webbench -c $Time -t 10 http://192.168.0.106/ 2> /dev/null | grep Speed | awk '{print $1}' | awk -F= '{print $2}'`
echo -e "$Time\t\t$speed" >> /tmp/webbench.txt
cat /tmp/webbench.txt
done
转载于:https://blog.51cto.com/8824130/1565642