`
liuhui998
  • 浏览: 100951 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

java nio epoll mina

阅读更多
http://blogs.sun.com/alanb/entry/epoll

To poll or epoll: that is the question: One of the updates in build 59 of Mustang (JavaTM SE 6) is that the New I/O Selector implementation will use the epoll event notification facility when running on the Linux 2.6 kernel. The epoll event mechanism is much more scalable than the traditional poll when there are thousands of file descriptors in the interest set. The work done by poll depends on the size of the interest set whereas with epoll (like Solaris /dev/poll) the registration of interest is separated from the retrieval of the events. A lot has been written on the topic. The C10K problem has been documenting I/O frameworks and strategies for several years. One relatively recent paper on Comparing and Evaluating epoll, select, and poll Event Mechanisms makes it clear the workloads where epoll performs a lot better than poll.

This isn't the first NIO Selector implementation to use epoll. The Blackdown folks added epoll support in their 1.4.x release. On Solaris, the /dev/poll based Selector has been default on Solaris 8 (and newer) since the original implementation of New I/O in J2SETM 1.4.

So if you are running on a Linux 2.6 system with an application that handles lots of simultaneous connections you might want to give b59 a test-run. The weekly builds have been appearing like clockwork on the binary snapshot release site so b59 should be available tomorrow (November 4). Will you see a difference? It depends on the workload. If you've registered lots of SelectableChannels with a Selector and you notice a lot of time spent in the kernel due to poll then you should see a difference. If you are doing test runs and you want to do a direct comparison with poll then you can set the java.nio.channels.spi.SelectorProvider system property to sun.nio.ch.PollSelectorProvider. This will select the poll-based Selector that will continue to be the default on 2.4 kernels. There is an epoll patch for 2.4 kernels but at this time anyway, the NIO implementation doesn't attempt to detect this.
分享到:
评论

相关推荐

    springboot整合mina

    这里可以设置端口号、传输类型(如NIO或EPOLL)、线程模型等参数。 ```java @Configuration public class MinaServerConfig { @Value("${mina.server.port}") private int port; @Bean public ...

    Mina长连接(Android客户端-Java服务器)简单应用

    6. **性能优化**:Mina提供多种优化策略,如NIO(非阻塞I/O)、EPOLL(Linux下的高效I/O模型)等,可以根据实际需求选择合适的模型。此外,还可以通过线程池管理和缓冲区管理进一步提高性能。 7. **安全考虑**:在...

    Mina in Action preview

    1. **Mina架构**:理解Mina的核心架构,包括I/O多路复用模型(如NIO和Epoll)以及事件驱动的设计,这些设计使得Mina能够处理大量并发连接。 2. **Filter Chain**:Mina的过滤器链机制是其核心特性之一,它允许...

    ApacheMina典型例子分析参考.pdf

    Mina采用Java NIO的Reactor实现,模拟Proactor模式。在某些系统中,如Windows,Proactor可以直接利用原生的异步I/O机制,如IO Completion Ports(IOCP),但在其他不支持原生异步I/O的系统上,可以通过Reactor模拟...

    NIO trick and trap .pdf

    **NIO**(New I/O)是Java为提高I/O操作效率而引入的新特性,最初在JDK 1.4版本中作为JSR 51规范的一部分被提出。随着技术的发展,在JDK 7中进一步扩展为NIO 2(JSR 203),引入了更多高级功能,如文件锁定、原子...

    mina服务器实例

    1. **事件驱动模型**:Mina采用I/O多路复用技术,如NIO(非阻塞I/O)和EPOLL,通过事件驱动模型处理网络连接,有效提升了并发处理能力。 2. **过滤器链**:Mina的过滤器链是其核心设计之一,它允许开发者插入自定义...

    learn-mina-the-hard-way

    Java NIO java NIO 和阻塞I/O的区别及各自的优缺点? 参见资料,, I/O通信模型(5种) java NIO服务端和客户端代码实现 没有说明NIO背后的原理是React器模式. 另外java_mzd的评论值得注意: 文章不错,理解不够! 小路...

    Netty面试题 +Netty综合面试题整合

    - **NIO 和 EPOLL**:Netty 支持基于 Java NIO 和 Linux EPOLL(用于提高性能)的两种选择。 3. **Netty 的零拷贝**: - **FileRegion** 和 **DirectBuffer**:通过减少数据在用户空间和内核空间之间的复制,提高...

    mina-2.0.0-RC1.zip

    它支持多种I/O模型,包括NIO(非阻塞I/O)和BIO(阻塞I/O),以及未来的I/O模型,如EPOLL和KQueue。这使得MINA在不同操作系统环境下都能保持高性能。 mina-2.0.0-RC1.zip是Apache MINA的一个版本发布,其中包含了...

    Java Netty-入门教程.pdf

    - 避免了 epoll 空轮询导致的 CPU 资源浪费问题。 - 对 Java 标准库中的 API 进行了增强和优化,提高了使用的便利性和效率。 - **相比于其他网络应用框架**: - 相较于 Mina,Netty 的迭代更加迅速,API 设计更为...

    Netty5.0架构剖析和源码解读

    随着JDK的发展,Java也在逐步引入异步I/O的支持,比如从JDK 1.4开始引入的NIO,再到JDK 7中加入的NIO.2,这些新特性极大地改善了Java网络编程的能力。 1. **NIO**:提供了Buffer、Channel等API,支持非阻塞I/O操作...

    libevent在MFC上的实现(工具:LibeventServer.exe)

    包括C&C++, C#, JAVA, GOLANG, ERLANG等居于IOCP, SELECT, POLL, EPOLL, KQUEUE, BIO, NIO, AIO, 并发语言等实现的同步或异步, 阻塞或非阻塞通信模型, 如:libevent, libev, libuv, netty, mina, ACE, boost等...

    livevent在MFC上的实现

    包括C&C++, C#, JAVA, GOLANG, ERLANG等居于IOCP, SELECT, POLL, EPOLL, KQUEUE, BIO, NIO, AIO, 并发语言等实现的同步或异步, 阻塞或非阻塞通信模型, 如:libevent, libev, libuv, netty, mina, ACE, boost等...

Global site tag (gtag.js) - Google Analytics