In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what I/O modes Netty supports". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "What I/O mode does Netty support"!
1 Classic I/O mode
BIO (blocking I/O)JDK1.4 before NIO (non-blocking I/O)JDK1.4 (2002, java.nio package)AIO (asynchronous I/O) JDK1.7 (2011)
1.2 contrast concept
blocking and non-blocking
Do you want to wait until the data is ready?
blocking
When there is no data coming, reads block until there is data; when the buffer is full, writes block.
non-blocking
returned directly
synchronous and asynchronous
After the data is ready, who completes the data operation?
You need to read it yourself. Is it synchronized?
The data is ready to read directly and then call back to the program is asynchronous
2 Netty support changes for three IO types
Underlined is no longer supported oh!
Why abolish blocking I/0 (BIO/OIO) ?
High number of connections: blocking-> resource consuming, inefficient.
Blocking means waiting, waiting will always occupy the thread, when the connection count is high, most threads are waiting, will exhaust the system thread resources.
Why delete AIO support already done?
Windows implementation matures, but it is rarely used as a server
Linux is commonly used as a server, but its AlO implementation is not mature enough.
AIO under Linux compared to NIO performance improvement is not obvious
Therefore, netty also selectively supports high-performance IO mode in connection with the actual situation.
Why does Netty support multiple implementations?
Common NIO implementation is also epoll under Linux, but Netty still chooses to implement it itself because it is better:
Netty offers more controllable parameters:
JDK's NIO default implementation is horizontal triggering
Netty is edge triggered (default) and horizontal triggered, and switchable
Netty achieves less garbage collection and better performance
Is NIO better than BIO?
BIO code is simple and in certain scenarios: few connections, low concurrency, BIO performance does not lose NIO. Of course, considering that the later stage of business development is a complex scenario, Netty only considers NIO.
At this point, I believe that everyone has a deeper understanding of "what I/O mode Netty supports", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.