-
Notifications
You must be signed in to change notification settings - Fork 595
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
feat(storage): separate key and values in imm to reduce allocation #15300
Conversation
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.
the new structure LGTM, and I think you may conduct a perf test to check the improvement.
&values[entries[i].value_offset | ||
..entries | ||
.get(i + 1) | ||
.map(|entry| entry.value_offset) |
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.
clever trick to use next entry as end offset 😄
added a benchmark main
this branch
|
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Previously, to store values of multiple versions of a key in imm, we use a two-dimensional vector to store the values, where the outer vector stores all entries and each inner vector stores the multi-version values. However, each inner vector is small, and when imm merge is disabled, each inner vector only stores a single value, which involves unnecessary vector allocation. In this PR, we change to store the values of multi-version of all keys in a single vector. Each key entry will store an extra value offset to indicate the starting offset of its own values. The end offset is the value offset of the next entry, or the vector end if the current entry is the last one.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.