围攻 - 为什么我得到所有这些回复?

时间:2017-02-07 12:04:53

标签: load-testing siege

我对Siege在幕后做的事感到困惑。我不时地使用Siege来为我的Web服务创建一些流量。今天我注意到Siege列出了比我预期更多的回复。

E.g。我使用Siege作为

siege -c 1 -t 5s http://www.github.com/index.html

我希望只能看到一个带有'index.html'HTML资源的响应。但相反,我得到

** SIEGE 4.0.2
** Preparing 1 concurrent users for battle.
The server is now under siege...
HTTP/1.1 301     0.22 secs:       0 bytes ==> GET  /index.html
HTTP/1.1 301     0.74 secs:       0 bytes ==> GET  /index.html
HTTP/1.1 200     0.72 secs:   84938 bytes ==> GET  /index.html
HTTP/1.1 200     0.59 secs:   25628 bytes ==> GET  /
HTTP/1.1 200     0.14 secs:   97194 bytes ==> GET  /images/modules/site/org_example_nasa.png?sn
HTTP/1.1 200     0.06 secs:    8182 bytes ==> GET  /images/modules/site/home-ill-platform.png?sn
HTTP/1.1 200     0.06 secs:   10324 bytes ==> GET  /images/modules/site/home-ill-projects.png?sn
HTTP/1.1 200     0.07 secs:   11500 bytes ==> GET  /images/modules/site/home-ill-work.png?sn
HTTP/1.1 200     0.06 secs:    6137 bytes ==> GET  /images/modules/site/home-ill-build.png?sn
HTTP/1.1 200     0.12 secs:  152050 bytes ==> GET  /assets/github-1997dc5b96e7febe96e26200e8d35ecd91516cd11316d8bbff113b04ea81b23b.js
HTTP/1.1 200     0.09 secs:   88940 bytes ==> GET  /assets/frameworks-44ae517d6facdc7480be70913e6d4abb86971b42006cf0f0dd6597b480cc272f.js
HTTP/1.1 200     0.06 secs:    6224 bytes ==> GET  /assets/compat-8e19569aacd39e737a14c8515582825f3c90d1794c0e5539f9b525b8eb8b5a8e.js
HTTP/1.1 200     0.60 secs:    2062 bytes ==> GET  /u/3777891?v=3&s=80
HTTP/1.1 200     0.15 secs:    6504 bytes ==> GET  /u/1739496?v=3&s=200
HTTP/1.1 200     0.06 secs:   12695 bytes ==> GET  /assets/site-a1797477c6773085524735a03e97c502b07acafa1b95efd6cda07775c7bb7105.css
HTTP/1.1 200     0.10 secs:   98986 bytes ==> GET  /assets/github-ac9c637b29122a4699fcd4d205b2d09efa4d4962d369158f7d907123061143f1.css
HTTP/1.1 200     0.08 secs:   21615 bytes ==> GET  /assets/frameworks-a44e0bdd1666101af23963e4027cd7a0a1eea1339e0e7422524f2e7f3900e86b.css

前两个是重定向,然后是预期的HTML。但为什么我会获得所有其他图像,JS和CSS资源?我无法想象Siege实际上会解析HTML,然后从那里请求资源。我迷路了。

1 个答案:

答案 0 :(得分:4)

HTML解析是Siege 4.0.0中添加的一项功能。

您可以编辑Siege配置文件并禁用响应解析。以下是配置文件的摘录:



# Parser
# This directive allows you to turn on the html parser. With this
# feature enabled, siege will harvest resources like style sheets,
# images, javascript, etc. and make additional requests for those 
# items. 
#
# HTML parsing was added to version 4.0.0 It is enabled by default. 
# When the parser is enabled, care must be given to other features. 
# For example, we allow to set accept-encoding to anything you'd like
# but if you want to parse those pages, then you MUST set the encoding
# to a supported one.
# 
# With the default options set, you should be able to enable the parser
# with success.
#
# Use this feature to enable it. (true = on, false = off)
# 
# Example: parser = true
#
parser = true




只需设置 parser = false 即可禁用解析器。