Database / REDIS
What is the difference between Redis's diskless replication and disk-based replication?
When a new replica connects (or an existing one falls too far behind to catch up incrementally), the master needs to send it a full copy of the dataset to bootstrap from, and Redis supports two different mechanisms for producing that initial transfer.
| Disk-based Replication | Diskless Replication |
| Master writes a full RDB snapshot to a local disk file first, then transfers that file to the replica. | Master streams the RDB snapshot data directly over the network socket to the replica, without writing it to local disk first. |
| Extra disk I/O and disk space needed for the temporary snapshot file. | Avoids that disk I/O and space entirely, generating the snapshot data on the fly during transfer. |
| Can be beneficial if disk I/O is fast and network is comparatively slow, since the file is ready before transfer starts. | Beneficial when disk I/O or space is the constrained resource, e.g. on cloud instances with limited or slow local disk. |
| repl-diskless-sync no | repl-diskless-sync yes |
Diskless replication is generally the better default on modern cloud infrastructure where local disk can be a scarcer or slower resource than network bandwidth, which is why it's commonly enabled in production. repl-diskless-sync-delay adds a small configurable wait before starting a diskless sync, giving multiple replicas that connect around the same time a chance to be served by a single generated snapshot stream instead of the master redundantly generating one per replica.
More Related questions...
