Middleware (1) distributed cache and middleware Cache

Source: Internet
Author: User
Tags website performance

Middleware (1) distributed cache and middleware Cache

Cache is generally used to improve website performance. cached data sources include databases and external interfaces. cache is generally divided into two types: local cache and distributed cache, here we mainly summarize the distributed cache.

Memcached vs Redis

The most commonly used distributed cache is Redis and Memcached, which are one of the most common distributed cache technologies. Most developers may have heard of or come into contact with it, however, few seriously analyze the differences between them and their application scenarios.

Memcached is a comparison between Memcached and Memcached from the following aspects.

Network I/O model

Memcached is multi-thread processing.

Redis is processed in a single thread.

 

Memory Management Mechanism

Memcached uses a pre-allocated memory pool.

Redis is the way to apply for memory on site.

 

Supported Data Types

Memcached only supports key/value.

In addition to key/value, Redis also supports list, set, sorted Set, and Hash. Redis supports more data types.

 

Persistence

Memcached does not support persistence.

Redis supports persistence. There are two persistence policies: Based on RDB snapshots and AOF logs.

 

Cluster

Both Memcached and Redis support cluster deployment.

 

Performance

Because Memcached uses multiple threads, its overall performance is superior to that of Redis.

 

Application scenarios

Through the comparison above, we can basically determine their application scenarios:

1. Both Memcached and Redis can be used as one of the distributed cache implementation technologies.

2. If you want to support more data types except key/value, select Redis.

3. To support data persistence, select Redis.

4. If you have high requirements on Cache performance, consider 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.