In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you what the principle of Redis database concurrency is, the content is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. Single-thread model
Each call from the Redis client to the server goes through three processes: sending the command, executing the command, and returning the result. In the command execution phase, because Redis processes commands in a single thread, all commands that arrive at the server will not be executed immediately, and all commands will enter a queue and be executed one by one. And the execution order of commands sent by multiple clients is uncertain. But what is certain is that no two commands will be executed at the same time, and there will be no concurrency problems, which is the basic single-threaded model of Redis.
Second, the reasons for the processing capacity of the single-threaded model at the level of 10,000 per second.
(1) pure memory access. The data is stored in memory, and the response time of memory is about 100 nanoseconds, which is an important basis for terabyte access of Redis per second.
(2) epoll is used as the implementation of the multiplexing technology in non-blocking epoll OGramRedis. In addition, the event handling model of Redis converts connections, reads and writes, and closes into events, so that too much time is wasted on it.
(3) single thread avoids the consumption caused by thread switching and race.
(4) Redis uses single-thread model, if each command takes a lot of time, it will cause other threads to block, which is fatal for high-performance services like Redis, so Redis is a database for high-speed execution.
The above is what is the principle of Redis database concurrency. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are 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.