Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Comparison between memcached and redis

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Speaking of caching frameworks, our most commonly used caching frameworks are memcached and Redis, but there are actually differences between them.

The birth of Memcached

In May 2003, Brad Fitzpatrick released the first version of Memcached, which was born mainly to solve the problem of caching access to LiveJournal websites. This version of Memcached is written in Perl language.

Anatoly Vorobey then rewrote Memcached in C. Now Memcached has been widely used in YouTube, Reddit, Facebook and other websites.

Talking about the birth of Memcached, it is mainly because of the bottleneck of storage performance of relational database. Because entering the 21st century, with the popularity of personal computers, the number of netizens in the world has risen sharply, and the number of visits to the website has also increased.

Because relational databases need to persist data, there will be some process of writing hard disk IO, so there will be bottlenecks in writing data. In order to solve the problem of slow speed of hard disk IO, Memcached stores all the data in memory, so that it can write and read data quickly.

It is also because Memcached stores the data in memory and does not achieve persistence, so when some unexpected situations occur, such as power outage and restart, machine outage, all the data stored in Memcached will be lost, and we can only re-read it from the database and load it into Memcached.

In addition, Memcached only supports a single key-value storage, so there is a single type of data stored in it, which can not adapt to the diversified business development.

The birth of Redis

It is because of the storage of the above problems that Redis was born in May 2009. The Redis creators saw many problems with Memcached, so they created the Redis caching framework.

In the Redis caching framework, it supports up to six types of data storage and provides multiple atomic command operations. And Redis also supports the persistence of data to local files, so that in the event of an accident, there is no need to read the data from the database again, just read the local file to recover.

Which one is better?

From the development of the two caching frameworks, we can see that Redis is an upgraded version of Memcached, and Memcached has basically all the functions Redis has.

So most of the time we use Redis as the preferred caching framework. Of course, Memcached also has some better performance than Redis. For example, when storing a small amount of completely static key-value data, Memcached is faster than Redis.

But as long as the amount of data is slightly larger, or the data is dynamic, then the performance of Memcached will plummet.

So even though Memcached has a slight advantage in some ways, Redis is generally better than Redis as a caching framework.

These are the details of which is better, memcached or redis. Please pay more attention to other related articles!

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.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report