每个 url 的测试次数 = (farmer 的数量) X (运行测试)
<farmer>
<name>Joe</name>
<!-- We run the Joe farmer 10 times
Note that we have the "time" option which indicates for how many
seconds a farmer should run. The "time" and "count" elements are
exclusive. -->
<count>5</count>
<!-- Farmer Joe uses this profile -->
<useprofile>Example Profile</useprofile>
</farmer>
<!-- A farm contains a bunch of farmers - each farmer is an independent
worker (i.e. a thread or child process). -->
<farm>
<!-- We call our farm "Bingo" - note that the farm must be called Bingo
in the current implementation. -->
<name>Bingo</name>
<!-- We will start 5 farmers named Joe. We will start 2 farmers every 5
seconds. -->
<usefarmer count="5" startcount="2" startdelay="5">Joe</usefarmer>
</farm>
|
所以每个 URL 的测试次数为 5 X 10 = 50 次,见下面的 hits 字段
[root@dhcp-client examples]# ./analyze-relative /tmp/out
Slowest pages on average (worst 5):
Average times (sec)
connect write read close hits URL
0.0003 0.0004 0.0183 0.0183 50 http://172.17.64.34/cgi-bin/my.cgi
0.0004 0.0004 0.0041 0.0041 50 http://172.17.64.34
0.0002 0.0002 0.0019 0.0020 50 http://172.17.64.39/full-%E5%91%BD%E4%BB%A4%E5%88%97%E8%A1%A8-rhel.txt
Requests: 150 Time: 0.24 Req/Sec: 635.03
[root@dhcp-client examples]#
|
也可以通过 time 属性来控制,但它和 count 属性是互斥的,但在实际测试中发现,即使同时指定
了 <count>50></count> 和 <time>30</time> 也不会报错,而且会被 <time> 所覆盖
|
<farmer>
<name>Joe</name>
<!-- We run the Joe farmer 10 times
Note that we have the "time" option which indicates for how many
seconds a farmer should run. The "time" and "count" elements are
exclusive. -->
<count>5</count>
<time>30</time>
<!-- Farmer Joe uses this profile -->
<useprofile>Example Profile</useprofile>
</farmer>
|
可以看到运行了40秒(虽然上面指定了30秒),但不是指定的 5 x 5 = 25 次,而是 3001 次
[root@dhcp-client examples]# date +%s;/usr/bin/flood ./mail.bob.com.xml > /tmp/out;date +%s
1205227284
1205227324
[root@dhcp-client examples]# ./analyze-relative /tmp/out
Slowest pages on average (worst 5):
Average times (sec)
connect write read close hits URL
0.0004 0.0005 0.0337 0.0338 3001 http://172.17.64.34/cgi-bin/my.cgi
0.0004 0.0004 0.0137 0.0137 3001 http://172.17.64.34
0.0002 0.0002 0.0022 0.0022 3001 http://172.17.64.39/full-%E5%91%BD%E4%BB%A4%E5%88%97%E8%A1%A8-rhel.txt
Requests: 9003 Time: 29.85 Req/Sec: 301.60
[root@dhcp-client examples]#
|
但如果是只有 <time> 时,运行的时间就是准确的。可以看到的确是 30 秒
[root@dhcp-client examples]# date +%s;/usr/bin/flood ./mail.bob.com.xml > /tmp/out;date +%s
1205227775
1205227815
[root@dhcp-client examples]#
|