Why does Netty use NIO instead of AIO?

NIO VS AIO

In theory, AIO is true asynchronous IO, and the IO throughput is higher than NIO. The concepts of the two IO modes are as follows:

  1. NIO: IO multiplexing model, still blocking IO, and improving throughput by multiplexing IO threads;
  2. AIO: When thread A performs an IO operation, it registers a callback function. When the IO operation is completed, the kernel notifies the application layer, and thread B executes the callback logic;

Why does Netty use NIO instead of AIO?

Reason: On Linux systems, the underlying implementation of AIO still uses EPOLL, which is the same as NIO, so there is no obvious advantage in performance; the underlying implementation of Windows AIO is good, but Netty developers did not consider Windows as the main platform.

We obviously did not consider Windows as a serious platform so far, and that’s why we were neglecting NIO.2 AIO API which was implemented using IOCP on Windows. (On Linux, it wasn’t any faster because it was using the same OS facility - epoll.)

refer to:

  1. https://github.com/netty/netty/issues/2515

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324812840&siteId=291194637