Netty简介

1.Netty是什么?

  Netty是高性能、异步事件驱动的非阻塞(NIO)Reactor模式的socket通信框架,采用异步非阻塞方式工作。

2.为什么要使用Netty?

原生:开发复杂,API繁琐;java NIO有epoll bug,可能会导致Selector空轮询,CPU达到100%;可靠性不足

netty:安全、成熟、可靠稳定、开发效率高、并发高、API简单、功能强大,实践证明。同时修复了java NIO的epoll bug(Selector空轮询一定的次数后,重新创建一个新的Selector,将原来Selector上注册的Channel等全部拷贝到新建的Selector上,然后释放原来的Selector)

3.Netty为什么不采用AIO?

参考:https://github.com/netty/netty/issues/2515

Not faster than NIO (epoll) on unix systems (which is true)

unix下的epoll操作采用AIO不一定比采用NIO快。

There is no daragram suppport

Unnecessary threading model (too much abstraction without usage)

太多无用的线程模型

你可能感兴趣的:(Netty简介)