In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about the difference between Redis and Memcache. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Summary 1:
Official definition of memcache
Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Official definition of redis
Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
Copyright is the same
They all use the bsd protocol, and projects that use it can be used for business users, without having to release code that has been modified twice, and can modify the source code.
Data type
Redis is rich in data types and supports set liset and other types.
Memcache supports simple data types and requires clients to handle complex objects themselves.
Persistence
Redis supports persistent storage of data on the ground.
Memcache does not support persistent data storage
Distributed storage
Redis supports master-slave replication mode
Memcache can use consistent hash for distribution
Value of different sizes
Memcache is an in-memory cache. The length of key is less than 250characters, and the length of a single item storage is less than 1m, so it is not suitable for virtual machines.
Data consistency is different.
Redis uses a single-threaded model that ensures that data is submitted sequentially.
Memcache needs to use cas to ensure data consistency. CAS (Check and Set) is a mechanism to ensure concurrency consistency, which belongs to the category of "optimistic lock". The principle is simple: take the version number, operate, compare the version number, operate if consistent, and abandon any operation if inconsistent.
Cpu utilization
Redis single-threaded model can only use one cpu and can start multiple redis processes.
Summary 2:
In 1.Redis, not all data is stored in memory all the time, which is the biggest difference compared with Memcached.
2.Redis not only supports simple KBE data, but also provides storage of data structures such as list,set,hash.
3.Redis supports data backup, that is, data backup in master-slave mode.
4.Redis supports data persistence, which can keep the data in memory on disk and can be loaded and used again when rebooting.
Personally, I think the most essential difference is that Redis has the characteristics of a database in many ways, or it is a database system, while Memcached is just a simple KGrev cache.
Summary 3:
The difference between redis and memecache is that:
1. Storage method:
Memecache stores all the data in memory and will hang up when the power is off. The data cannot exceed the memory size.
Some of the redis is stored on the hard disk, which ensures the persistence of the data.
2. Data support type:
Redis has a lot more data support than memecache.
3. Using the underlying model is different:
The new version of redis directly builds its own VM mechanism, because the general system calls system functions, it will waste a certain amount of time to move and request.
4. Different operating environments:
At present, redis officially only supports LINUX uplink, thus eliminating the support for other systems, so that it can better focus on the optimization of the system environment, although a team at Microsoft later wrote a patch for it. But not on the trunk.
Memcache can only be used as a cache, cache
The content of redis can be landed, that is to say, it is similar to mongodb, and then redis can also be used as a cache, and you can set master-slave.
After reading the above, do you have any further understanding of the difference between Redis and Memcache? If you want to know more knowledge or related content, 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.