我相信Java的NIO库将在Linux机器上使用epoll。相比于在Linux机器上使用NIO,使用Epoll有哪些优势呢?
Netty的epoll传输使用epoll边缘触发,而Java的NIO库使用水平触发。除此之外,epoll传输暴露了配置选项,在Java的NIO中不存在,例如TCP_CORK、SO_REUSEPORT等。
关于这方面的信息,可以在Netty文档中找到:
Netty provides the following platform specific JNI transports:
Linux (since 4.0.16) MacOS/BSD (since 4.1.11)
These JNI transports add features specific to a particular platform, generate less garbage, and generally improve performance when compared to the NIO based transport.