After testing the code, I run into trouble.
I want to create a server which is available to serve 6000+ client (6300-6500 average with 7000 peak). Now we use an C++ program which is really complicated and its easier to recreate in java.
The problems are:
* The server must maintain a string of each client, and send all the string to the newly connected clients, and remove the string from the table, if one client disconnect must notified all the other client (send a "Logout clientname" string).
The problem is, that the string of one client consume 140bytes. So sending all the information collacted to one client is about 1MB.
The bigger problem is, that just collecting the data to send to the clients, and iterating over 2700 clients consume about 40-45 sec, so its a big task. If one client does not obtain any data from the server after 40sec, it disconnect. So the scenario is the following:
Connects the clients, about 2700 connection begin all client disconnect, and the connections fall about 600 connection. So Im unable to have more than 3000 connection simoultanously. The C++ program on this machine is able to handle 7000 clients.
Here is an graph about it:
So my questions:
* How I implement a thread, that just sends continously the information to the sockets? (does not need to block on select(), it must work on low priority, so sending data when there are cpu cycles available)
* Where implement I the round-robin algoritm to create the SelectorThreads?
Any help would be really appreciate!