Bird
Raised Fist0
Redisquery~10 mins

RDB configuration (save intervals) in Redis - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - RDB configuration (save intervals)
Start Redis Server
↓
Check save intervals config
↓
Monitor changes in data
↓
Has changed keys count reached threshold?
↓
Wait and keep monitoring
↓
Save snapshot to disk
↓
Reset change counter
↓
Continue monitoring
Redis monitors data changes and triggers saving snapshots to disk when configured thresholds of time and changes are met.
Execution Sample
Redis
save 900 1
save 300 10
save 60 10000
This config saves the database if 1 change in 900 seconds, or 10 changes in 300 seconds, or 10000 changes in 60 seconds occur.
Execution Table
StepElapsed Time (sec)Changes CountCondition CheckedAction Taken
100No save condition metContinue monitoring
23005save 300 10? 5<10Continue monitoring
360010save 300 10? 10>=10Trigger RDB snapshot
46000Reset changes count after saveContinue monitoring
59001save 900 1? 1>=1Trigger RDB snapshot
69000Reset changes count after saveContinue monitoring
712009999save 60 10000? 9999<10000Continue monitoring
8126010000save 60 10000? 10000>=10000Trigger RDB snapshot
912600Reset changes count after saveContinue monitoring
💡 Monitoring continues indefinitely, snapshots triggered when conditions meet.
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 5After Step 7After Step 8Final
Elapsed Time (sec)0300600900120012601260
Changes Count0500999900
Key Moments - 2 Insights
Why does Redis reset the changes count after saving a snapshot?
After saving a snapshot (see steps 3, 5, 8), Redis resets the changes count to zero to start counting new changes for the next save interval.
What happens if changes do not reach the threshold within the time interval?
Redis continues monitoring without saving (see step 2 and 7), because the condition for saving is not met yet.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does Redis first trigger a snapshot save?
AStep 3
BStep 5
CStep 2
DStep 7
💡 Hint
Check the 'Action Taken' column for the first 'Trigger RDB snapshot' entry.
According to the variable tracker, what is the changes count after step 3?
A10
B0
C5
D1
💡 Hint
Look at the 'Changes Count' row under 'After Step 3' in the variable tracker.
If the changes count never reaches the threshold, what will Redis do?
ASave snapshot anyway after time interval
BNever save snapshot
CContinue monitoring without saving
DReset changes count to zero
💡 Hint
Refer to steps 2 and 7 in the execution table where conditions are not met and monitoring continues.
Concept Snapshot
RDB save intervals config:
- Format: save <seconds> <changes>
- Redis saves snapshot if changes >= threshold within seconds
- Multiple save rules can coexist
- After saving, changes count resets
- Monitoring continues indefinitely
Full Transcript
Redis RDB configuration uses save intervals defined by time and number of changes. Redis monitors data changes and elapsed time. When the number of changes reaches or exceeds the configured threshold within the specified time, Redis triggers a snapshot save to disk. After saving, the changes count resets to zero to start fresh counting. If the threshold is not met, Redis continues monitoring without saving. Multiple save intervals can be configured to trigger saves under different conditions.

Practice

(1/5)
1. What does the Redis save configuration option control?
easy
A. The port Redis listens on
B. The maximum memory Redis can use
C. When Redis automatically saves snapshots of the dataset
D. The password required to connect to Redis

Solution

  1. Step 1: Understand the purpose of save in Redis

    The save option defines intervals for automatic snapshot saving.
  2. Step 2: Identify what save controls

    It controls when Redis saves data snapshots based on time and changes.
  3. Final Answer:

    When Redis automatically saves snapshots of the dataset -> Option C
  4. Quick Check:

    RDB save intervals = automatic snapshot timing [OK]
Hint: Remember: save sets snapshot save timing [OK]
Common Mistakes:
  • Confusing save with memory limits
  • Thinking save sets connection ports
  • Assuming save controls authentication
2. Which of the following is the correct syntax to save Redis data every 300 seconds if at least 10 keys changed?
easy
A. save 10 300
B. save 300 10
C. save 300,10
D. save 10;300

Solution

  1. Step 1: Recall Redis save syntax

    The syntax is save <seconds> <changes> without commas or semicolons.
  2. Step 2: Match the correct order

    Time in seconds comes first, then number of changes.
  3. Final Answer:

    save 300 10 -> Option B
  4. Quick Check:

    Correct syntax = save seconds changes [OK]
Hint: Syntax is: save seconds changes (space separated) [OK]
Common Mistakes:
  • Swapping seconds and changes order
  • Using commas or semicolons instead of spaces
  • Omitting one of the two required values
3. Given the Redis config lines:
save 900 1
save 300 10
What happens if 5 keys change within 400 seconds?
medium
A. Redis does not save a snapshot because 10 changes were not reached
B. Redis saves a snapshot after 300 seconds because 10 changes are needed
C. Redis saves a snapshot immediately after 5 changes
D. Redis saves a snapshot after 900 seconds because 1 change triggers it

Solution

  1. Step 1: Analyze each save interval

    First interval: save every 900 seconds if at least 1 change.
    Second interval: save every 300 seconds if at least 10 changes.
  2. Step 2: Check conditions for 5 changes in 400 seconds

    5 changes < 10, so second interval not triggered.
    900 seconds not reached yet, so first interval not triggered either.
  3. Final Answer:

    Redis does not save a snapshot because 10 changes were not reached -> Option A
  4. Quick Check:

    5 changes in 400s does not meet any save condition [OK]
Hint: Check each interval separately for time and changes [OK]
Common Mistakes:
  • Assuming 5 changes triggers 10-change interval
  • Ignoring the time condition for the first interval
  • Thinking Redis saves immediately after changes
4. You wrote this Redis config line:
save 60,5
Why does Redis ignore this setting?
medium
A. Because commas are invalid; spaces must separate values
B. Because 5 changes is too low to trigger saving
C. Because 60 is not a valid time value
D. Because save intervals must be in milliseconds

Solution

  1. Step 1: Check syntax of save line

    Redis requires space-separated values, not commas.
  2. Step 2: Understand why commas cause ignoring

    Commas make the line invalid, so Redis skips it.
  3. Final Answer:

    Because commas are invalid; spaces must separate values -> Option A
  4. Quick Check:

    Use spaces, not commas in save intervals [OK]
Hint: Use spaces, never commas, between save parameters [OK]
Common Mistakes:
  • Thinking commas are allowed separators
  • Believing time must be in milliseconds
  • Assuming low changes disables saving
5. You want Redis to save a snapshot if either:
- 5 keys changed in 60 seconds
- OR 100 keys changed in 900 seconds
Which configuration lines achieve this?
hard
A. save 900 5\nsave 60 100
B. save 5 60\nsave 100 900
C. save 60 100\nsave 900 5
D. save 60 5\nsave 900 100

Solution

  1. Step 1: Match time and changes correctly

    Format is save <seconds> <changes>.
    So 60 seconds and 5 changes is save 60 5.
    900 seconds and 100 changes is save 900 100.
  2. Step 2: Verify both conditions are separate lines

    Each condition must be on its own save line.
  3. Final Answer:

    save 60 5 save 900 100 -> Option D
  4. Quick Check:

    Time first, changes second per line [OK]
Hint: Write each interval on its own line: save seconds changes [OK]
Common Mistakes:
  • Swapping seconds and changes
  • Putting both intervals on one line
  • Using commas or semicolons instead of spaces
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