Skip to content

Reduce allocs in query path#3901

Merged
joe-elliott merged 3 commits intografana:mainfrom
joe-elliott:less-mem
Jul 26, 2024
Merged

Reduce allocs in query path#3901
joe-elliott merged 3 commits intografana:mainfrom
joe-elliott:less-mem

Conversation

@joe-elliott
Copy link
Copy Markdown
Collaborator

What this PR does:
Reduces allocs incurred by calling .Query() repeatedly. This method allocs a map under the hood. Benchmarks attached only address the frontend side of the improvements. The querier side would also be quite dramatic.

goos: darwin
goarch: arm64
pkg: github.com/grafana/tempo/modules/frontend
                  │  before.txt  │           after.txt           │
                  │    sec/op    │    sec/op     vs base         │
SearchPipeline-11   608.1m ± ∞ ¹   606.9m ± ∞ ¹  ~ (p=0.310 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

                  │   before.txt   │              after.txt               │
                  │      B/op      │     B/op       vs base               │
SearchPipeline-11   10.645Mi ± ∞ ¹   9.149Mi ± ∞ ¹  -14.05% (p=0.008 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

                  │  before.txt  │             after.txt              │
                  │  allocs/op   │  allocs/op    vs base              │
SearchPipeline-11   163.0k ± ∞ ¹   151.2k ± ∞ ¹  -7.24% (p=0.008 n=5)
¹ need >= 6 samples for confidence interval at level 0.95

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>
Comment thread pkg/api/query_builder.go
Comment thread pkg/api/http.go
Copy link
Copy Markdown
Contributor

@ie-pham ie-pham left a comment

Choose a reason for hiding this comment

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

really cool PR 👍

@joe-elliott joe-elliott merged commit 296abfc into grafana:main Jul 26, 2024
@joe-elliott joe-elliott mentioned this pull request Jul 26, 2024
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