0

My Linux distribution uses the redis database. At boot the redis-server needs about 80 seconds to load the dataset. The following is a log that shows what I have written:

redis-server[249]: 249:M 17 Oct 2022 16:29:55.173 * DB loaded from append only file: 79.442 seconds

If a Python program tries querying the database before the redis-server finishes the loading in memory operation, it is raised the Exception: redis.exceptions.BusyLoadingError.
The Exception message error is: Redis is loading the dataset in memory and is compliant with the context that I have described.

Because I'm using the default configuration of redis-server in this moment I don't know exactly what is the type of persistence used by redis-server. The file redis.conf is very long so, here, I report settings that I think are most important:

...
################################ SNAPSHOTTING  ################################
#
# Save the DB on disk:
#
#   save <seconds> <changes>
#
#   Will save the DB if both the given number of seconds and the given
#   number of write operations against the DB occurred.
# OE: tune for a small embedded system with a limited # of keys.
save 120 1
save 60 100
save 30 1000

############################## APPEND ONLY MODE ###############################
# OE: changed default to enable this
appendonly yes

# The name of the append only file (default: "appendonly.aof")
appendfilename "appendonly.aof"
...

These settings seem indicate that the database is using the persistence type: Append Only File (AOF). I think these configuration cause a so long loading time.

Is it possible to use settings that avoid a too long loading time at boot?

frankfalse
  • 125
  • 9

1 Answers1

1

Redis is a disk-backed all-in-memory database, so either you diminish your database size for initial load, or you give redis faster disks; that's all the alternatives you have. This isn't related whether your configuration uses aof or not: on the initial load redis will have to read all the data regardless of the number of files it's in.

drookie
  • 8,625
  • 1
  • 19
  • 29