http_load
官方网站http://www.acme.com/software/http_load/
一、安装
$ wget http://acme.com/software/http_load/http_load-12mar2006.tar.gz
$ tar zxvf http_load-12mar2006.tar.gz
$ cd http_load-12mar2006/51Testing软件测试网6w p'IU.z8]-cV_*?
$ make51Testing软件测试网%K"df0J)KH1ulk
$ sudo make install51Testing软件测试网3l+N
O*^-Vp(]?n,W~
安装到/usr/local/bin51Testing软件测试网9M~1wx)B4p@|L:OR
可以通过man http_load查看使用说明(前提将http_load.1文件拷贝到man得查找路径中)51Testing软件测试网S:w-M1|?
hJS@&H01错误信息:byte count wrong51Testing软件测试网UtR0r5D s
http_load在处理时会去关注每次访问同一个URL返回结果(即字节数)是否一致,若不一致就会抛出byte count wrong
E| A R2~+j;WU]0所以动态页面可以忽略这个错误信息。
/}5t%c6}O&m0或者可以对代码做修改http_load.c
/a
r"WJ1QU2W}0【原来的】
“stderr, "%s: byte count wrong\n", urls[url_num].url_str );”
【修改的】
“stderr, "%s: byte count wrong: first=%ld,cur=%ld\n", urls[url_num].url_str,urls[url_num].bytes,connections[cnum].bytes );”51Testing软件测试网(rM5qM
c,M8m5x
51Testing软件测试网Wn k1G8r7]
2报错:too many open files
系统限制的open files太小,ulimit -n 修改open files值即可;
n zd+`[f;f/o0
51Testing软件测试网 ?@3||B5Y
3无法发送大请求 (请求长度>600个字符)
默认接受请求的buf大小 http_load.c
912 static void
913 handle_connect( int cnum, struct timeval* nowP, int double_check )
914 {
915 int url_num;
916 char buf[600]; //根据需要修改,如:char buf[4096]
917 int bytes, r;
W4lzD
^&o0
3G3rFr,VP8uT04Cannot assign requested address
客户端频繁的连服务器,由于每次连接都在很短的时间内结束,导致很多的TIME_WAIT,以至于用光了可用的端口号,所以新的连接没办法绑定端口,所以要改客户端机器的配置,
在sysctl.conf里加:
net.ipv4.tcp_tw_reuse = 1 表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;
net.ipv4.tcp_timestamps=1 开启对于TCP时间戳的支持,若该项设置为0,则下面一项设置不起作用
net.ipv4.tcp_tw_recycle=1 表示开启TCP连接中TIME-WAIT sockets的快速回收51Testing软件测试网+D.{9csec
51Testing软件测试网
K*o
p~"C%e){
Ewu!S
使用方式:
6i!\7l8NA
Q%i(W|M0http_load -parallel 100 -fetches 1000051Testing软件测试网[(J6j&QJ.N$zz~K
#100个并发执行10000次51Testing软件测试网I-f_8qk2S[n
http_load -parallel 100 -seconds 360051Testing软件测试网@,h*nz#BQ^v
#100个并发执行1小时
d
LP3O$~}+S:@0http_load -rate 100 -fetches 10000
,_ Hss0O
Nh-v0#每秒100个请求频率,请求10000次
8uA coK5W0http_load -rate 100 -seconds 3600
/LB$hK5\2vn(F0#每秒100个请求频率执行1小时
xph'Zm:_+v0
51Testing软件测试网,V|Tx/e^0Wf$a
测试报告51Testing软件测试网 VM-qt;X5ihQ
209 fetches, 10 max parallel, 6.9004e+06 bytes, in 30 seconds51Testing软件测试网5IV&[)L+OH6e
33016.3 mean bytes/connection
e*FLL#y+_06.96667 fetches/sec, 230013 bytes/sec51Testing软件测试网5aePy
s&i5x6_
msecs/connect: 31.8767 mean, 34.121 max, 31.304 min
KJ,mmunb w| LD0msecs/first-response: 274.644 mean, 3228.69 max, 127.399 min51Testing软件测试网)s,Pzyxd.[0U6rv~ P
208 bad byte counts
2`4xzky9f0HTTP response codes:51Testing软件测试网.K1K8t K8iRD
code 200 -- 209
;w1s6X]Y
U4BjC8@b`I0