Current location - Loan Platform Complete Network - Big data management - Why use redis cache
Why use redis cache
,

First of all, let's introduce some basic concepts of redis, redis is a Nosql database, a key-value storage system. Although redis is a key-value storage system, but redis supports a lot of value storage types, such as strings, linked lists, sets, ordered sets and hashes.

So why use a Nosql database like redis?

1) When the total size of the data volume can't fit in one machine;

2) When the data index can't fit in one machine's memory;

3) When the amount of accesses (mix of reads and writes) can't fit in one instance.

Single-machine era, the storage of only one machine to install mysql, if each time to store thousands of data, this will lead to mysql performance is very poor, storage as well as read speed is very slow, and then evolved into the cache + mysql + vertical splitting approach.

Cache as an intermediate cache era, all the data will be saved to the cache first, and then deposited into mysql, reduce database pressure, improve efficiency.

But when the data again increased to another order of magnitude, the above approach also can not meet the demand, due to the database write pressure increases, the cache can only relieve the database read pressure. Reads and writes are concentrated in a database to make the database overwhelmed, most of the sites began to use master-slave replication technology to achieve read-write separation, in order to improve the read-write performance and read the library scalability. mysql master-slave mode has become the standard of the site at this time.

The master-slave mode era, on top of redis cache, MySQL master-slave replication, and read-write separation, this time the write pressure of the MySQL master library began to bottleneck, and the data volume continued to surge, due to the use of table locks by MyISAM, there will be serious locking problems under high concurrency, and a large number of high-concurrency MySQL applications began to use InnoDB engine instead of MyISAM.

Advantages of Nosql databases

1) Easily scalable

These types of data storage do not require a fixed schema, and can be horizontally scaled without redundant operations. Relative to relational databases can reduce the number of tables and fields in particular. Also no type between the architectural level brings the ability to scale

2) large data volumes to improve performance

3) diverse and flexible data model

For more Redis-related technical articles, please visit the Redis tutorial section to learn!