Ii. advantages and disadvantages of the RDB mechanism:
What are the advantages of an RDB?
1). Once this is used, your entire Redis database will contain only one file, which is perfect for file backups. For example, you might want to archive the last 24 hours of data every hour and archive the last 30 days of data every day. With such a backup strategy, we can recover very easily once the system has a catastrophic failure.
2). The RDB is a great choice for disaster recovery. Because we can easily compress a single file and then transfer it to other storage media.
3). Maximum performance. For a Redis service process, the only thing it needs to do when it starts to persist is to fork out the child process and then complete the persistence work by sub-processes, which can greatly prevent the service process from performing IO operations.
4). If the data set is large, the RDB will be more efficient to start than the AOF mechanism.
What are some of the disadvantages of an RDB?
1). An RDB is not a good choice if you want to ensure high availability of data, which minimizes data loss. Since the system is down before the scheduled persistence, the data that has not been written to the disk before is lost.
2). Since the RDB assists with data persistence through the fork process, it can cause the entire server to stop serving hundreds of milliseconds, or even 1 seconds, if the data set is large.
Third, the advantages and disadvantages of the AOF mechanism:
What are the advantages of aof?
1). This mechanism can result in higher data security, i.e. data persistence. There are 3 synchronization policies available in Redis, that is, synchronization per second, synchronization per modification, and unsynchronized. In fact, synchronization per second is also done asynchronously, and its efficiency is very high, the difference is that once the system is down, then the data will be lost in a second. Each time we modify the synchronization, we can treat it as a synchronous persistence, that is, each occurrence of the data changes will be immediately logged to disk. It can be predicted that this is the least efficient way. As for the no-sync, needless to say, I think we can understand it correctly.
2). Because this mechanism writes to log files in append mode, it does not break the content that already exists in the log file even if there is an outage during the write process. However, if we only write half of the data this time there is a system crash problem, do not worry, before the next boot of Redis, we can use the Redis-check-aof tool to help us solve the problem of data consistency.
3). If the log is too large, Redis can automatically enable the rewrite mechanism. That is, Redis continuously writes the modified data to the old disk file in Append mode, and Redis also creates a new file to record which modification commands are executed during this period. Therefore, the data security can be better ensured when the rewrite is switched.
4). AOF contains a well-formed, easy-to-understand log file for recording all modification operations. In fact, we can also complete the reconstruction of the data through this file.
What are the disadvantages of aof?
1). aof files are typically larger than the Rdb file for the same number of datasets.
2). Depending on the synchronization strategy, the AOF is often slower than the RDB in terms of operational efficiency. In summary, the efficiency of the synchronization policy per second is high, and the efficiency of the synchronization disable policy is as efficient as the RDB.
Disclaimer: The above information is from the Internet
This article is from the "Yu Hogeng" blog, make sure to keep this source http://yhgcenter.blog.51cto.com/2623981/1858186
Redis RDB, AOF two mechanisms