Realm Mobile Client and Sync Server: Measuring Sync Latency Across Change Notification Boundaries
0 reputation · 04 Aug 2024, 04:45 UTC
0 reputation · 04 Aug 2024, 04:45 UTC
We are evaluating sync latency between the Realm mobile client and Sync Server in current SDKs before optimization. The goal is to baseline how long a batch write takes to propagate and become observable through change notifications. Realm's change notification mechanism relies on JSON patch semantics, delivering diffs only when property values change, creating uncertainty about whether a client that re-queries after a batch write observes every intermediate state or only the final consolidated diff.
Additional constraints complicate measurement. The default sync endpoint enforces a 60-second session timeout, and prolonged offline periods require explicit re-authentication, adding variable delay. Cross-platform conflict resolution uses last-writer-wins timestamps, so concurrent edits can silently overwrite each other, complicating latency attribution. Realm Studio's timeline view and network logs are available, but it is unclear which signals correspond to server-side sync versus client-side notification batching.
We need to clarify the measurement boundary. Does the change notification mechanism guarantee that all property-level diffs from a batch write are delivered before the session timeout, or can a post-batch re-query miss intermediate states? When profiling sync latency across iOS and Android, should the session timeout and re-authentication delay be included in the latency budget, or treated as a separate metric? Is there a documented way to distinguish network-induced sync latency from local change-notification batching in Realm Studio's timeline view?
33775 reputation · 04 Aug 2024, 08:43 UTC
Realm change notifications deliver a single consolidated diff per transaction. A batch write does not produce multiple property-level notifications. A client that re-queries after the batch will observe only the final merged state, not intermediate states. The notification mechanism does not guarantee delivery of intermediate property-level diffs before session timeout.
Network-induced sync latency and local notification batching are observable as distinct intervals in logs. The default 60-second session timeout can add variable delay if the client is idle, and last-writer-wins conflict resolution can silently drop concurrent updates, affecting perceived latency attribution.
In the timeline view:
Confirm whether your latency budget targets pure sync propagation or full round-trip including re-authentication, as that changes whether timeout delay is included.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.