Overview
FalkorDB supports two primary persistence mechanisms:- RDB (Redis Database) - Point-in-time snapshots
- AOF (Append-Only File) - Operation logging
RDB Snapshots
How RDB Works
RDB creates point-in-time snapshots of your entire dataset and writes them to a compact.rdb file on disk. This approach provides:
- Compact, single-file backups ideal for disaster recovery
- Fast restart times (faster than AOF for large datasets)
- Easy versioning and cloning of datasets
RDB Configuration
Configure RDB throughredis.conf or via redis-cli:
RDB Considerations
Advantages:- Excellent for backups and disaster recovery
- Minimal impact on performance during normal operations
- Compact file format
- Fast data loading on restart
- Potential data loss between snapshots
- Forking can be time-consuming for large datasets
- May cause brief performance degradation (milliseconds to 1 second) during snapshot creation on very large datasets
- Requires significant disk I/O during snapshot operations
AOF (Append-Only File)
How AOF Works
AOF logs every write operation as it happens, creating an append-only log that can replay all operations to reconstruct the dataset. This provides greater durability than RDB snapshots.AOF Configuration
AOF fsync Policies
1. appendfsync always
- Durability: Maximum - virtually no data loss
- Performance: Lowest - synchronous disk writes
- Data Loss Risk: Only the latest command in case of disaster
- Best for: Mission-critical data where no data loss is acceptable
2. appendfsync everysec (Recommended)
- Durability: High - fsync performed asynchronously every second
- Performance: High - background thread handles disk writes
- Data Loss Risk: Up to 1 second of writes
- Best for: Most production use cases balancing performance and durability
3. appendfsync no
- Durability: Depends on OS (typically 30 seconds on Linux)
- Performance: Highest - OS decides when to flush
- Data Loss Risk: Several seconds of data in case of crashes
- Best for: High-performance scenarios where some data loss is acceptable
AOF Rewrite
Over time, AOF files can grow large. AOF rewrite creates a compact version:Combining RDB and AOF
For maximum durability, enable both mechanisms:Graph-Specific Operations: DUMP and RESTORE
For graph-specific backup and migration scenarios, FalkorDB supports Redis’s DUMP and RESTORE commands for individual keys (graphs).DUMP Command
Serialize a graph to a portable format:- Returns a serialized representation of the value at the specified key
- The serialization format is opaque and specific to Redis/FalkorDB
- Contains the graph structure and all its data
- Does not include TTL information by default
RESTORE Command
Restore a serialized graph:REPLACE- Overwrite existing key (available since Redis 3.0.0)ABSTTL- TTL represents absolute Unix timestamp (since Redis 5.0.0)IDLETIME- Set the idle time for the object
Use Cases for DUMP/RESTORE
- Selective backup: Back up specific graphs rather than entire database
- Migration: Move specific graphs between FalkorDB instances
- Testing: Clone production graphs to test environments
- Archival: Export graphs for long-term storage
Choosing the Right Strategy
High Performance, Some Data Loss Acceptable
Balanced Performance and Durability (Recommended)
Maximum Durability
Development/Testing
Docker Environment Persistence
When running FalkorDB in Docker, proper volume configuration is essential for durability. See the Persistence on Docker guide for detailed instructions on:- Creating persistent volumes
- Mounting data directories
- Verifying persistence configuration
- Best practices for Docker deployments
ACL SETUSER survive container restarts), see ACL Persistence on Docker.
Monitoring and Maintenance
Check Persistence Status
Manual Save Operations
Backup Best Practices
- Regular Snapshots: Schedule periodic RDB snapshots using cron or similar
- Off-site Backups: Store backups in separate locations or cloud storage
- Test Restores: Regularly verify backups can be restored successfully
- Monitor Disk Space: Ensure sufficient space for both RDB and AOF files
- Automate: Use scripts to automate backup, verification, and rotation
Performance Considerations
- RDB: Brief CPU spike and memory overhead during fork; negligible impact between snapshots
- AOF (everysec): Minimal performance impact, ~1-2% overhead
- AOF (always): Significant performance impact due to synchronous disk I/O
- Both RDB + AOF: Cumulative overhead but maximum durability
Further Reading
- Persistence Options in Redis
- Redis Persistence Documentation
- FalkorDB Docker Persistence Setup
- FalkorDB Replication
Frequently Asked Questions
Should I use RDB or AOF for FalkorDB persistence?
Should I use RDB or AOF for FalkorDB persistence?
For most production use cases, use both. RDB provides fast restarts and compact backups, while AOF (
appendfsync everysec) ensures at most 1 second of data loss. Combined, they offer maximum durability.What is the recommended fsync policy for AOF?
What is the recommended fsync policy for AOF?
Use
appendfsync everysec (the default). It provides a good balance between performance and durability with minimal overhead (~1-2%). Use always only for mission-critical data where zero data loss is required.How do I back up a specific graph without snapshotting the entire database?
How do I back up a specific graph without snapshotting the entire database?
Use the Redis
DUMP command on the graph key: redis-cli DUMP mygraph > mygraph.dump. This serializes just that graph for selective backup, migration, or archival.Does RDB snapshot creation affect query performance?
Does RDB snapshot creation affect query performance?
Briefly, yes. RDB uses fork() which causes a short performance degradation (milliseconds to ~1 second) on very large datasets. Between snapshots, there is no impact on normal operations.
How do I verify my persistence configuration is working?
How do I verify my persistence configuration is working?
Run
redis-cli INFO persistence to check RDB and AOF status. Look for rdb_last_save_time, aof_enabled, and aof_last_rewrite_status fields to confirm both mechanisms are active.