Java Multithreaded Socket Server freezes after receiving ~ 50 concurrent connections

So, basically the problem is described in the title. The server works as follows:

  • Listens to a new connection.
  • As soon as a connection is requested, it adds the request to Q,
  • Continues listening to the new connection.
  • A separate process takes care of Q and spawns a new thread for processing client requests.

Server code is similar to this tutorial (everything in try / catch, unfortunately, I can’t show the source code - company policy)

This seems to work very well as long as the number of clients does not exceed ~ 50. Then it just freezes without any exceptions / warnings / etc. There is a 32k stream limitation, with no limit on the number of open files / open sockets / etc. OS = CentOS 5.5 (this seems to be happening on ubuntu tho). The server registers data in MySQL using ODBC. Separate stress tests of both showed that I can have up to 32 thousand Java processes (limited to / proc / sys / kernel / threads-max), and MySQL can perform up to 20k simple operations / seconds, so Im assuming the problem connected to sockets.

So the real question is:

  • What is the marginal factor in socket connections and how can I increase it?
  • OR am I looking in the wrong place?
+3
source share
2 answers

, - . , "" , , .

, jdk: jstack . , . jvisualvm, unix- kill -3 pid stderr.

- , , , , . , , , , - jetty , /threading pain, .

+5

, , , java- " -server", Java HotSpot. - JIT "server-class". . VM - -.

,

0

Source: https://habr.com/ru/post/1787427/


All Articles