0
点赞
收藏
分享

微信扫一扫

使用siege进行多进程压力测试

狗啃月亮_Rachel 2022-11-11 阅读 61


wget ftp://ftp.joedog.org/pub/siege/siege-latest.tar.gzcd siege*./configuremakemake installsiege -c 1000 -r 100 -i -b -f url.txt

这其中url.txt中是所有需要测试的连接。 -c 表示并发1000, -r表示执行100次, -i表示乱序, -b表示循环100次之间不停顿,默认是停顿1秒

但是siege自身感觉也是有瓶颈的,并发数最大也就1000,再提高就会报下面这样的错误

[error] socket: unable to connect sock.c:222: Operation already in progress socket: connection timed out

这样最终导致测试结果怎么都没法超过2W每秒的请求,所以就把siege -c 1000 -r 100 -i -b -f url.txt 放到shell中并发执行

for i in {1..10}dosiege -c 1000 -r 100 -i -b -f url.txt &;done


以上是网络上流传的shell 实际没有测试通过



即使如此,也不能并行进行

for i in {1..10}do`siege -c 1000 -r 100 -i -b -f url.txt &`;done


实际稍微该一下,添加几个可调参数,如下


#!/bin/sh


if [ "$1" == "-h" ] || [ "$1" == "--help" ] ;then

echo "shell [process num=3] [url] [request num=300] [time=30s]";

exit 1;

fi



if test $1 ; then

num=$1;

else

num=3;

fi


if test $2 ; then

url=$2;

else

url="http://7k7k.dx.com/info.php";

fi


if test $3 ; then

re=$3;

else

re=300;

fi


if test $4 ; then

time=$4;

else

time="30s";

fi


for ((i=1; i<=$num; i=i+1))

do

#echo $num;

`nohup /usr/local/bin/siege -c $re -t $time -i -b $url > /dev/null &`;

echo $i;

done




​​#Linux​​



举报

相关推荐

0 条评论