Home > Database > Redis > body text

Why use redis cache

步履不停
Release: 2019-06-22 15:11:37
Original
1928 people have browsed it

Why use redis cache

First of all, let’s introduce some basic concepts of redis. Redis is a Nosql database and a key-value storage system. Although redis is a key-value storage system, redis supports many 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 cannot fit in one machine;

2) When the data index cannot fit in the memory of one machine;

3) Access When the amount (mixed reading and writing) cannot fit into one instance.

In the stand-alone era, only one machine is used to install MySQL for storage. If thousands of pieces of data are stored each time, this will cause MySQL's performance to be poor, storage and reading speeds to be very slow, and then it will evolve. Into the way of vertical splitting of cache mysql.

Cache, as an intermediate cache era, saves all data in the cache first and then stores it in mysql to reduce database pressure and improve efficiency.

But when the data increases to another magnitude again, the above method cannot meet the demand. As the writing pressure of the database increases, the cache can only relieve the reading pressure of the database. The concentration of reading and writing on one database makes the database overwhelmed. Most websites have begun to use master-slave replication technology to achieve separation of reading and writing to improve reading and writing performance and the scalability of reading databases. Mysql's master-slave mode has become the standard for websites at this time.

In the era of master-slave separation mode, on the basis of redis cache, MySQL master-slave replication, and read-write separation, the write pressure of the MySQL main database began to experience bottlenecks, and the amount of data continued to increase. Increasingly, because MyISAM uses table locks, serious lock problems will occur under high concurrency. A large number of high-concurrency MySQL applications began to use the InnoDB engine instead of MyISAM.

Advantages of Nosql database

1)Easy to expand

These types of data storage do not require a fixed schema and can be performed without redundant operations Horizontal expansion. Compared with relational databases, the number of tables and fields can be reduced. It also brings scalable capabilities at the architectural level

2)Big data volume improves performance

3)Diverse and flexible Data Model


For more Redis related technical articles, please visit Redis tutorial# column to learn!

The above is the detailed content of Why use redis cache. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template