The difference between Redis and memcached

Source: Internet
Author: User
Tags memcached

Different points:

(1) Not all data in Redis is only resident in memory (if required, can be persisted to disk periodically), which is the biggest difference compared with memcached (the data in memcached is the resident memory in the form of key-value pairs in the validity period)

(2) Redis not only supports simple key-value pair types of data, but also provides storage of data structures such as List,set,hash; memcached only supports simple key-value pair types, but memcached can cache pictures, videos, etc.

(3) Backup of Redis support data, i.e. data backup in Master-slave mode

(4) Redis support data persistence and data synchronization, you can save in-memory data on disk, restart the system can be loaded for use again, the cache data will not be lost. Memached Cache data is resident memory, after rebooting the system, the data is gone.

(5) Redis can set the validity period through expire, memcached when set data can specify that the data to be cached will never expire

(6) Redis can do a master more from; Memcached can also do a master more from

(7) Redis when the physical memory is exhausted, you can swap some long-unused value to disk; memcached automatically cleans up some of the early data when the physical memory is exhausted

Same point:

(1) Redis and memcached all store data in memory, both in-memory database

(2) Redis and memcached can do a master multi-slave

Performance:

(1) Redis according to its official test results: In 50 concurrent cases request 10w times, write speed is 110,000 times/s, read speed is 81,000 times/s

(2) Redis sets the maximum limit of key name and value to 512mb;memcached the key name is limited to 250 bytes, and the value is limited to less than 1MB, and only applies to ordinary strings.

When to use memcached:

(1) Small static data: When we need to cache small static data can consider memcached, the most representative example is the HTML code fragment, because memcached internal memory management mechanism, although not as complex as redis, but more practical efficiency, This is because memcached consumes less memory resources when it processes metadata. As the only one by one data types supported by memcached, strings are ideal for storing data that only needs to be read, because the string itself does not need to be further processed.

Redis differs from memcached

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.