安装siege

cd /opt
wget http://www.joedog.org/pub/siege/siege-2.72.tar.gz
tar zxvf siege-2.72.tar.gz
cd siege-2.72
./configure --prefix=/usr/local/siege
mkdir -p /usr/local/siege/etc/siegerc
make && make install

编辑urls.txt

cd /usr/local/siege/etc

vim urls.txt #添加一些需要压测的URL

/usr/local/siege/bin/siege -c 100 -r 30 -f urls.txt #进行测试

** SIEGE 2.72
** Preparing 10 concurrent users for battle.
The server is now under siege..      done.

Transactions:		         300 hits  #已完成的事务总署
Availability:		      100.00 %   #完成的成功率
Elapsed time:		        0.08 secs   #总共使用的时间
Data transferred:	        0.94 MB   #响应中数据的总大小
Response time:		        0.00 secs   #显示网络连接的速度
Transaction rate:	     3750.00 trans/sec  #平均每秒完成的事务数
Throughput:		       11.79 MB/sec  #平均每秒传送的数据量
Concurrency:		        8.50  #实际最高并发链接数
Successful transactions:         300  #成功处理的次数
Failed transactions:	           0    #失败处理的次数
Longest transaction:	        0.01   #最长事务处理的时间
Shortest transaction:	        0.00   #最短事务处理时间

siege参数详细说明

-c : 指定并发的用户个数

-r : 指定重复的次数

-d : 指定延迟时间

-f : 指定URL列表

-i : 随机URL,默认从urls.txt列表从上到下来打压

-b : 进行压力测试,不进行延时

-t : 持续时间。即测试持续时间。默认是分钟。例如: -t10S (10秒)  -t5M(5分钟)  -t1H(1小时)