Comparing Redis Persistence Options Performance

Written by: Bagus Facsi Aginsa
Published at: 23 Feb 2022

Redis is in-memory data structure store, it can be used as a database, cache, and message broker. Although redis was introduced with in-memory data storage, it has options for persistence storage. The options are:

  1. RDB (Redis Database Backup)
  2. AOF (Append Only File)
  3. Hybrid (RDB + AOF)

Using the persistence option will reduce the redis performance, that is why in this tutorial we will compare the performance of all the persistence mode option.

Test Scenario

Redis is already bundled with a load testing tools that is redis-benchmark. It can test the performance of our redis in specified host. In this tutorial, we will test the redis installed on my laptop. This is my laptop spec:

  1. CPU: Intel Core i3-6006U, 2 cores, 4 threads.
  2. RAM: 16 GB
  3. OS: Ubuntu 18.04 WSL
  4. Redis Version: 6.2.6

We will test the standard and most common SET and GET, operation 10 times and get the average results for each of the persistence option. This the command we used to test the redis:

redis-benchmark -t set,get | egrep "======|throughput summary:"

RDB Testing

RDB persisten performs point-in-time snapshots of your data at specified intervals. It is not always persist the data to disk on every write operation. Because of that, RDB should be faster than other persistence storage option. But RDB has a weakness, it has higher chance of data loss especially if the redis stop working between the specified intervals snapshots.

Redis by default will use the RDB persistence with this rule:

  1. After 3600 seconds (an hour) if at least 1 key changed
  2. After 300 seconds (5 minutes) if at least 100 keys changed
  3. After 60 seconds if at least 10000 keys changed

In this test, we will use the default Redis RDB configuration. This is the average test results for RDB Persistence after tested 10 times.

Operation Req/s
SET 45936.96 req/s
GET 47609.84 req/s

AOF Testing

AOF persistence logs every write operation performed on the redis, it also will be used at redis startup to reconstructing the original dataset. AOF is more durable than RDB, but you can have different fsync policies to determine when to log the write operation to find the balance between performance and durability.

By default, Redis is not using AOF persistence, so you must configure redis to use AOF. The default fsync policies when the AOF enabled is every second. Redis team said that using this policies, the performance wlll still be great.

In this test, we will use the default Redis AOF configuration. This is the average test results for AOF Persistence after tested 10 times.

Operation Req/s
SET 42819.68 req/s
GET 47178.6 req/s


It is possible to combine these two persistent option. The redis will logs every write operation, and then on a specified intervals it will perform a snapshot. When the redis booting, it will use AOF file instead of RDB to reconstructing the data because it is guaranteed to be the most complete.

In this test, we will use the default Redis AOF and RDB configuration. This is the average test results after tested 10 times.

Operation Req/s
SET 42486.48 req/s
GET 47123.33 req/s

No Persistence

If you are not interested with persistency, you can choose to run fully on memory. It will gives you the best performance, but when the redis rebooting, your data will be lost.

This is the average test results after tested 10 times.

Operation Req/s
SET 46030.94 req/s
GET 47185.19 req/s


There are some key point when I was doing this experiment:

  1. The Persisten option will only affect the performance of write operation. As tested, all of them have relatively the same read speed that is around 47k req/s. This is make sense, because read operation does not change the redis data.
  2. The write performance on RDB is the same with no persistence at all. This is actually because the snapshot process is never happened in this test. Each test is done in less than 3 second. The default interval for RDB is 60 second. So, if we configure Redis using RDB persistence, it will have maximum performance until the snapshot process happend.
  3. The write performance on AOF is reduced around 9% from 46k req/s to 42k req/s. The AOF get performance reduce because it will log the write operation to disk every second (by default). You will get better performance by extending the fsync policy in Redis configuration.
  4. The hybrid (AOF + RBD) approach by default will have the same performance as AOF, but the performance maybe will be reduced further when the snapshot process happend.

Thats it, hope you benefit from this experiment. From this test, we know that we are not sacrificing a lot of performance when we want to persist our data in redis. But, if a little performance change matter to you, then choose the persistence mode wisely according to your need.