NIO VS AIO

理论上,AIO是真正的异步IO,IO吞吐量是要高于NIO的。两种IO模式的概念如下:

  1. NIO:IO复用模型,仍是阻塞IO,通过复用IO线程提升吞吐量;
  2. AIO:线程A执行IO操作时,注册回调函数,当IO操作执行完成后,内核通知应用层,由线程B执行回调逻辑;

为什么Netty使用NIO而不是AIO?

原因:在Linux系统上,AIO的底层实现仍使用EPOLL,与NIO相同,因此在性能上没有明显的优势;Windows的AIO底层实现良好,但是Netty开发人员并没有把Windows作为主要使用平台考虑。

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.)

参考:

  1. https://github.com/netty/netty/issues/2515;
  2. https://github.com/netty/netty/issues/2515
GitHub 加速计划 / li / linux-dash
10
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐