Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java NIO windows implementation

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

For instance: The new AIO features include an IOCP implementation.

This is especially true while using the latest Netty framework where support for AIO has been dropped. So Netty is not as fast on Windows as it could be ?

like image 566
Kr0e Avatar asked Mar 20 '23 13:03

Kr0e


1 Answers

NIO.2 uses IOCP

The call tree below demonstrates this for file i/o by featuring "Iocp" in several of the called class names, is from Java 7: NIO.2 File Channels on the test bench.

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

NIO does not make use of IOCP, as it only supports "non-blocking i/o" (selectors), not "asynchronous i/o" (completion handlers) that was only added with NIO.2.

enter image description here

like image 88
Evgeniy Berezovsky Avatar answered Mar 27 '23 11:03

Evgeniy Berezovsky