Repository navigation
Conversation
- move chunked sending into FetchSender, which reads the next chunk while the client applies the current one and sends it before handing back the accepted ids, so clearing pending ids no longer stalls the client - split fetch duration into server and client time, labelled full or incremental - write a device's LastAccessTime at most every 5 minutes, and skip the call when the loaded device is recent - reuse the loaded device instead of reading it again, skip monograph and inbox queries when there are no ids of that type, and only clear IsSyncReset when it was set
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.
After #116–#118, the fetch tail in prod stayed where it was. Two things in MongoDB's slow-op log explain most of it:
LastAccessTime. A device's concurrent calls conflicted on that one document, with ~10 write conflicts per slow update and ~434ms on average.The fetch duration metric couldn't tell any of this apart from a slow client, because it includes the time the client spends applying each chunk.
Changes
FetchSender(new): the chunked sending moved out of the hub, along with sending monographs and inbox items.sync.v2.fetch_server_durationandsync.v2.fetch_client_duration, next to the existingsync.v2.fetch_duration, all labelledkind=fullorincremental.LastAccessTime: written at most every 5 minutes. Devices are only pruned after months without a sync. On fetch, the call is skipped entirely when the device just loaded is recent.IsSyncResetis only cleared when it was set. This also stops a fetch from clearing the flag of a device that re-registered while it ran.Nothing changes for clients: the hub protocol and the messages sent are the same.
Testing
dotnet test tests/Notesnook.API.Tests -c Release: 153/153 pass, three runs in a row. New tests cover:FetchSenderTests: read-ahead, a chunk not kept alive while the client applies it, the next chunk going out before ids are handed back, rejected chunks and other items, and client timing.kindlabel.LastAccessTimethrottle.