Skip to content
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

Implement a proper b-tree #596

Closed
aboodman opened this issue Sep 29, 2021 · 0 comments · Fixed by #610
Closed

Implement a proper b-tree #596

aboodman opened this issue Sep 29, 2021 · 0 comments · Fixed by #610
Assignees
Milestone

Comments

@aboodman
Copy link
Contributor

aboodman commented Sep 29, 2021

Replicache was designed from the beginning to utilize an append-only/immutable tree data structure internally for good performance.

In our early prototyping and discovery phase we skipped implementing this to focus more on the product and to give time to think about exactly what the right data structure was. Right now Replicache simply copies its entire internal dataset on every mutation. This works kind of surprisingly well, given how absurdly inefficient it is, but obviously can't stand.

Now that we have lots of customer feedback and know where we're going, it's time to do this properly so that we can hit our local perf goals (see rocicorp/mono#134).

Thinking on the right data structure has converged on a merkle b+ tree. See design doc for details: https://docs.google.com/document/d/1RCsz5cBxaD4Xny5Pda5ONkdujxcUJfcfTrWF--yx744/edit?usp=sharing

@aboodman aboodman added this to the Replicache Offline-First milestone Sep 29, 2021
@arv arv self-assigned this Oct 12, 2021
@aboodman aboodman mentioned this issue Oct 20, 2021
4 tasks
@arv arv closed this as completed in #610 Oct 26, 2021
arv added a commit that referenced this issue Oct 26, 2021
This adds a B+Tree that we use instead of the prolly tree. The old prolly tree was not actually using a prolly tree but a flat array of entries. That meant that we read and wrote all the data on every transaction which of course is not very fast.

With a B+Tree we only load the parts of the Map that you are interested in.

The current target chunk size is 8kb (min is 8kb and max is 16kb)

Fixes #596
arv added a commit to arv/replicache that referenced this issue Nov 1, 2021
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 a pull request may close this issue.

2 participants