环境:CentOS 6.6
[root@CentOS ~]# yum -y install gcc gcc-c++ make [root@CentOS ~]# tar -zxf openssl-1.0.1c.tar.gz [root@CentOS ~]# cd openssl-1.0.1c [root@CentOS openssl-1.0.1c]# ./config --prefix=/usr/local/openssl && make && make install [root@CentOS openssl-1.0.1c]#
//开启siege的ssl功能
[root@CentOS ~]# tar -zxf siege-3.0.5.tar.gz [root@CentOS ~]# cd siege-3.0.5 [root@CentOS siege-3.0.5]# ./configure --prefix=/usr/local/siege --with-ssl=/usr/local/openssl [root@CentOS siege-3.0.5]# make && make install [root@CentOS ~]# cd /usr/local/siege/ [root@CentOS siege]# mkdir var [root@CentOS siege]# /usr/local/siege/bin/siege -C //查看配置文件
//-c 并发,-t 压测时间,-r 重复次数,-f 选择指定URL的文件
注:发送的请求数=并发数*重复次数
[root@CentOS siege]# echo ‘https://www.baidu.com‘ > usr.txt [root@CentOS siege]# /usr/local/siege/bin/siege -c 10 -r 1 -f usr.txt //把压测的网址写到url.txt里
//发送GET参数:
[root@CentOS siege]# /usr/local/siege/bin/siege -c 10 -r 1 " //
//发送POST参数(并不是所有都支持POST参数):
[root@CentOS siege]# /usr/local/siege/bin/siege -c 10 -t 1m "https://www.baidu.com/ POST"
压测需要验证的网页:
[root@CentOS ~]# /usr/local/siege/bin/siege -c 10 -r 1 "http://home.51cto.com/index.php POST name=username&pass=password"
[root@CentOS siege]# cat /usr/local/siege/var/siege.log
测试结果:
      Date & Time,  Trans,  Elap Time,  Data Trans,  Resp Time,  Trans Rate,  Throughput,  Concurrent,    OKAY,   Failed
2016-01-09 13:30:44,9788702,   50435.03,         186,       0.01,      194.09,        0.00,        2.24, 9788702,    1082
2016-01-10 07:47:01,4236060,   21596.38,          80,       0.01,      196.15,        0.00,        1.87, 4236060,      67
2016-01-10 17:05:01,5636429,   28794.64,         107,       0.01,      195.75,        0.00,        1.78, 5636429,     295
2016-01-11 07:50:02,8531603,   43193.43,         162,       0.01,      197.52,        0.00,        1.22, 8531603,       0
参考文章:http://297020555.blog.51cto.com/1396304/592386
本文出自 “鹏城-酱油瓶” 博客,谢绝转载!
原文:http://yfshare.blog.51cto.com/8611708/1733659