-
Notifications
You must be signed in to change notification settings - Fork 524
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
Ingester memory improvements by adjusting prealloc #4344
Conversation
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
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.
Looks good to me. The new metric ought to be interesting.
return p.make(sz) | ||
|
||
// Find the right bucket. | ||
bkt := sz / p.bktSize |
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.
I suppose its a trad-off here to alloc or do the math twice.
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.
this doesn't really "alloc" in any way we are concerned about. we're always conscious of allocating memory that escapes to the heap. everything else is cheap. whether this is stored on the stack of just stays in a register it would likely be undetectable from a tempo perf standpoint.
|
||
b := p.buckets[bkt].Get() | ||
if b == nil { | ||
sz := (bkt + 1) * p.bktSize |
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.
Does this alloc, or is the compiler smart enough to see its only used once?
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.
you're really testing my knowledge of compilers :). my guess is this value would never leave a register
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.
You can do escape analysis in Go with go build -gcflags "-m" <file>
. It does not escape :P
This PR must be merged before a backport PR will be created. |
1 similar comment
This PR must be merged before a backport PR will be created. |
* remove trace ids Signed-off-by: Joe Elliott <number101010@gmail.com> * linear buckets Signed-off-by: Joe Elliott <number101010@gmail.com> * changelog Signed-off-by: Joe Elliott <number101010@gmail.com> * tuney tune Signed-off-by: Joe Elliott <number101010@gmail.com> * metric misses and increase pool size Signed-off-by: Joe Elliott <number101010@gmail.com> * lint Signed-off-by: Joe Elliott <number101010@gmail.com> --------- Signed-off-by: Joe Elliott <number101010@gmail.com> (cherry picked from commit f71c4c6)
* remove trace ids Signed-off-by: Joe Elliott <number101010@gmail.com> * linear buckets Signed-off-by: Joe Elliott <number101010@gmail.com> * changelog Signed-off-by: Joe Elliott <number101010@gmail.com> * tuney tune Signed-off-by: Joe Elliott <number101010@gmail.com> * metric misses and increase pool size Signed-off-by: Joe Elliott <number101010@gmail.com> * lint Signed-off-by: Joe Elliott <number101010@gmail.com> --------- Signed-off-by: Joe Elliott <number101010@gmail.com> (cherry picked from commit f71c4c6) Co-authored-by: Joe Elliott <number101010@gmail.com>
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-4344-to-r174 origin/r174
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x f71c4c6ccbd81b75826b434d6bf2b82174a757c5 When the conflicts are resolved, stage and commit the changes:
If you have the GitHub CLI installed: # Push the branch to GitHub:
git push --set-upstream origin backport-4344-to-r174
# Create the PR body template
PR_BODY=$(gh pr view 4344 --json body --template 'Backport f71c4c6ccbd81b75826b434d6bf2b82174a757c5 from #4344{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title '[r174] Ingester memory improvements by adjusting prealloc' --body-file - --label 'type/bug' --label 'backport' --base r174 --milestone r174 --web Or, if you don't have the GitHub CLI installed (we recommend you install it!): # Push the branch to GitHub:
git push --set-upstream origin backport-4344-to-r174
# Create a pull request where the `base` branch is `r174` and the `compare`/`head` branch is `backport-4344-to-r174`.
# Remove the local backport branch
git switch main
git branch -D backport-4344-to-r174 |
* remove trace ids Signed-off-by: Joe Elliott <number101010@gmail.com> * linear buckets Signed-off-by: Joe Elliott <number101010@gmail.com> * changelog Signed-off-by: Joe Elliott <number101010@gmail.com> * tuney tune Signed-off-by: Joe Elliott <number101010@gmail.com> * metric misses and increase pool size Signed-off-by: Joe Elliott <number101010@gmail.com> * lint Signed-off-by: Joe Elliott <number101010@gmail.com> --------- Signed-off-by: Joe Elliott <number101010@gmail.com> (cherry picked from commit f71c4c6)
* remove trace ids Signed-off-by: Joe Elliott <number101010@gmail.com> * linear buckets Signed-off-by: Joe Elliott <number101010@gmail.com> * changelog Signed-off-by: Joe Elliott <number101010@gmail.com> * tuney tune Signed-off-by: Joe Elliott <number101010@gmail.com> * metric misses and increase pool size Signed-off-by: Joe Elliott <number101010@gmail.com> * lint Signed-off-by: Joe Elliott <number101010@gmail.com> --------- Signed-off-by: Joe Elliott <number101010@gmail.com> (cherry picked from commit f71c4c6)
What this PR does:
Adjusts the use of prealloc for some nice memory improvements. Two adjustments were made:
Seeing ~30% working set reduction in ingesters.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]