On this page
Short answer
A Valkey replica falls back to a full resync when the primary's replication backlog no longer holds the data it missed. It loops when the sync itself cannot finish, usually because the replica output buffer limit is hit while the snapshot is sent. Size repl-backlog-size to write rate times the longest outage you want to survive, then check client-output-buffer-limit replica and latest_fork_usec.
A Valkey replica does a full resync when the primary's replication backlog no longer holds the data the replica missed. It loops when the full sync cannot finish, usually because the replica's output buffer on the primary hits its limit while the snapshot is being sent. Size repl-backlog-size to write rate times your longest tolerated outage, then check the buffer limit and fork time. Settings below are from the Valkey replication topic and the valkey.conf reference, read 3 December 2026.
If a cluster is already in this loop and writes are suffering, our valkey consulting engineers start from the same INFO fields.
When does a replica need a full resync instead of a partial one?
After a disconnect, the replica sends its replication ID and offset with PSYNC. The primary can answer with only the missing bytes if they are still in its backlog. The primary falls back to a full resync when its buffers no longer hold the missing bytes, or when it does not recognise the replica's replication ID. After a failover the promoted replica keeps the old primary's ID as a secondary ID, so other replicas can usually still resync partially.
The default repl-backlog-size is 10mb. On a primary taking even modest writes, 10mb covers a short blip, not a failed deploy or a network flap. The backlog is allocated only when at least one replica is connected, and repl-backlog-ttl (default 3600 seconds) controls when it is freed after the last replica leaves.
How do you size repl-backlog-size?
- Measure the write rate. Read
master_repl_offsetfromINFO replicationtwice during peak load, a minute apart, and divide the difference by the elapsed seconds. - Choose the outage window. The longest disconnect you want to recover from without a full copy, such as a 10-minute maintenance restart.
- Multiply and add headroom. Example: 5 MB a second for 600 seconds is 3,000 MB, so a backlog near 3.5 GB leaves room for bursts. The numbers here are arithmetic, not a recommendation for your workload.
- Check memory. The backlog is memory on the primary on top of the dataset, so confirm
maxmemorystill fits.
Afterwards compare repl_backlog_histlen with repl_backlog_size. When the history is always full and sync_full keeps climbing, the backlog is too small.
Why does a full sync loop?
A full sync takes a snapshot and sends it. By default repl-diskless-sync is yes and repl-diskless-sync-delay is 5 seconds, so the primary waits briefly for more replicas to join before it forks. While the snapshot transfers, the primary keeps buffering new writes for that replica. The default client-output-buffer-limit replica 256mb 64mb 60 means a hard limit of 256mb, or a soft limit of 64mb held for 60 seconds. If either trips, the primary closes the connection, and the replica must begin again. The valkey.conf comments add that a replica limit smaller than repl-backlog-size is ignored and the backlog size is used.
A slow fork makes it worse. latest_fork_usec in INFO stats shows how long the last fork took, in microseconds. A large dataset on a busy host can take long enough that the buffer fills before the snapshot is even sent.
| INFO field | Section | What it tells you |
|---|---|---|
master_repl_offset | replication | Bytes written; sample twice for the write rate |
repl_backlog_size | replication | Configured backlog size |
repl_backlog_histlen | replication | How much history the backlog holds now |
repl_backlog_first_byte_offset | replication | Oldest offset a replica can still resume from |
sync_full | stats | Count of full resyncs; rising means loops |
sync_partial_ok / sync_partial_err | stats | Partial resyncs accepted or refused |
latest_fork_usec | stats | Duration of the last fork |
What are the options if the loop continues?
- Raise
client-output-buffer-limit replicato cover the writes made during one snapshot transfer. - Reduce write traffic during planned resyncs, for example by pausing a batch job.
- Try dual-channel replication.
dual-channel-replication-enabledis documented from Valkey 8.0, defaults tonoand must beyeson both primary and replica. The replica receives the snapshot on one connection and buffers the write stream itself. Test it first on a non-production pair. - Sample on a schedule. Alert when
sync_fullrises and whenrepl_backlog_histlenstays equal torepl_backlog_size.
Memory pressure while moving data is a related problem, covered in our Valkey memory pressure remediation use case.
Sources
- Replication, valkey.io, read 3 December 2026.
- valkey.conf, valkey-io/valkey on GitHub, read 3 December 2026.
- INFO, valkey.io, read 3 December 2026.
Frequently Asked Questions
Why does my Valkey replica keep doing a full resync?
A partial resync works only while the replica's offset is still inside the primary's backlog. With the default 10mb repl-backlog-size, a busy primary overwrites that history quickly, so a short disconnect can force a full resync. Raise the backlog to cover write rate times the longest outage.
How big should repl-backlog-size be?
Multiply the primary's write rate in bytes per second by the longest disconnect you want a partial resync to survive, then add headroom. Measure the write rate by sampling master_repl_offset twice and dividing the difference by the seconds between samples.
What causes a full resync loop?
The sync starts, the primary buffers new writes for the replica, and the buffer passes client-output-buffer-limit replica. The primary drops the link and the replica has to begin the sync again. Raise the limit, reduce write traffic during the sync, or try dual-channel replication.
Talk to an engineer
Need a hand with Valkey?
Senior engineers who run it in production. Get a quote or a free consultation, no sales pitch.

