Repository navigation
fix: let replicas keep up with the primary under write load - #455
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under write load every replica fell into a resync loop. Measured with 1.26M keys loaded and 50 clients writing at a pipeline of 16, on one 32-core machine:
Changes:
REPLICA_QUEUE_LIMIT). writes during a full sync wait there. past the cap the replica gets MSG_RESYNC at once, without the stale backlog. the writer flushes only when the queue is emptyReplicationEvent, as the AOF does. every broadcast send locks the channel, which held the primary to about 600k writes a second with a replica attached. the wire protocol is unchangedconnected_replicascounts the replicas streaming from the primary. it counted those gossip had reported, which read 0 while one streamed. a newsync_fullfield counts full syncsSame load, before and after:
A cluster without replicas is unchanged or slightly faster: 2.43M SET at P=16, against 2.28M.
The new integration test shrinks the broadcast channel to 1,024 events and writes 100,000 INCRs during a full sync. Against main's server it fails: the replica is missing the counter after WAIT returns 1.