Redis 2.8 Architecture Analysis

Source: Internet
Author: User

1 RedisArchitecture Analysis1.1   Why do you useNosqlàRedis?

1) How to store the difference:

nosql: storing data in a k-v way

Example:mset ID 0001 name Zhangsan age 18

Relational databases: storing data in a multi-table structure Association

For example:

< P style= "text-indent:0;" >id

name

age

0001

zhangsan

18

...

...

...

2) The difference between reading and writing methods:

NoSQL: Can be different types of data through the k-v way to fast read and write operations, no relationship, simple data structure.

relational database: the ability to read and write multiple table associations under different types of data, resulting in performance loss

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/BF/wKiom1WEI1Sj3U50AAG1tbDFox0900.jpg "title=" 5o5% " Vf~gm{nr2@5~yh19c0.png "alt=" Wkiom1wei1sj3u50aag1tbdfox0900.jpg "/>

3) the pros and cons of NoSQL

Advantages : Fast and easy to read and write data, depending on his non-relevance, simple database structure.

Disadvantages : SQL Industrialized data manipulation is not supported, it is inconvenient for data usage for business types, and most importantly, operations on transactions are not supported. It is not suitable for data storage with high data security requirements.

1.2   WhyRediscan quickly,and replaceMemcache, occupy the market1.2.1  Why should I be withMemcacheto compare

other caching frameworks (such as Oscache) are just a small jar- wrapped framework, and the memcache, like Redis , can run independently on the server, and distributed clusters are supported, but today's Redis is not just running standalone, it supports distributed clusters, it also supports persistence and rich data types, and is better at caching.

1.2.2  UnderstandMemcacheproblems that arise in practical applications

1) Memcache data loss problem:

to prevent accidents (server outages, power outages), data from a time period cache is inserted into DB , this process will have a huge impact on the efficiency of the server operation, if this time in the high concurrency time period, may cause excessive pressure on the server, data loss, but the loss of this data for the enterprise is catastrophic, so generally we will put the storage time and the concurrency of the time separate ( 2-3 an hour).

2) Data consistency issues:

in this time difference (2-3 hours) Some modules have modified the data in DB, but memcache is not synchronized, so the data is inconsistent, in order to solve the problem of data consistency and hit ratio, In an enterprise, it is common for clients to request data that is not read to the client, to read in db, resulting in a large number of requests penetrating into the DB, which prevents the DB from being supported.

3) low hit rate problem:

Hash algorithm is a failure rate, it may be a certain period of time the error rate is very large resulting in the memcache can not read data. At the same time, in order to solve the problem of hit rate, in the enterprise usually also let the client request to read the data, go to the DB read, also cause a large number of requests penetrate to the DB, resulting in db cannot support.

4) increased volume of traffic and continued increase in Access volume:

cause DB(mysql) table structure changes, need to re-build tables, split the table,memcache also need to expand, these work will waste a lot of manpower, material resources, resulting in waste.

1.2.3  Memcache+mysql vs Redis

1)Redis supports data persistence (equivalent to database), we can configure the server to do RDB,AOF.

(a) the loss of data can be prevented to a large extent.

(b)Redis provides persistence (equivalent to a database) that can be designed to decouple data from both front and back tables, and data consistency and hit rate issues are completely resolved by Redis . Redis Storage data structure is simple, the case of table-splitting is not present.

2) data type

(a) Memcache only supports string types.

(b) Redis supports 5 types of data for easier enterprise use.

3) Cache performance

(a) better cache performance than Memcache (optimized for data structure and memory usage, so better than memcache performance)

(b) Differences in memory usage:

Memcache: Using a memory pool can eliminate the overhead of requesting/ freeing memory, but there is a waste in space because he cannot free up free memory space. When there is not enough memory space,memcache even new data will be rejected.

Redis: The way in which memory is applied to the field to store data. So there is no waste of memory space. When there is not enough memory space, even if it results in swap(replacement), no data (not temporary data) will be excluded. So Redis is more suitable as a storage instead of a cache.

1.3   Redisapplication in the Enterprise architecture

• Redis stores portal data in e-commerce websites to handle big data, high concurrency issues

l The relational database stores data for the backend business type in the e-commerce website.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/BB/wKioL1WEJayhfQSSAAE7qyb-wK8688.jpg "title=" 11.png "alt=" Wkiol1wejayhfqssaae7qyb-wk8688.jpg "/>

1.4   RedisApplication Scenarios

l Scope of application: E-commerce shopping merchandise information cache, merchandise snapping, ticketing system queue, Sina Weibo for a large number of different data types of operation, real-time chat information platform, game leaderboards

Available Scenarios: Large data volumes and large changes in data content, the need for fast data read and write. and the security requirements for data are not high.

unavailable occasions: for the absolute high data security requirements, such as: bank transfer, access funds.

1.5   Summary:

1.nosql->redis and relational database differences:

Storage: Data storage structure is simple, there is no table association

Read and write speed: Fast, depends on simple structure, no relationship type

2. for the same level of caching framework, the comparison with Memcache

--Better cache performance than memcache

- Rich data types

-- Persistence

3. Compare memcache+mysql with Redis

The increasing volume of business data, and the continued growth of traffic, problems encountered:

--mysql need to build table,memcache need to enlarge

- Data Consistency (persistence)

-- access through to DB


Redis 2.8 Architecture Analysis

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.