java - will ServerSocket(port) and multiple threading works well for 5000 simultaneous clients hits? -
I am working with server socket class and open thread when a new client hits the server socket:
serverSocket = new server socket (port); While (true) {socket client socket = serverSocket.accept (); New thread (this). Start (); // many threads opening}} But when 5000 clients come to this server server, there is an error on the client side: java.net .connectException: Connection refused : Connect
Please tell me what is the best way to open serverc that he can accept all customer connections? There is 1 millisecond time interval between client connections simultaneously.
There are two things that you should definitely check.
On the file descriptor limit Linux based system, you can check that using UCLIT.
Secondly, the servers are waiting for queue size, if you have more connections than the queue size, they will be rejected immediately. You should try the Serverket (Port, Backlog) constructor.
Comments
Post a Comment