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

Reduce stack allocations by reusing goroutines when pushing series from the distributors to the ingesters #6776

Closed
colega opened this issue Nov 29, 2023 · 1 comment · Fixed by #7128
Assignees

Comments

@colega
Copy link
Contributor

colega commented Nov 29, 2023

Is your feature request related to a problem? Please describe.

We've observed that around 5% of distributor CPU is spent calling runtime.newstack from the goroutines created by ring.DoBatch.

image

It would be nice to avoid those allocations.

Describe the solution you'd like

Ideally, this should be handled by the language itself, but it seems to be a recurring issue, ref: golang/go#18138

A workaround is to use a pool of goroutines to handle these calls, which would have their stacks reused.

Describe alternatives you've considered

Also considered growing the stack artificially using the growStack() method implementation from golang/go#18138

Steps

  • Add support to ring.DoBatch PR
  • Add -distributor.ingester-push-worker-goroutines flag to Mimir PR
  • Experiment
@colega colega self-assigned this Nov 29, 2023
@colega
Copy link
Contributor Author

colega commented Nov 30, 2023

I deployed this to our ops environment, and I can see a 7.5% reduction in CPU per request.

image

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 a pull request may close this issue.

1 participant