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 > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
I believe many inexperienced people don't know what to do about how to use JCTools, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
JDK itself provides many synchronization containers, concurrency containers, blocking queues, and so on. Relatively speaking, their performance is already very high, but Netty, as an Excelsior product, strives to achieve the best and highest performance.
JDK's blocking queues are commonly used in producer and consumer scenarios, providing seven blocking queues for developers to use. In Netty, when multiple Channel on the server side need to write data to the client at the same time, because only IO threads can read and write, non-IO threads can only put the requests sent into the corresponding queue of IO threads. This is also the scenario of producers and consumers, and it is the case of multiple producers and single consumers.
Instead of using the blocking queue provided by JDK to implement producers and consumers, Netty uses a MpscUnboundedArrayQueue class.
MPSC-Multi Producer Single Consumer
So who provided the MpscUnboundedArrayQueue class? It is provided by the package JCTools.
JCTools provides high-performance non-blocking concurrent data structures, including MPSC data structures for multiple producers and single consumers.
By adding elements to the Queue, when the number of elements is larger than the container capacity, instead of creating a twice the array, copying the old array elements to the new array elements, but creating an array of the same size, pointing to the new array with an element of the previous array.
The underlying layer of JCTools uses a lot
UNSAFE.putOrderedObject (buffer, offset, e); after reading the above, have you mastered how to use the concurrency tool JCTools? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.