Home  >  Article  >  Database  >  What are the persistence methods of Redis?

What are the persistence methods of Redis?

PHPz
PHPzforward
2023-05-30 16:25:121278browse

Redis is single-threaded, why is it so fast?

Based on memory, most requests are pure memory operations, and the CPU is not the bottleneck of Redis.

Avoid unnecessary CPU context switching and other race conditions, such as lock operations, etc.
The bottom layer uses a multi-channel I/O multiplexing model and non-blocking IO.
Redis6 supports multi-threading, but it is not enabled by default.
What persistence methods does redis have? Let’s talk about their differences.
Supports AOF and RDB persistence.


AOF
Record every write and delete operation processed by the server in the form of a log. The query operation will not be recorded, but will be recorded in the form of text.
Supports second-level persistence and good compatibility. For the same number of data sets, AOF files are usually larger than RDB files, so recovery is slower than RDB.


RDB
Writes a snapshot of the data set in memory to disk within a specified time interval. Data can be archived at a specified time, but real-time persistence cannot be achieved.
The files are compact and small in size. For disaster recovery, RDB is a very good choice. Compared with the AOF mechanism, if the data set is large, RDB is faster than AOF in restoring large data sets.

The above is the detailed content of What are the persistence methods of Redis?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete