Java NIO windows implementation

While working on a project using the NIO.2 AIO functions, I looked at the "old" NIO selector implementation and saw that the windows used the default select function, which does not scale at all on windows due to poor internal implementation. Everyone knows that on windows, IOCP is the only real solution. Of course, the callback model upon completion does not fit into the NIO selector model, but does this really mean that using NIO on windows is basically not a good idea?

For example: New AIO features include an IOCP implementation.

This is especially true when using the latest Netty environment where AIO support has been disabled. So, Netty is not working so fast on Windows, how can it be?

+2
java selector nio netty aio
May 21 '14 at 18:24
source share
3 answers

NIO.2 uses IOCP

In the call tree below, this is demonstrated for file input / output using "Iocp" in several named class names, from Java 7: NIO. 2 files on a test bench .

See also sun.nio.ch.Iocp.java , "An AsynchronousChannelGroup Windows implementation encapsulating an I / O completion port."

NIO does not use IOCP because it only supports โ€œnon-blocking i / oโ€ (selectors), and not โ€œasynchronous i / oโ€ (termination handlers), which were added only with NIO.2.

enter image description here

+1
May 27 '15 at 1:33
source share

I think you are confusing asynchronous operation faster. Of course, NIO buffers are faster than serializing the same data as buffers, but many AIO technologies carry costs and delays that can give synchronous IO an advantage.

Recently there was an article back that had a pretty good benchmarking of various I / O methods and the results were (slightly) surprised. The Netty people probably decided to reconcile with more productive (blocking) IO models.

+2
May 21 '14 at 19:08
source share

The problem with IOCP and Java is that IOCP creates and manages threads. I understand that for IOCP to work in Java, the event system actually needs to go through the Windows IOCP Thread, and then is scheduled for Java ThreadPool to execute. This makes IOCP very expensive to implement in Java compared to C ++ / C #.

AIO was probably removed from Netty because no one wants to donate 450,000 potential transactions just to use AIO against NBIO. The gap between transactions between AIO and NBIO is huge.

0
04 Oct '17 at 15:00
source share



All Articles