Skip to content
DevOps AI ToolKit
Newsletter
All guides
AI for Redis By James Joyner IV · · 8 min read

Redis Error Guide: 'LOADING Redis is loading the dataset in memory' — Wait Out the Startup Load

Fix LOADING Redis is loading the dataset in memory: understand RDB/AOF load on startup, slow disk, huge dumps, replica full sync, and how to wait or speed up recovery.

  • #redis
  • #troubleshooting
  • #errors
  • #persistence

Overview

LOADING Redis is loading the dataset in memory means the server is up and accepting connections but is still reading its dataset from disk (an RDB dump.rdb or the AOF) into memory. Until that finishes, Redis rejects most commands so clients do not see a partial dataset. This is expected behavior on startup or during a replica’s full resync — the question is whether it is finishing in a reasonable time.

The literal error clients receive:

(error) LOADING Redis is loading the dataset in memory

It is normal and temporary after a restart or a replica full sync. It becomes a problem when the load takes a long time — a huge dataset, slow disk, or an AOF that must be replayed command-by-command — turning a quick restart into minutes of unavailability. Understanding what is loading, and how big it is, tells you whether to wait or to change how you restart.

Symptoms

  • Every command returns LOADING for a period after start; then service resumes.
  • Appears on a replica during a full sync from its master.
  • Longer than expected on instances with large RDB/AOF files or slow storage.
redis-cli PING
(error) LOADING Redis is loading the dataset in memory
redis-cli INFO persistence | grep -E 'loading|rdb_last_load|async_loading'
loading:1

Common Root Causes

1. Normal startup load of a large dataset

A big dump.rdb takes time to parse into memory; the bigger the dataset, the longer the LOADING window.

redis-cli CONFIG GET dir
ls -lh /var/lib/redis/dump.rdb
-rw-rw---- 1 redis redis 6.4G Jul  3 04:00 /var/lib/redis/dump.rdb

2. AOF replay on startup

With appendonly yes, Redis reconstructs state by replaying the AOF, which is slower than loading an RDB for the same data.

grep -E '^appendonly|^aof-use-rdb-preamble' /etc/redis/redis.conf
ls -lh /var/lib/redis/appendonlydir/
appendonly yes

3. Replica full resync

A replica that lost its link performs a full sync: the master BGSAVEs and ships an RDB, and the replica loads it — during which it answers LOADING.

redis-cli INFO replication | grep -E 'role|master_sync_in_progress|master_link_status'
role:slave
master_sync_in_progress:1

4. Slow disk making the load crawl

Underprovisioned or contended storage stretches the load time dramatically.

iostat -x 2 3        # watch %util and await on the data device
sudo journalctl -u redis-server --no-pager | grep -iE 'Loading|DB loaded' | tail

Diagnostic Workflow

Step 1: Confirm it is loading and for what reason

redis-cli INFO persistence | grep -E 'loading|async_loading|rdb_last_load_keys_loaded'
redis-cli INFO replication | grep -E 'role|master_sync_in_progress'

loading:1 with role:master → startup load; master_sync_in_progress:1 → replica full sync.

Step 2: Estimate how much is left

redis-cli INFO persistence | grep -E 'loading_loaded_perc|loading_eta_seconds|loading_total_bytes'
loading_loaded_perc:63.44
loading_eta_seconds:47

loading_eta_seconds gives a rough time to completion.

Step 3: Size the dataset on disk

DIR=$(redis-cli CONFIG GET dir 2>/dev/null | sed -n 2p)
ls -lh "$DIR"/dump.rdb "$DIR"/appendonlydir/ 2>/dev/null

Step 4: Watch the log for load progress and completion

sudo journalctl -u redis-server --no-pager | grep -iE 'Loading RDB|DB loaded from disk|DB loaded from append only file' | tail
* Loading RDB produced by version 7.2.4
* Done loading RDB, keys loaded: 8123441, keys expired: 12
* DB loaded from disk: 41.882 seconds

Step 5: Check disk throughput if load is slow

iostat -x 2 3

Example Root Cause Analysis

At 05:00 a routine restart of the primary cache leaves clients getting LOADING Redis is loading the dataset in memory for several minutes — far longer than the team expected. Nothing is broken; the concern is the length of the outage window.

INFO persistence shows a progress figure and ETA:

loading:1
loading_loaded_perc:41.20
loading_eta_seconds:150

The dataset is a 6.4G AOF being replayed (appendonly yes), and iostat shows the data volume pinned at 100% util on a burst-credit-exhausted disk. The load is I/O bound, not CPU bound. There is nothing to “fix” mid-load — killing Redis now only restarts the same load. The right move is to wait for completion and then address the two amplifiers:

# Wait it out — do not restart
watch -n5 "redis-cli INFO persistence | grep -E 'loading|loading_eta_seconds'"

# After recovery, shrink future load time:
redis-cli BGREWRITEAOF                 # compact the AOF
redis-cli CONFIG GET aof-use-rdb-preamble   # ensure 'yes' for fast RDB-preamble load

Longer term the instance moved to a faster provisioned-IOPS disk and enabled the RDB preamble so AOF loads read a compact RDB header instead of replaying millions of commands, cutting restart time from minutes to seconds.

Prevention Best Practices

  • Treat LOADING as expected on restart — build client retry/backoff so a short load window does not cascade into application errors.
  • Keep the AOF compact with periodic BGREWRITEAOF and aof-use-rdb-preamble yes so startup loads a compact RDB header instead of replaying every command.
  • Provision storage with enough sustained IOPS/throughput; a slow disk is the biggest multiplier of load time.
  • For replicas, avoid unnecessary full resyncs: size repl-backlog-size and use repl-diskless-sync where appropriate to speed partial recovery.
  • Watch loading_eta_seconds rather than guessing; alert only if it stalls or exceeds an expected budget.
  • Stagger restarts across a fleet so not every node is LOADING at once.
  • Paste the load log lines into the free incident assistant, and see more Redis guides.

Quick Command Reference

# Is it loading, and why?
redis-cli INFO persistence | grep -E 'loading|async_loading|loading_eta_seconds|loading_loaded_perc'
redis-cli INFO replication | grep -E 'role|master_sync_in_progress'

# Dataset size on disk
DIR=$(redis-cli CONFIG GET dir 2>/dev/null | sed -n 2p)
ls -lh "$DIR"/dump.rdb "$DIR"/appendonlydir/ 2>/dev/null

# Load progress in the log
sudo journalctl -u redis-server | grep -iE 'Loading RDB|DB loaded' | tail

# Disk throughput while loading
iostat -x 2 3

# Speed up future loads
redis-cli BGREWRITEAOF

Conclusion

LOADING Redis is loading the dataset in memory is not an error to “fix” so much as a state to wait out: Redis is reading its dataset from disk and refusing commands until it is complete. The typical drivers are:

  1. Normal startup load of a large RDB.
  2. AOF replay, which is slower than loading an RDB.
  3. A replica performing a full resync.
  4. Slow disk stretching the load time.

Check loading_eta_seconds to know how long it will take, size the dataset on disk, and if loads are chronically slow, compact the AOF, enable the RDB preamble, and put the data on faster storage. Client-side retry with backoff turns these windows into a non-event.

Free download · 368-page PDF

Download the Free 500-Prompt DevOps AI Toolkit

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.