Memcached and Redis comparison and application scenarios

Source: Internet
Author: User
Tags memcached

A summary of the usage scenarios for memcached and Redis, based on the discussions of the great gods and the information I found online:

Compare the two:
  1. Redis provides data persistence, memcached no persistence;
  2. The data structure of Redis is richer than memcached and can accomplish things outside the scene;
  3. memcached single key limit in the 250b,value limit in 1mb;redis K, v are 512MB; Of course, these values can be modified in the source code;
  4. memcached data recovery based on the LRU algorithm, Redis provides a variety of recycling strategies (including LRU), but the expiration logic of the Redis recycling strategy is not dependent on the existence of a key to determine whether or not to expire. However, it is possible to determine whether the expiration is due to the TTL return value;
  5. Memcached uses multi-threading, and Redis uses single-threaded, IO-based multiplexing for high-speed access. So it can be understood that in extreme cases the throughput of memcached is greater than redis. Redis Hgetall Pit Everyone can go online to check.
Conclusion:
  • Normal kv scene: Memcached, Redis all can.
  • From the point of view of the single function module, recommend memcached, only do the cache one thing.
  • In the case of a large kv length, a complex data structure (such as a piece of data that takes a value), and the need for persistence, Redis is more appropriate: But when using Redis, blocking a single request can cause a backlog of subsequent requests, which requires attention
Code base
  • Memcached:
    Https://github.com/memcached/memcached/blob/master
  • Redis Code Library:
    Https://github.com/antirez/redis

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Memcached and Redis comparison and application scenarios

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.