Persistence
RDB snapshots + AOF append-only file — Redis-compatible persistence with near-zero overhead
SoliKV supports two complementary persistence mechanisms, matching Redis defaults. AOF is enabled by default with appendfsync everysec, losing at most ~1 second of data on crash. RDB snapshots are saved every 5 minutes as a safety net.
How It Works
AOF (Append-Only File)
- 1. Every write command is RESP-serialized on the caller thread
- 2. Serialized bytes are sent through a 256K bounded channel (lock-free)
- 3. Background task batch-drains the channel into a 64KB BufWriter
- 4. fsync is called per the configured policy (always/everysec/no)
RDB (Snapshots)
- 1. Full point-in-time snapshot of all data per shard
- 2. Background task saves every 300 seconds
- 3. Atomic write via temp file + rename (crash-safe)
- 4. Final snapshot saved on graceful shutdown (CTRL-C)
Startup Sequence
-
1
Load RDB snapshots — Each shard's RDB file is loaded to restore the base state
-
2
Replay AOF — Commands from the AOF are replayed on top of the RDB state to bring data up to date
-
3
Open AOF writer — New write commands start being logged to the AOF
-
4
Start serving — RESP and REST servers begin accepting connections
Fsync Policies
| Policy | Durability | Performance | Use case |
|---|---|---|---|
| always | Every write fsynced | Slowest | Maximum durability |
| everysec | Fsync every 1 second | Near-zero overhead | Default. Lose at most ~1s on crash |
| no | OS decides when to flush | Fastest | Maximum performance, data at risk |
Configuration
Persistence Commands
| Command | Syntax | Description |
|---|---|---|
| SAVE | SAVE | Synchronous RDB save (blocks until complete) |
| BGSAVE | BGSAVE | Background RDB save |
| BGREWRITEAOF | BGREWRITEAOF | Rewrite AOF from current state (compaction) |
Lock-Free AOF Performance
SoliKV's AOF uses a channel-based architecture that eliminates mutex contention on the hot path. Write commands are RESP-serialized on the caller thread and sent through a bounded channel to a dedicated I/O task.
Migrating from Redis
SoliKV can import standard Redis dump.rdb snapshot files at startup. This lets you migrate from Redis without re-inserting all your data.
Supported Types
- ✓ Strings
- ✓ Lists (plain, ziplist, quicklist, quicklist v2)
- ✓ Sets (plain, intset, listpack)
- ✓ Sorted Sets (plain, ziplist, listpack, binary scores)
- ✓ Hashes (plain, ziplist, listpack)
- ✓ LZF compressed values
- ✓ Key expiry (absolute timestamps, ms precision)
Skipped (with warning)
- — Streams
- — Modules
- — Hash with per-field expiry (Redis 7.4+)
Unsupported keys are skipped and logged. All other keys are imported normally.