为什么Netty引入了本地epoll支持?

29

我相信Java的NIO库将在Linux机器上使用epoll。相比于在Linux机器上使用NIO,使用Epoll有哪些优势呢?

2个回答

39

Netty的epoll传输使用epoll边缘触发,而Java的NIO库使用水平触发。除此之外,epoll传输暴露了配置选项,在Java的NIO中不存在,例如TCP_CORK、SO_REUSEPORT等。


"Java的NIO库使用水平触发吗?" 有任何相关参考资料吗? - Amir Fo
1
只需要看看它在JDK中是如何实现的就好了。否则它就不能与“Selector”接口一起使用。 - Norman Maurer

3

关于这方面的信息,可以在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.


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接