0
0
Redisquery~10 mins

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

Choose your learning style9 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.