-
Notifications
You must be signed in to change notification settings - Fork 528
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
TBS: Optimize for ReadTraceEvents miss #13464
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
carsonip
changed the title
TBS: Reduce memory usage and disk IO by disabling PrefetchValues
TBS: Do not prefetch values for missing traces
Jun 20, 2024
Prefetching values for non-existent traces from remote apm-servers is causing mmap vlog to be read for no value, resulting in high memory usage and disk IO. Add an initial pass with PrefetchValues=false to optimize for a miss.
carsonip
force-pushed
the
tbs-memory-usage
branch
from
June 20, 2024 22:10
08ae66a
to
188986f
Compare
carsonip
changed the title
TBS: Do not prefetch values for missing traces
TBS: Optimize for ReadTraceEvents miss
Jun 20, 2024
vikmik
reviewed
Jun 20, 2024
axw
previously approved these changes
Jun 21, 2024
carsonip
force-pushed
the
tbs-memory-usage
branch
from
June 21, 2024 13:44
b39adff
to
d2716e3
Compare
axw
approved these changes
Jun 22, 2024
mergify bot
pushed a commit
that referenced
this pull request
Jun 24, 2024
When a sampling decision is received from a remote apm-server, if the trace is not stored locally, prefetching values in the iterator is causing mmap vlog to be read for no value, resulting in high memory usage and disk read IO. Add an initial pass with PrefetchValues=false to optimize for a miss in ReadTraceEvents. e.g. if there are 10 apm-servers all running TBS and synced via ES, and all transactions/spans from a trace are always sent to in 1 apm-server (i.e., a single trace never stored across multiple apm-servers), this PR should cut disk read IO related to sampling decision handling to 1/10 of before. (cherry picked from commit 2558f92)
mergify bot
added a commit
that referenced
this pull request
Jun 24, 2024
When a sampling decision is received from a remote apm-server, if the trace is not stored locally, prefetching values in the iterator is causing mmap vlog to be read for no value, resulting in high memory usage and disk read IO. Add an initial pass with PrefetchValues=false to optimize for a miss in ReadTraceEvents. e.g. if there are 10 apm-servers all running TBS and synced via ES, and all transactions/spans from a trace are always sent to in 1 apm-server (i.e., a single trace never stored across multiple apm-servers), this PR should cut disk read IO related to sampling decision handling to 1/10 of before. (cherry picked from commit 2558f92) Co-authored-by: Carson Ip <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation/summary
When a sampling decision is received from a remote apm-server, if the trace is not stored locally, prefetching values in the iterator is causing mmap vlog to be read for no value, resulting in high memory usage and disk read IO.
Add an initial pass with PrefetchValues=false to optimize for a miss in ReadTraceEvents.
e.g. if there are 10 apm-servers all running TBS and synced via ES, and all transactions/spans from a trace are always sent to in 1 apm-server (i.e., a single trace never stored across multiple apm-servers), this PR should cut disk read IO related to sampling decision handling to 1/10 of before.
Benchmark results
Since the benchmark runs badger DB with in-memory mode, I expect in reality,
hit=false after this fix
will stay the same, while all the other numbers to be 1 order of magnitude slower. i.e. the performance gain from this PR will be even greater.Checklist
- [ ] Update CHANGELOG.asciidocRequire backport release changelog- [ ] Documentation has been updatedFor functional changes, consider:
How to test these changes
See benchmark
Related issues
Closes #13463