Database Adventures (ii) | What good is Redis and mecached?

Source: Internet
Author: User
Tags memcached

Speaking of the caching framework, our most commonly used cache framework is the memcached, Redis two, but there are actually differences between them.

The birth of Memcached

In May 2003, Brad Fitzpatrick released the first version of Memcached, which was created primarily to address LiveJournal Web site access caching issues, and this version of Memcached was written in the Perl language. Then Anatoly Vorobey uses C to rewrite the Memcached. Memcached is now widely used in websites such as YouTube, Reddit and Facebook.

Speaking of the birth of Memcached, the main reason is the bottleneck of relational database in storage performance. Since entering the 21st century, with the popularization of personal computers, the number of netizens in the world has risen sharply, and the amount of website visits has risen.

Because the relational database needs to persist the data, there will be some write-hard io, so there will be bottlenecks in writing the data. In order to solve the problem of slow hard disk IO, Memcached is to store all the data in memory, so as to achieve fast data writing and reading.

It is also because Memcached stores the data in memory and does not implement persistence, so when something unexpected happens, such as a power outage restart, a machine outage, and so on, the Memcached stored data is lost, and we can only read it again from the database and load it into Memcached.

In addition, memcached only supports single Key-value storage, so there is a single type of data stored in it that cannot adapt to diversified business development.

The birth of Redis

It was because of the storage of the above problems that Redis was born in May 2009. The Redis creator saw many problems with memcached, so a Redis cache framework was created.

In the Redis cache framework, it supports up to 6 types of data stores and provides multiple atomic command operations. Redis also supports persisting data to a local file, so that when an accident occurs, it is not necessary to read the data again from the database and read the local file recovery directly.

Which one is good?

From the evolution of the two cache frameworks, we can see that Redis is an upgraded version of Memcached, and memcached has the functionality of Redis, which is basically available.

So most of the time we use Redis as the preferred caching framework, and of course memcached has some better performance than Redis, such as memcached is faster than redis when storing a small amount of key-value data that is completely static.

But as long as the amount of data is slightly larger, or if the data is dynamic, the performance of the memcached will fall straight down.

So even though the memcached has a slight advantage in some respects, the overall redis is better than the Redis cache framework.

Database Adventures (ii) | What good is Redis and mecached?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.