In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What is a single thread in redis? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
According to the official FAQ, because Redis is a memory-based operation, CPU is not the bottleneck of Redis, and the bottleneck of Redis is most likely to be the size of machine memory or network bandwidth. Since single-threading is easy to implement and CPU will not be a bottleneck, it makes sense to adopt a single-threaded solution.
When you see this, you may cry angrily! I thought there would be any major technical points that made it possible for Redis to use a single thread so quickly, but it was an official answer that seemed to fool us! However, we can clearly explain why Redis is so fast, and because it is so fast in single-threaded mode, there is no need to use multithreading!
However, we cannot achieve multicore CPU performance by using single-threading, but we can improve it by opening multiple Redis instances on a single machine!
Warning 1: here we have been emphasizing the single thread, but there is only one thread to handle our network requests, a formal Redis Server runtime must be more than one thread, here we need to pay attention to! For example, when Redis is persisted, it will be executed as a child process or sub-thread (whether it is a child thread or a child process for readers to study in depth); for example, I look at the Redis process on the test suit weapon, and then find the thread under the process:
The "- T" parameter of the ps command indicates that the display thread (Show threads, possibly with SPID column.) the "SID" column represents the thread ID, while the "CMD" column shows the thread name.
Warning 2: the last paragraph in FAQ in the figure above describes how multithreading will be supported since Redis version 4.0, but only on some operations! So whether this article is still a single-threaded way in a later version needs to be verified by the reader!
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.