Analysis and comparison of MEMCACHED,REDIS,MONGODB (data cache system) scheme

Source: Internet
Author: User
Tags comparison hash memcached mongodb redis redis cluster

First, the question

The amount of data per query is enormous and requires the server to respond to user requests more quickly.

Second, the solution

1. Cache database data via the high-speed server cache

2. In-Memory database

Third, mainstream cache and database comparison

Common relational database MySQL

In-Memory database Redis

NoSQL Database MongoDB

Memory Cache memcached

MongoDB, as a non-relational database more suitable for large-scale data query, is not suitable for a single cache service, the common relational database can not meet the big Data volume query still maintain efficient query speed, so redis,memcached is a more suitable solution.

Iv. Memcached

A high-performance distributed memory object caching system, user Dynamic Web applications reduce database load. Increase the speed of website access by caching data and objects in memory to reduce the number of database accesses.

Memcached's distribution is not implemented on the server side, but in the client application, which is the node that uses the built-in algorithm to make the target data.

V. Redis

Redis is a key-value storage database, similar to memcached and supported by more types

As a high-performance Key-value database, Redis has the following characteristics: Multiple data Model persistence master-slave Redis supports rich data types, the most commonly used data types are five types: String, Hash, List, set, and sorted set. Redis typically stores data in memory or is configured to use virtual memory. One of the most important features of Redis is that it can implement persistent data, which can be persisted in two ways: using an Rdb snapshot to keep the in-memory data written to disk, or logging each update with a aof log method like MySQL. The former performance is high, but may cause some degree of data loss; the latter is the opposite. Redis supports synchronizing data to multiple slave databases, a feature that is useful for improving read performance. 3.0 later versions: compared to memcached can only implement distributed storage with clients, Redis builds distributed storage on the server side. Redis cluster is an advanced version of Redis that implements distributed and allows single points of failure, has no central node, has a consistent status of nodes, and features linear scalability. As shown in the figure, a distributed storage architecture for Redis cluster, in which nodes communicate with the nodes through a binary protocol, and between the nodes and the client through the ASCII protocol. On the data placement strategy, Redis cluster divides the value field of the entire key into 16,384 hash slots, one or more hash slots can be stored on each node, which means that the maximum number of nodes currently supported by Redis cluster is 16384
Vi. conclusion It should be said that memcached and Redis can be very good to solve our problems, they are very high performance, in general, Redis can be understood as the expansion of memcached, is a more heavyweight implementation, providing more powerful features. Specifically:
1. Performance:       performance is excellent, specific to the details, because Redis only uses single core, and memcached can use multi-core, so on average every core redis in the storage of small data more than memcached performance. In more than 100k of data, Memcached performance is higher than Redis, although Redis has recently been optimized for the performance of storing big data, but it is slightly inferior to  memcached. 2. Memory space and data size:      memcached can modify the maximum memory, using the LRU algorithm. Redis adds features to the VM, breaking the limits of physical memory. 3. Easy to operate:      MEMCACHED data structure is single, only used to cache data, and Redis supports richer data types, can also be directly on the server side of the data rich operation, which can reduce network IO times and data volume. 4. Reliability:      memcached does not support data persistence, the data disappears after power off or restart, but its stability is guaranteed. Redis supports data persistence and data recovery, allowing single points of failure, but also at the cost of performance. 5. Application scenario:      memcached: Reduce database load in dynamic system, improve performance, cache, suitable for reading and writing, large data volume (such as Renren query user information, friend information, article information, etc.).      redis: It is suitable for the high requirement of reading and writing efficiency, complicated data processing business and high security requirements (such as the count of Sina Weibo and the partial system of Weibo release, which are very high for data security and reading and writing requirements). Seven, need to carefully consider the part of the 1.Memcached single Key-value size is limited, a value of only 1MB support, and Redis maximum support 512MB 2.Memcached is only a memory cache, no reliability requirements While Redis prefers memory databases, it is 3 more reliable. Essentially, memcached is just a single key-value memory cache, and Redis is a data structure memory database that supports five types of data. So, in addition to simple caching, Redis can also handle some simple logic operations, Redis can not only cache, but also can be used as a database 4. The new version (3.0) of Redis refers to cluster distribution, which means that the cluster itself balances client requests, each node can communicate,Scalable line, maintainability more powerful. From: http://blog.csdn.net/suifeng3051/article/details/23739295
Ehcache Reference: http://www.open-open.com/lib/view/open1322892011546.html

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.