Epoll_native non-blocking transport for Linux

若如初见. 提交于 2020-04-07 07:51:38

 Epoll_native non-blocking transport for Linux

As we explained earlier, Netty’s NIO transport is based on the common abstraction for

asynchronous/non-blocking networking provided by Java. Although this ensures that

Netty’s non-blocking API will be usable on any platform, it also entails limitations,

because the JDK has to make compromises(妥协,折中) in order to deliver the same capabilities on all systems.

 The growing importance of Linux as a platform for high-performance networking

has led to the development of a number of advanced features, including epoll, a highly

scalable I/O event-notification feature. This API, available since version 2.5.44 (2002)

of the Linux kernel, provides better performance than the older POSIX select and

poll system calls and is now the defacto(事实上的) standard for non-blocking networking on

Linux. The Linux JDK NIO API uses these epoll calls.

 Netty provides an NIO API for Linux that uses epoll in a way that’s more consistent

with its own design and less costly in the way it uses interrupts.

 Consider utilizing(利用,使用) this version if your applications are intended for Linux; you’ll find that performance under heavy load is superior to that of the JDK’s NIO implementation.

 The semantics of this transport are identical to those shown in figure 4.2, and its

use is straightforward. For an example, refer to listing 4.4. To substitute(代替,替换) epoll for NIO

in that listing, replace NioEventLoopGroup with EpollEventLoopGroup and NioServerSocketChannel.class with EpollServerSocketChannel.class.

http://my.oschina.net/xinxingegeya/blog/640423

=========END=========

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!