Apache Utility“ab”,这些额外的请求是什么?

时间:2014-02-13 23:23:30

标签: node.js apache http wireshark apachebench

我目前正在测试服务器上的node.js,并且正在使用Apache的“ab”实用程序执行一些非常基本的基准测试,它给了我一些让我抓狂的结果。

所以,只是设置和“控制”的真正快速背景。

- 我在服务器上设置了node.js,当你点击地址时,它只用一行响应

"<html><body>hello</body></html>"

- 正确设置了resopnse的标题,以便浏览器知道返回的数据类型

"Content-Type": "text/html"


当我从网络浏览器请求时,一切都很好。我使用Wireshark在我的浏览器和服务器之间来回查看它看起来很正常:

Source           Destination      Protocol      Info

10.1.10.51     | xxx.xx.xxx.xx  | TCP         | 50281 > http [SYN] 
10.1.10.51     | xxx.xx.xxx.xx  | HTTP        | GET / HTTP/1.1 
xxx.xx.xxx.xx  | 10.1.10.51     | TCP         | http > 50281 [SYN ACK]
10.1.10.51     | xxx.xx.xxx.xx  | TCP         | 50281 > http [ACK]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP         | [TCP segment of a reassembled PDU]
10.1.10.51     | xxx.xx.xxx.xx  | TCP         | 50278 > http [ACK]
xxx.xx.xxx.xx  | 10.1.10.51     | HTTP        | HTTP/1.1 200 OK  (text/html)

当我使用Apache的“ab”测试完全相同的东西时,问题就出现了,这是我运行的命令:

sudo ab -n 1 http://xxx.xx.xxx.xx/

现在,“ab”退出正常并提供我期望的报告,但是当我实际查看node.js服务器上的流量并通过Wireshark我看到一些流量时我不能完全正确

如您所见,我只指定 1 请求。然而,当我在Wireshark查看数据包时,我看到的不仅仅是一个请求。

Source           Destination      Protocol       Info

10.1.10.51     | xxx.xx.xxx.xx  | TCP          | 50314 > http [SYN] 
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [SYN ACK]
10.1.10.51     | xxx.xx.xxx.xx  | TCP          | 50314 > http [ACK]
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP...
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP...
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [ACK] 
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP...
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [ACK]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [ACK]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [ACK]
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP...
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP/1.0 GET / HTTP...
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [ACK]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | [TCP segment of a reassembled PDU]
10.1.10.51     | xxx.xx.xxx.xx  | HTTP         | GET / HTTP/1.0 
xxx.xx.xxx.xx  | 10.1.10.51     | HTTP         | HTTP/1.1 200 OK  (text/html)
10.1.10.51     | xxx.xx.xxx.xx  | TCP          | 50314 > http [ACK]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [RST]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [RST]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [RST]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [RST]
xxx.xx.xxx.xx  | 10.1.10.51     | TCP          | http > 50314 [RST]

我认为“ab”会在其分析过程中发出额外请求,但它也会导致node.js响应每个“GET”。

如果这是“ab”的“预期”行为,我觉得这不是一个问题,但我想知道,而不是假设。

当我将 1 请求指定为“ab”时,我希望 1 请求,但我可能会遗漏一些有关此实用程序如何工作的内容。

欢迎任何关于手册相应部分的想法或链接

感谢。

0 个答案:

没有答案