开发者

How do I find maximum number of concurrent connections that a server can handle?

开发者 https://www.devze.com 2022-12-21 14:11 出处:网络
I want a java program, which can find the maximum number of concurrent connections that a server can handle ?

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

You can assume that the serve开发者_JAVA百科r 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?


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!


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.


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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号