Search code examples
javasocketsniosocket.io

Java NIO in both server and client?


I am new to Java NIO.I have a small doubt. If I use the NIO instead of a socket client, should the server also be using NIO or does it not matter?

I am concerned about application scalability. I am looking at around 500-1000 client requests per seconds per server. Since I would send my data to atleast three different servers, I am ideally looking at around 1500 client requests per second. For this, I already have a socket pool implementation in place which does a fairly decent job.

What I have is a pool of socket connections for each server.Each thread picks up an available socket connection from the pool and sends it to the server

I am trying to find out if NIO can help or is better in any way than a socket client. How about blocking ? Normal client would either block or timeout.


Solution

  • It doesn't matter. The TCP stream will be unaffected by your choice of NIO.