4

Strangely, i was unable to find in Google clear answer to NIO.2 async IO performance vs using NIO's multiplexed IO via java.nio.channels.Selector.

So, my question is: Does NIO.2 AsynchronousChannel have better performance than NIO Selector? Of course, i'm interested in server side of things under different load profiles - number of simultaneous connections/average connection lifetime/traffic.

The only information i was able to find is that Windows IOCP is slightly better than Windows select.

Sergey Alaev
  • 3,851
  • 2
  • 20
  • 35
  • Or you could just use thread-based I/O... It performs well, and more often than not better than async I/O. – fge Dec 18 '14 at 07:36
  • Both are for different purpose. Having said that with selector you can effectively reduce CPU and memory hogging because you are on single thread. This also helps in debugging. More threads = more pain – Dexter Dec 26 '14 at 08:05

1 Answers1

5

I don't think NIO.2 will have better performance than NIO, because NIO.2 still make use of select/poll system calls and thread pools to simulate asynchronous IO. One example is that Netty removed NIO.2 support in 4.0.0, because the author think that NIO.2 doesn't bring better performance than NIO in Linux platform.

Warren Zhou
  • 284
  • 3
  • 5
  • Link you provided is really helpful. People mentioned there that since Windows7 selector performance is not that bad – Sergey Alaev Jan 04 '16 at 10:49
  • Yes, because IOCP in Windows enables asynchronous IO operation, although it is also implemented by threads pool, but the implementation is in the Kernel level, so it achieves some performance enhancement. – Warren Zhou Jan 04 '16 at 15:37