In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you the content of a case study where redis is faster than mysql. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
Redis put all the data in memory, non-data synchronization is working normally, there is no need to read data from disk, 0 times IO. The memory response time is about 100 nanoseconds, which is an important foundation for the high speed of Redis.
Mysql is persistent storage, stored in disk, retrieval, will involve a certain IO, in order to solve this bottleneck, so there is a cache, such as the most used memcached (referred to as mc).
First of all, users access mc, if they miss, they access mysql, and then, like memory and hard disk, copy data to part of mc. Redis and mc are cached and run in memory, which greatly improves the access speed of web access with high data volume.
However, mc only provides simple data structures, such as string storage, while redis provides a large number of data structures, such as string, list, set, hashset, sorted set and so on, which makes it much more convenient for users. After all, it encapsulates a layer of practical functions and achieves the same effect. Of course, use redis and slowly abandon mc.
Redis is single-threaded. To simplify the implementation of the algorithm, the implementation of concurrent data structures is not only difficult, but also troublesome to test. Second, single threading avoids the consumption of thread switching and locking release locks, which are often performance killers for server-side development. Of course, single threading has its drawbacks, and it's Redis's nightmare: blocking. If you execute one command too long, it will block other commands, which can be fatal for Redis, so Redis is a database for fast execution scenarios.
Redis uses epoll as the implementation of Iamp O multiplexing technology, coupled with Redis's own event handling model to convert epoll's read, write, close and so on into events, without wasting too much time on the network. To achieve the monitoring of multiple FD reads and writes to improve performance.
Mysql is used to persistently store data to the hard disk. It is powerful, but slow.
Redis is used to store frequently used data into the cache with fast reading speed.
Thank you for reading! This is the end of the case study on redis faster than mysql. I hope the above content can be helpful to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
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.