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

[IMPROVED] Improved time to select skip list and starting sequence number for deliver last by subject #4712

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

derekcollison
Copy link
Member

Previously we would need to move through all msg blocks and load all of the blocks into memory. We optimized this regardless to flush the cache if we loaded it like other places in the code, but for this specifically we load subject's totals which is already in memory and for each matching subject we now simply load the last message for that subject and add the sequence number to the skip list.

This drastically improves consumers that want last per subject, like KV watchers and object store lists.

Signed-off-by: Derek Collison [email protected]

Resolves: #4680

…liver last by subject.

Previously we would need to move through all msg blocks and load all of the blocks into memory.
We optimized this regardless to flush the cache if we loaded it like other places in the code, but for this specifically we load subject's totals which is already in memory and for each matching subject we now simply load the last message for that subject and add the sequence number to the skip list.

This drastically improves consumers that want last per subject, like KV watchers and object store lists.

Signed-off-by: Derek Collison <[email protected]>
@derekcollison derekcollison requested a review from a team as a code owner October 26, 2023 21:55
Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

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

LGTM

@wallyqs wallyqs merged commit 51b6a8e into main Oct 26, 2023
4 checks passed
@wallyqs wallyqs deleted the last-by-subj branch October 26, 2023 22:10
Copy link
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM

o.sseq = state.LastSeq
filters = append(filters, o.cfg.FilterSubject)
} else {
for _, filter := range o.subjf {
Copy link
Member

Choose a reason for hiding this comment

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

Could potentially preallocate filters to the length of o.subjf here.

Copy link
Member Author

Choose a reason for hiding this comment

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

This will be a small number or 1 in majority of cases.

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.

Object store - List bucket's content is very slow
3 participants