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

shards: only trigger rescan on .zoekt files changing #801

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

keegancsmith
Copy link
Member

Any write to the index dir triggered a scan. This means on busy instances we are constantly rescanning, leading to an over-representation in CPU profiles around watch. The events are normally writes to our temporary files. By only considering events for .zoekt files (which is what scan reads) we can avoid the constant scan calls.

Just in case we also introduce a re-scan every minute in case we miss an event. There is error handling around this, but I thought it is just more reliable to call scan every once in a while.

Note: this doesn't represent significant CPU use, but it does muddy the CPU profiler output. So this makes it easier to understand trends in our continuous cpu profiling.

Test Plan: CI

@keegancsmith keegancsmith requested a review from a team August 2, 2024 09:32
@cla-bot cla-bot bot added the cla-signed label Aug 2, 2024
Any write to the index dir triggered a scan. This means on busy
instances we are constantly rescanning, leading to an
over-representation in CPU profiles around watch. The events are
normally writes to our temporary files. By only considering events for
.zoekt files (which is what scan reads) we can avoid the constant scan
calls.

Just in case we also introduce a re-scan every minute in case we miss an
event. There is error handling around this, but I thought it is just
more reliable to call scan every once in a while.

Note: this doesn't represent significant CPU use, but it does muddy the
CPU profiler output. So this makes it easier to understand trends in our
continuous cpu profiling.

Test Plan: CI
}
}

ticker := time.NewTicker(time.Minute)
Copy link
Member

Choose a reason for hiding this comment

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

That seems fairly frequent for a fail-safe? Isn't this roughly in the order of magnitude we scanned before this PR? I might be totally off though ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

We are always scanning right now on dotcom. IE as soon as one scan is done another starts. The scanning doesn't take long (~50ms?) but effectively we do this for { scan() }. So once a minute seems good?

@keegancsmith keegancsmith merged commit acacc5e into main Aug 2, 2024
9 checks passed
@keegancsmith keegancsmith deleted the k/use-events branch August 2, 2024 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants