Skip to content

Improve Distributor Batching / Make Everything Better Forever#1075

Merged
joe-elliott merged 8 commits intografana:mainfrom
joe-elliott:distrib-batch-sizes
Oct 25, 2021
Merged

Improve Distributor Batching / Make Everything Better Forever#1075
joe-elliott merged 8 commits intografana:mainfrom
joe-elliott:distrib-batch-sizes

Conversation

@joe-elliott
Copy link
Copy Markdown
Collaborator

What this PR does:
Makes everything better. Like literally it makes everything better. While experimenting with service graph generation in the agent we noticed that certain batching patterns exerted significantly more or less load on Tempo. We traced that down to this code:

for _, batch := range trace.Batches {

This line is amplifying all writes that come in based on the number of batches in the incoming push. By combining these more intelligently we can get massive performance improvements. This translates to a 40% reduction in CPU usage in our largest cluster (currently consuming 2M spans/second):

image

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

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>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Copy link
Copy Markdown
Contributor

@mapno mapno left a comment

Choose a reason for hiding this comment

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

LGTM, awesome find!

Copy link
Copy Markdown
Contributor

@mdisibio mdisibio left a comment

Choose a reason for hiding this comment

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

Nice find, LGTM. Left 1 question.

Comment thread modules/distributor/distributor.go Outdated
Signed-off-by: Joe Elliott <number101010@gmail.com>
@joe-elliott joe-elliott merged commit 2743ed1 into grafana:main Oct 25, 2021
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.

3 participants