Talking about the difference between Redis and memcached

Source: Internet
Author: User
Tags memcached value store

The cache technology says that Redis people will always associate with memcached, and people who know them should know the following.

    • Redis supports Key-value data types compared to memcached, and colleagues support storage of data structures such as list, set, hash, and so on.
    • Redis supports backup of data, that is, Master-slave mode of data backup.
    • Redis supports the persistence of data.
    • Redis supports database features in many ways, so to speak he is a database system, and memcached simply k/v the cache.
    • They are not very significant in terms of performance, and the reading aspect, especially for bulk read performance, memcached dominant. Of course, Redis also has his advantages, such as persistence, support for more data structures.
    • Therefore, Redis should be chosen if there is a need for durable aspects or requirements for data types and processing.
    • If the simple Key/value store should choose Memcached.

The storage mechanism of memcached is slab allocation mechanism.

Simply talk about the mechanism of slab allcation

Her main terms: 1, Page------allocated to slab memory space, the default is 1MB. After assigning to slab, cut into chunk according to the size of slab

2. Chunk------memory space for Cache records

3, Slab Class-----A specific size chunk group

Scenarios used by memcached:

  Usually in the e-commerce system on the left side of the site will be the classification of goods, the middle is a list of product search results, you can view commodity information and business basic information and relevant business reputation information.

  The general practice is :

Multiple queries from the database for the entire station of the product classification--->> recursive form your desired classification tree--->> enter processing data------->> display to the page

  Memcached's approach:

The first time: Determine if there is a memcached cache in the classification if there is no execution SQL query, then put into the memcached, and then display to the interface

The second time: determine if the memcached cache has the classification if there is a direct read memcached cache, and then display to the interface

If you encounter the updated data, find the corresponding key value in memcached to remove it and reinsert it into the memcached cache.

  

  

Talking about the difference between Redis and 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.