如何调试 TCP 连接被拒绝?
我有一个简单的 webapp 基准测试设置:
LoadGenerator ->阿帕奇-> WebApp
当我与几千个测试用户一起运行基准测试时......一切都按预期进行。
然而,当我将测试用户数量增加到大约 14k 时...我的 Apache 服务器开始拒绝与我的 LoadGenerator 的某些连接。 CPU 利用率远未接近容量...而且从 Apache 到我的 WebApp 的连接似乎没有任何中断。
我相信我的 Apache 服务器上的某些资源即将耗尽,但我不知道是什么?我认为这可能是端口......但我相信我的连接不够高。
接下来我尝试查看 tcpdump 信息...但我真的没有看到任何有趣的东西。老实说,我只是在 Wireshark 中打开转储并寻找大红色标记。
有没有办法让内核输出错误消息,希望我能看到一些东西来告诉我发生了什么。在完美的世界中,我会看到一条错误消息,例如“错误:连接数没有足够的 X”。
您可能会推荐其他任何提示来了解为什么我的 LoadGenerator 总是遇到连接被拒绝的情况?
I have a simple(ish) webapp benchmark setup:
LoadGenerator -> Apache -> WebApp
When I run my benchmarks with a few thousand test users...evertything works as expected.
However, when I increase the number of test users to around 14k...my Apache server starts to refuse some connections to my LoadGenerator. CPU utilization is nowhere near capacity...and there doesnt seem to be any dropped connections from Apache to my WebApp.
I believe I am running out of some resource on my Apache server, but I cant tell what? I thought it could be ports...but my connections arent quite high enough for that I believe.
Next I tried looking at tcpdump info...but I really didnt see anyhting interesting. Though honestly, I just opened up the dump in Wireshark and looked for big red marks.
Is there a way to to have the kernel output error messages in the hopse that I might see something that tells me whats happening. In a perfect world, I would see an error message like "ERROR: not enough X for number of connections".
Any other tips you might recommend to see why my LoadGenerator keeps hitting connction refused?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以启用 mod_status 模块并查看使用了多少工作人员等。
You could enable the mod_status module and see how many workers are used etc.
Google 'TIME_WAIT' - 您可能用完了可用的套接字。
Google 'TIME_WAIT' - you are probably running out of available sockets.
如果您认为资源不足,请尝试
这将显示您的进程的资源限制。
输出如下所示
,您检查打开的文件。其中描述了Linux允许打开的fd(包括套接字、管道、文件...)的限制。
您可以通过 ulimit -n 更改此设置,
确保您有同样的问题。否则这没有用。
ulimit 参考: http://ss64.com/bash/ulimit.html
If you are thinking out of resource then please try
This will show resource limit of your process.
The output is something like below
here you check open files. Which describe limit of fd(including socket, pipe, file, ...) allow to open by linux.
You can change this by ulimit -n
Make sure you have same problem. Otherwise this is not useful.
ulimit ref: http://ss64.com/bash/ulimit.html