围攻 - 为什么我会收到所有这些回复?
Siege - Why do I get all these responses?
我对 Siege 在幕后所做的事情感到困惑。我时不时地使用 Siege 为我的 Web 服务创建一些流量。今天我注意到 Siege 列出的回复比我预期的要多。
例如我使用 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 并从那里二次请求资源。我迷路了。
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 即可禁用解析器。
我对 Siege 在幕后所做的事情感到困惑。我时不时地使用 Siege 为我的 Web 服务创建一些流量。今天我注意到 Siege 列出的回复比我预期的要多。
例如我使用 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 并从那里二次请求资源。我迷路了。
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 即可禁用解析器。