Redis features, advantages and disadvantages

Redis features, advantages and disadvantages

 

Features

1. In-memory database, fast and durable

2. key-value structure

3. Data type: String, list, set, sorted set, hash

4. Support transactions, atomicity of data, either do all or nothing

5. Single thread

 

 

advantage

1. Good read and write performance

2. Support data persistence, support AOF and RDB persistence

3. Support master-slave replication, the host will automatically synchronize data to the slave, and practice read-write separation

4. Rich data structures, including: String, list, set, sorted set, hash

 

 

shortcoming

 

1. Redis does not have automatic fault tolerance and recovery functions. The downtime of the host and slave will cause some read and write requests in the front-end to fail. It needs to wait for the machine to restart or manually switch the front-end IP to recover.

 

2. When the host is down, some data cannot be synchronized to the slave in time before the downtime. After the IP is switched, the problem of data inconsistency will be introduced, which reduces the availability of the system.

 

3. The master-slave replication of Redis adopts full replication. During the replication process, the host will fork a child process to take a snapshot of the memory, and save the memory snapshot of the child process as a file and send it to the slave. In this process, it is necessary to ensure that the host has enough free memory. If the snapshot file is large, it will have a greater impact on the service capability of the cluster, and the replication process will be carried out when the slave machine newly joins the cluster or when the slave machine and the host network are disconnected and reconnected. A full amount of data replication between slaves causes a lot of trouble for the actual system operation.

 

4. It is difficult for Redis to support online expansion. When the cluster capacity reaches the upper limit, online expansion will become very complicated. To avoid this problem, operation and maintenance personnel must ensure that there is enough space when the system goes online, which causes a great waste of resources.

 

 

performance of redis

 

This is the official data: SET operations are 110,000 times per second, and GET operations are 81,000 times per second.
In the experiment, 20 clients were simulated to write to redis. When the data in the database reaches the G data level, the write speed will drop significantly.

 

Possible reasons: 1. Redis needs to synchronize data to disk, which takes up a lot of CPU and memory; 2. The number of keys increases and needs to be rearranged; 3. There are still a large number of requests in the message queue, causing requests to block.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326472880&siteId=291194637