chenshuo / muduo

Event-driven network library for multi-threaded Linux server in C++11
https://github.com/chenshuo/muduo
Other
14.7k stars 5.15k forks source link

httpserver_test logged error message when pressure test #457

Open MakingL opened 4 years ago

MakingL commented 4 years ago

httpserver_test 压力测试过程中出现 ERROR 报错

我在 ARM 64bits 主机上编译了 muduo,并运行 bin 目录下的 httpserver_test,用压力测试工具 webbench (来自 https://github.com/linyacool/WebBench ),进行压力测试。在 webbench 测试结束时,httpserver_test 有 ERROR 日志输出。

为了方便测试,我注释掉了 muduo/net/http/tests/HttpServer_test.cc 第 18 行的 cout 输出语句。

image

httpserver_test 启动命令

image

webbench 启动命令

image

webbench 压测结束时 httpserver_test 的报错

image

image

Linux distro and version? x86 or ARM? 32-bit or 64-bit?

image3

image

Branch (cpp98/cpp11/cpp17) and version of muduo?

image

Version of cmake, gcc and boost? (If not from distro.)

image

chenshuo commented 4 years ago

我觉得这可能是你用的 webbench 的问题,这些 ERROR 消息说明 server 想发数据发不出去。 按照 HTTP 协议,应该是 server 发完 response 数据之后主动关闭连接,但是你用的 webbench 却在发完 request 之后立即自己把连接 shutdown 了。 https://github.com/linyacool/WebBench/blob/master/webbench.c#L540

你可以换别的常用测试工具再试一下,例如 ab。

MakingL commented 4 years ago

好的,谢谢。我换了 ab 来压测,是正常的。