In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you what single thread refers to in redis, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
So why is Redis single-threaded
First of all, we have to understand that Redis is fast! 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 won't be a bottleneck, it makes sense to adopt a single-threaded solution (after all, multithreading can be troublesome! ).
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 child thread (whether it is a child thread or a child process to be studied in depth)
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 the official FAQ describes how multithreading will be supported from 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!
The above is all the content of what single thread refers to in redis. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.