Bird
Raised Fist0
Redisquery~20 mins

RDB vs AOF comparison in Redis - Practice Questions

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Redis Persistence Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Difference in Persistence Frequency
Which statement correctly describes how often Redis saves data to disk using RDB and AOF?
ARDB saves data at specified intervals, while AOF logs every write operation immediately or with minimal delay.
BRDB logs every write operation immediately, while AOF saves data only at specified intervals.
CBoth RDB and AOF save data only when Redis is shut down.
DRDB and AOF both save data continuously in real-time without delay.
Attempts:
2 left
💡 Hint
Think about how each method balances performance and data safety.
🧠 Conceptual
intermediate
2:00remaining
Recovery Speed Comparison
When Redis restarts, which persistence method generally allows faster recovery of data?
ABoth RDB and AOF take the same time to recover data.
BAOF allows faster recovery because it replays a small log file.
CRDB allows faster recovery because it loads a single snapshot file.
DNeither RDB nor AOF can recover data after restart.
Attempts:
2 left
💡 Hint
Consider the size and format of files each method uses during recovery.
❓ query_result
advanced
2:00remaining
AOF File Growth Behavior
Given a Redis instance with frequent writes, what is the expected behavior of the AOF file size over time if no rewriting occurs?
AThe AOF file size will randomly fluctuate without any pattern.
BThe AOF file size will continuously grow larger as every write is appended.
CThe AOF file size will shrink over time without any intervention.
DThe AOF file size will remain constant because old commands are deleted automatically.
Attempts:
2 left
💡 Hint
Think about how AOF logs every write operation.
🧠 Conceptual
advanced
2:00remaining
Data Safety in Case of Crash
Which persistence method offers better data safety in case of a sudden Redis crash?
AAOF with fsync set to every write offers better data safety than RDB snapshots.
BRDB snapshots offer better data safety than AOF regardless of fsync settings.
CBoth RDB and AOF offer the same data safety in case of a crash.
DNeither RDB nor AOF provide any data safety in case of a crash.
Attempts:
2 left
💡 Hint
Consider how often data is written to disk in each method.
❓ schema
expert
3:00remaining
Choosing Persistence Strategy for High Write Load
You manage a Redis server with very high write load and need to minimize data loss but also want to keep server performance high. Which persistence strategy is best?
AUse only RDB snapshots at long intervals to reduce disk writes.
BDisable both AOF and RDB to maximize performance.
CUse AOF with fsync every write to maximize durability regardless of performance.
DUse AOF with fsync every second and enable RDB snapshots as a fallback.
Attempts:
2 left
💡 Hint
Balance durability and performance by combining methods.

Practice

(1/5)
1. Which Redis persistence method saves the entire dataset at specific time intervals?
easy
A. AOF (Append Only File)
B. RDB (Redis Database snapshot)
C. Both RDB and AOF save snapshots
D. Neither RDB nor AOF save snapshots

Solution

  1. Step 1: Understand RDB persistence

    RDB saves the dataset by creating snapshots at set intervals.
  2. Step 2: Compare with AOF

    AOF logs every write operation, not snapshots.
  3. Final Answer:

    RDB (Redis Database snapshot) -> Option B
  4. Quick Check:

    Snapshot saving = RDB [OK]
Hint: RDB = snapshots at intervals, AOF = logs every change [OK]
Common Mistakes:
  • Confusing AOF with snapshot saving
  • Thinking both save snapshots
  • Believing neither saves snapshots
2. Which of the following is the correct Redis command to enable AOF persistence?
easy
A. CONFIG SET appendonly yes
B. CONFIG SET save "900 1 300 10 60 10000"
C. CONFIG SET rdbcompression no
D. CONFIG SET maxmemory-policy allkeys-lru

Solution

  1. Step 1: Identify AOF enabling command

    The command to enable AOF is CONFIG SET appendonly yes.
  2. Step 2: Check other options

    CONFIG SET save "900 1 300 10 60 10000" sets RDB save intervals, C disables RDB compression, D sets memory eviction policy.
  3. Final Answer:

    CONFIG SET appendonly yes -> Option A
  4. Quick Check:

    Enable AOF = appendonly yes [OK]
Hint: Enable AOF with 'appendonly yes' command [OK]
Common Mistakes:
  • Confusing RDB save command with AOF
  • Using unrelated config commands
  • Forgetting to set appendonly to yes
3. Given Redis configured with AOF enabled and fsync set to 'everysec', what is the expected data durability behavior?
medium
A. Data is saved only at intervals, risking data loss of last seconds
B. Every write is immediately saved to disk, no data loss
C. Data is never saved to disk automatically
D. Data is saved only when Redis restarts

Solution

  1. Step 1: Understand AOF with fsync everysec

    With fsync set to 'everysec', Redis writes AOF data to disk every second.
  2. Step 2: Analyze durability implications

    This means data could be lost if Redis crashes within the last second before fsync.
  3. Final Answer:

    Data is saved only at intervals, risking data loss of last seconds -> Option A
  4. Quick Check:

    AOF everysec fsync = possible 1-second data loss [OK]
Hint: AOF everysec fsync means possible 1-second data loss [OK]
Common Mistakes:
  • Assuming every write is immediately saved
  • Thinking data is never saved automatically
  • Confusing with no persistence
4. You enabled both RDB and AOF persistence in Redis, but after a crash, data is missing. What is the most likely cause?
medium
A. Redis does not support using both RDB and AOF together
B. Redis was not restarted after enabling persistence
C. RDB snapshot interval is too long, losing recent changes
D. AOF file is corrupted and Redis cannot load it

Solution

  1. Step 1: Understand RDB and AOF coexistence

    Redis supports both RDB and AOF, preferring to load AOF first on restart if available.
  2. Step 2: Analyze data loss causes

    With both enabled, if data is missing after a crash, the most likely cause is AOF corruption, causing fallback to the older RDB snapshot and loss of recent changes.
  3. Final Answer:

    AOF file is corrupted and Redis cannot load it -> Option D
  4. Quick Check:

    Data loss with both = AOF corrupted [OK]
Hint: With both enabled, data loss likely from AOF corruption [OK]
Common Mistakes:
  • Believing Redis can't use both persistences
  • Thinking RDB interval too long is the cause
  • Forgetting to restart Redis
5. You want Redis to recover data quickly after a crash but can tolerate losing up to 1 minute of recent writes. Which persistence setup is best?
hard
A. Enable AOF with fsync always, disable RDB
B. Enable both RDB and AOF with fsync everysec
C. Enable RDB snapshots every 60 seconds, disable AOF
D. Disable both RDB and AOF for fastest performance

Solution

  1. Step 1: Match recovery speed and data loss tolerance

    RDB snapshots every 60 seconds allow fast recovery but may lose up to 1 minute of data.
  2. Step 2: Compare with AOF options

    AOF with fsync always is slower but safer; both enabled adds overhead; disabling persistence risks total data loss.
  3. Final Answer:

    Enable RDB snapshots every 60 seconds, disable AOF -> Option C
  4. Quick Check:

    Fast recovery + 1 min loss = RDB every 60s [OK]
Hint: RDB snapshots match fast recovery with some data loss [OK]
Common Mistakes:
  • Choosing AOF for fast recovery despite slower startup
  • Enabling both causing unnecessary overhead
  • Disabling persistence risking total data loss
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard