1

I'm trying to figure out the maximum number of concurrent connections that a socket can handle without considering computational resources of RAM and CPUs. of course, I google it and checked SO and found some similar questions, but I'm not satisfied with none of the answers. So, I'll try to be very specific:

Assume the following piece of Java code, which is involved in the context of a multithread http proxy, and where serverSocket is an instance of ServerSocket and ProxyThread extends from Thread:

while (listening) {
  new ProxyThread(serverSocket.accept(),prop).start();
}

Question: How many "accepts" can we handle concurrently? (so, how many incoming connections can be established and processed in parallel?).

I know everything is limited by the resources, but I'm interested in knowing if besides the computational resources there are other limits that do not depend on that. In other words, if there exits a limit that cannot be broken even if adding more CPUs, more RAM etc. Thanks.

ipinyol
  • 336
  • 2
  • 12
  • Have you come across the C10K problem in your googling yet? – Chris K Oct 15 '14 at 10:37
  • Thanks. yes, I've already checked the C10K problem, in particular, this question that I found very useful: http://stackoverflow.com/questions/17593699/tcp-ip-solving-the-c10k-with-the-thread-per-client-approach. I agree with your answer, the limit will be at the number of concurrent threads that the OS can handle. Thanks again. – ipinyol Oct 15 '14 at 10:54

1 Answers1

0

Software/hardware limits always comes down to resource limits. We cannot ignore them, especially when we are discussing scalability.

Java hands threading and networking off to the OS and the OS was designed around resource limits. So really you are asking how many connections and or threads can a OS support. And the answer is, it depends on the OS.

The C10K limit is a well known limit though, in practice I have found systems (depending on application and OS architecture) to max out at the following key points: 100, 1k, 5k and 10k connections. Greater than 10k can be achieved if the OS does not poll inactive connections and we do not create a thread per connection.

Chris K
  • 11,622
  • 1
  • 36
  • 49