Ensure Client.Deactivate on browser close for better GC
Closed this issue · 2 comments
What would you like to be added:
CodePair editor uses yorkie.Text
, and during recent performance tests, we observed that as the amount of editing increases, the response time for PushPullChanges
becomes slower. This issue was analyzed, revealing that yorkie.Text
, based on RGA, has tombstones to execute simultaneously occurring operations. Even if content is deleted from editor, the tombstones occupy space, and while Yorkie implements GC mechanism to manage this, the effectiveness of GC relies on detaching clients that are no longer editing.
To ensure more effective GC, we need to guarantee the execution of Client.Deactivate
upon browser closure. Since browser termination may happen unexpectedly, I suggest utilizing navigator.sendBeacon
or fetch() with the keepalive
option to implement this.
For reference, see the discussion about sending HTTP requests on page exit: Reliably Send an HTTP Request as a User Leaves a Page
Why is this needed:
Additional Information:
I’m not sure I fully understand.
Are you suggesting that client.deactivate
should be translated into a REST API call using fetch()
or sendBeacon
?
Could you provide more explanation?
Related to yorkie-team/yorkie-js-sdk#928.