This repository was archived by the owner on Sep 19, 2019. It is now read-only.
12274 - Reduce sync delay for small databases#2
Merged
Conversation
If the replication completes in this batch, the process will exit
normally. If not, the reason will be {pending_changes, N} and will
be logged at 'warn' level. mem3_sync will then push the replication
back into the queue.
BugzID: 12274
BugzID: 12274
smithsz
pushed a commit
that referenced
this pull request
Feb 11, 2015
- Remove the ability to set batch_count 'all' - Add an additional go/1 clause to handle batch_size = 0 case
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
It's a little hacky, but I think the end result is positive. The idea is to replicate at most 100 updates to a database shard at a time, then move on to the next shard in the queue. If the shard has pending changes waiting to be synced it gets re-inserted into the waiting queue. I also refactored the internal data structures in mem3_sync so that we could track the total number of pending changes (i.e., the backlog) as the server reaches a steady state.
A alternative design might be to have mem3_rep return {ok, PendingChanges} every time, and make that sure that PendingChanges always bubbles up to the sync server. Current approach is to exit(normal) when PendingChanges == 0. We could also make the batch size (100) and the number of batches (1) configurable, though I don't see an immediate need for it. The batch size is kept small at the moment so that the replicator makes progress even on heavily loaded shards.