Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the high performance of Netty

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what is the high performance of Netty". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the high performance of Netty".

Netty's high-performance way, Netty's IO thread NioEventLoop can concurrently process hundreds of client Channel because it aggregates the multiplexer Selector. Because read and write operations are non-blocking, this can fully improve the running efficiency of IO threads and avoid thread hanging caused by frequent IO blocking. In addition, because Netty adopts asynchronous communication mode, one IO thread can handle N client connections and read and write operations concurrently, which fundamentally solves the traditional synchronous blocking IO-connection-thread model, and the performance, flexible scalability and reliability of the architecture have been greatly improved.

Netty asynchronous non-blocking communication

In the process of IO programming, when multiple client access requests need to be processed at the same time, multithreading or IO multiplexing technology can be used to process them. IO multiplexing technology multiplexes the blocking of multiple IO into the blocking of the same select, so that the system can process multiple client requests at the same time in the case of a single thread. Compared with the traditional multi-thread / multi-process model, the biggest advantage of Istroke O multiplexing is the low system overhead, the system does not need to create new additional processes or threads, and does not need to maintain the operation of these processes and threads, which reduces the maintenance workload of the system and saves system resources.

JDK1.4 provides support for non-blocking IO (NIO). The JDK1.5_update10 version uses epoll instead of traditional select/poll, which greatly improves the performance of NIO communications.

Netty zero copy

The "zero copy" of Netty is mainly reflected in the following three aspects:

1) the receiving and sending ByteBuffer of the Netty uses DIRECTBUFFERS, and the direct memory outside the heap is used for Socket reading and writing, and the second copy of the byte buffer is not needed. If traditional heap memory (HEAPBUFFERS) is used for Socket read and write, JVM copies the heap memory Buffer into direct memory before writing to Socket. Compared with out-of-heap direct memory, the message has one more memory copy of the buffer during the sending process.

2) Netty provides composite Buffer objects, which can aggregate multiple ByteBuffer objects. Users can manipulate the combined Buffer as easily as operating a Buffer, avoiding the traditional way of merging several small Buffer into a large Buffer through memory copy.

Thank you for your reading, the above is the content of "what is the high performance of Netty?" after the study of this article, I believe you have a deeper understanding of what the high performance of Netty is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report