-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce the memory footprint of an automatic reset #6567
Conversation
The sync history can be short circuited because it will be discarded right after `transfer_group()`
// away immediately after anyways. This reduces the memory footprint of a client reset. | ||
ClientReplication* client_repl = dynamic_cast<ClientReplication*>(group_dst.get_replication()); | ||
REALM_ASSERT_RELEASE(client_repl); | ||
client_repl->set_short_circuit(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TempShortCircuitReplication
is a helper to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just what I needed, thanks! Updated.
Looks good - thanks for looking into this! We'll see about creating another build tomorrow to see if this helps the customer. |
Incidentally, this also improves performance in cases where the difference of the fresh Realm to the local Realm requires many changes. Running the object-store client reset benchmarks showed improvements in the following scenarios:
|
The sync history can be short circuited because it will be discarded right after
transfer_group()
I made a temporary client reset test that inserted a bunch of large strings on the server state so that transfer_group had to insert them and recorded the memory use before and after using
/usr/bin/time -l ./test/object-store/realm-object-store-tests.app/Contents/MacOS/realm-object-store-tests "sync: client reset" -c "recovery" -c "insert" -d yes
The amount of memory difference will vary widely based on the actual data, but I take the following improvement from my synthetic test to be an indication of improvement:
Before:
17581760 peak memory footprint
After:
13338304 peak memory footprint