Skip to content

Persist Checksums #26

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

Merged
merged 4 commits into from
Sep 19, 2024
Merged

Persist Checksums #26

merged 4 commits into from
Sep 19, 2024

Conversation

rkistner
Copy link
Contributor

@rkistner rkistner commented Sep 9, 2024

Incrementally maintain bucket checksums to improve performance when syncing a large number of rows. The effect can be quite noticeable with 100k+ synced rows, and to a smaller extent from 10k+ rows already.

Additionally, reduce the cases where a "compact" (removing REMOVE operations) is performed.

This does not change any of the consistency properties. Any change in server-side checksums, such as after sync rule changes, will still be detected.

Manually deleting a row from the local ps_oplog table will not be detected after this change. We could add a full checksum validation to test for those cases.

This includes a migration for two new columns on ps_buckets. The down migration can be used to revert back to v0.2.0 without issue.

Benchmarks

Flutter app, Linux desktop.

Start with 500k PUT operations, then time the latency of syncing 1 PUT or REMOVE operation.

Latency is timed from the client receiving the new checkpoint, to the changes being fully applied locally.

Before: ~860ms
After: ~3ms
After, REMOVE operation: ~300ms

REMOVE operations are still expensive due to the compact performed afterwards. The compact can be performed only if there are a high number of REMOVE operations, which will amortize the cost (added as a new option to the clear_remove_ops operation). To completely remove the need for the compact operation, see #27.

Release note

This will likely be released as part of #27, rather than as a standalone release.

@rkistner rkistner changed the title Checksum Caching Persist Checksums Sep 10, 2024
@rkistner rkistner marked this pull request as ready for review September 19, 2024 12:33
Copy link
Contributor

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@rkistner rkistner merged commit 4b4cd99 into main Sep 19, 2024
17 checks passed
@rkistner rkistner deleted the caching-checksums branch September 19, 2024 14:24
@rkistner rkistner mentioned this pull request Sep 19, 2024
@rkistner rkistner mentioned this pull request Oct 3, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants