Skip to content

Avoid duplicate label index writes by combining LabelEntryCacheKeys and LabelWriteEntries #1435

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 1 commit into from
Jun 10, 2019

Conversation

bboreham
Copy link
Contributor

Fixes #1428

Move the write dedupe cache lookup down to schema so the labels for each bucket can be omitted if they've already been done. This avoids re-writing yesterday's labels when we write a chunk that spans the day boundary.

It's now calling the cache separately for each bucket, but I felt the loss of clarity wasn't worth optimising this.

@tomwilkie
Copy link
Contributor

Not a big fan of schema having side effects; I've always considered the schemas to be deterministic.

Perhaps having GetLabelWriteEntries return the cache keys (as this PR does) and having the filtering/checking done in the caller would be cleaner? We would need to comment on the interface that the write entries and cache entries need to be guaranteed to be the same length.

@bboreham bboreham force-pushed the optimise-label-entries branch from d904d10 to 04cc9f2 Compare June 4, 2019 14:13
@bboreham bboreham changed the title Avoid duplicate label index writes by checking buckets separately Avoid duplicate label index writes by combining LabelEntryCacheKeys and LabelWriteEntries Jun 4, 2019
@bboreham
Copy link
Contributor Author

bboreham commented Jun 4, 2019

Changed as you suggested

@bboreham
Copy link
Contributor Author

bboreham commented Jun 8, 2019

I ran this up in our staging environment, and the rate of index writes after midnight halved.

…nd LabelWriteEntries

This avoids re-writing yesterday's labels when we write a chunk that
spans the day boundary.

Signed-off-by: Bryan Boreham <[email protected]>
@bboreham bboreham force-pushed the optimise-label-entries branch from 04cc9f2 to 3cccb54 Compare June 10, 2019 10:57
Copy link
Contributor

@gouthamve gouthamve 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!

@bboreham bboreham merged commit 6ba9315 into master Jun 10, 2019
@bboreham bboreham deleted the optimise-label-entries branch June 10, 2019 12:17
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.

Avoid writing label index entries twice each day
3 participants