In my server, I have 1000 threads that are listening to 1000 different UDP sockets. When a thread receives a packet it puts the UDP packets on a thread-safe queue. The code is like this.
while(true)
{
......
socket.receive(packet);
packetQueue.add(packet);
.....
}
In a second on average a thread (UDP socket) receives 50 packets that are on average the server receives
1000 * 50 = 50K
UDP packets. The server is working more or less fine.
But now I want to change the design a little now. Now I am planning to use 1 thread that will listen on 1 socket and after receiving those packets that thread will put that packet in the queue like before.
So now on average 50K UDP packets will come to the server on that port.
Will this new architecture be able to handle this load? From Java networking perspective does it make any difference if all the packets are coming to one port or different ports?