Repository navigation
sync: cut fetch memory and drop the MessagePack protocol - #116
Merged
Merged
Conversation
…mid-fetch resets Rejections are logged at Information, which production filters out, so a counter by stage is what shows them. Also drops a catch around the no-op Hub.OnDisconnectedAsync.
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.
Fetches used to hold a whole cursor batch of decoded
SyncItems, with every cipher turned into a UTF-16 string, while the client applied each chunk. On prod, the sync servers run a full (gen2) GC about every 20s per replica, which points to large-object churn on this path.Changes
_ids plus a server-computed$bsonSize, capped at 3MB and 500 items. Each chunk is then loaded by_idasRawSyncItem, which keeps the stored BSON bytes and writes JSON straight from them. Clients get the same JSON, byte for byte (seeRawSyncItemTests). The server holds only the chunk awaiting an ack (seeSyncV2HubSignalRTests)./hubs/sync/v2is mapped. Clients have usedJsonHubProtocolsince 2.6.17 (Mar 2024), and v2 hub clients are all newer than that.disconnected,timeout,client_errororserver_error.HubConnectionHandlerlogged each one (e.g. unconfirmed emails, about 1/s on prod) as an error. Its logging is now off, andSyncAuthorizationHubFilterlogs rejections at Info and unexpected failures at Error. Production filters out Info, so a newsync.v2.connection_rejectionscounter, labelledreason, is what shows rejections:unauthorized,account(deleted or reset),huborerror.Testing
dotnet test tests/Notesnook.API.Tests -c Release: 111/111 pass.After deploy, watch
_id, and full syncs read each document twice (measured at about 1.2× storage reads under cache pressure).sync_v2_fetch_failures_fetches_totalbyreason. Failures are 0.13% of fetches today, with no breakdown.sync_v2_connection_rejectionsbyreason. Expect about 1/s ofunauthorized, from clients with unconfirmed emails.