如何找到服务器可以处理的最大并发连接数?

发布于 2024-08-23 05:56:39 字数 205 浏览 7 评论 0原文

我想要一个java程序,它可以找到服务器可以处理的最大并发连接数?

您可以假设服务器是 http 服务器。

更明确地说:

有很多开源 NIO 框架。我想为我的项目选择一个。并想测试哪个实现支持最​​大并发连接数。其中一些框架声称它们支持这么多。但我想在选择之前先亲自验证一下。

我的意图是支持尽可能多的并发连接而不丢弃/拒绝客户端?

I want a java program, which can find the maximum number of concurrent connections that a server can handle ?

You can assume that the server is http server.

To be more clear:

There are lots of opensource NIO frameworks. I want to pick one for my project. And want to test which implemenation supports maximum number of concurrent connections. Some of these frameworks claim that they support these many. But I want to get it verified myself before chosing one.

My intentions is to support as many concurrent connections without dropping/rejecting clients?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

手心的海 2024-08-30 05:56:40

使用 Apache JMeter 等工具来执行 服务器负载测试。您需要在多台客户端计算机上运行 JMeter 工具:正如其他人提到的,各种操作系统对连接都有限制。它支持包括并发连接数等选项...

上次使用此工具对网站进行负载测试时,我们有 6 台客户端计算机在一台服务器上运行 JMeter。该死的,这给网络带来了沉重打击!

Use a tool like Apache JMeter to perform load testing of the server. You'll want to run the JMeter tool on multiple client machines: As others have mentioned, various operating systems have limits on connections. It supports options including number of concurrent connections, etc...

Last time used this tool to load test a website, we had 6 client machines running JMeter against the one server. Damn that gave the network a hammering!

伪装你 2024-08-30 05:56:40

我们不久前制作了一个 COMET 服务器,在测试它可以支持的最大连接数时遇到了巨大的麻烦。我们总是发现办公室网络设备在连接数量达到足以使设备崩溃的数量之前就发生了故障。生成请求的机器上的端口数量有限,并且需要一段时间才能清除它们才能重新使用。确实是一个棘手的问题。

We made a COMET server a while back and had enormous trouble testing the maximum number of connections it could support. Invariably we found that office networking equipment failed before we hit anywhere near the number of connections that makes it groan. There's a limited number of ports on a machine generating requests, and they take a while to clear down before they can be reused. A tricky problem indeed.

放飞的风筝 2024-08-30 05:56:40

只需创建套接字,直到收到错误“连接被拒绝”,否则程序将在 new Socket() 中阻塞,或者您收到 HTTP 错误 在 5xx 范围内(通常是 503 服务不可用)。

请注意,您应该只在内部测试时执行此操作,因为这是拒绝服务攻击。

Just create sockets until you get the error "connection refused" or the program will block in new Socket() or you get an HTTP error in the 5xx range (usually 503 Service Unavailable).

Note that you should only do this for internal tests because it's a denial of service attack.

寄居人 2024-08-30 05:56:40

在 apache tomcat 中,最大连接数存储在“context.xml”文件中

In apache tomcat the max connections is stored in "context.xml" file

追我者格杀勿论 2024-08-30 05:56:40

开始建立新的连接;当你拒绝新的人时,你已经达到了某种极限。

但是,无论如何,结果都不会准确

  • 服务器可能对每个 IP 地址进行限制
  • 服务器可以同时处理的连接数可能取决于
  • 您开始连接到服务器时的 服务器负载尽可能快,您可能会受到您自己的连接的限制,
  • 某些服务器会自动规则禁止您(在一次打开太多连接时丢弃所有流量)
  • 此外,您的计算机的网络堆栈可能对传出连接有一些限制(值得注意的是,Win XP 曾经一度有这样的限制)
  • 如果 TCP 连接通过任一侧的任何类型的 NAT,一些更简单的设备(例如 SoHo 类路由器)可能会遇到其内在限制 - 连接 NAT 表中的插槽等.)

此外,您的测试相当于 DoS 攻击,因此始终获得服务器所有者和其他相关方(例如您的 ISP、服务器托管的 ISP 等)的许可,并在开始此类测试之前通知他们。否则,您可能会发现自己成为诉讼的受害方。

Start opening new connections; when you are refused new ones, you have hit some sort of limit.

However, the result will not be accurate by any means:

  • server may have throttling per IP address
  • the number of connections a server can handle at the same time might depend on server load
  • when you start connecting to a server as fast as you can, you may be limited by your own connection
  • some servers have automatic rules to ban you (drop all traffic when is opening too many connections in a shot timespan)
  • also, your computer's networking stack may have some limits on outgoing connections (notably Win XP used to have such a limit at one time)
  • if the TCP connection goes through any sort of NAT on either side, some simpler devices (such as SoHo class routers may run into their intrinsic limits - slots in connection NAT table etc.)

Also, your testing amounts to DoS attack, so ALWAYS get permission from the server owners and other concerned parties (e.g. your ISP, server hosting's ISP etc.) AND notify them before you begin with such tests. Otherwise you may find yourself on the incoming side of a lawsuit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文