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

Add var generation benchmark #6028

Merged
merged 1 commit into from
Nov 18, 2024
Merged

Add var generation benchmark #6028

merged 1 commit into from
Nov 18, 2024

Conversation

swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Nov 14, 2024

What does this PR do?

Add a benchmark for variable generation from provider mappings. We specifically profile having a lot of Pods from the Kubernetes provider, which is something that has recently become a problem, and which the configuration generation pipeline doesn't deal with very well. I used test data from a real environment where the problems outlined in #5991 and #5835 could be reproduced.

Results on main:

goos: linux
goarch: amd64
pkg: github.com/elastic/elastic-agent/internal/pkg/composable
cpu: 13th Gen Intel(R) Core(TM) i7-13700H
BenchmarkGenerateVars100Pods-20    	      74	  15310045 ns/op	10527199 B/op	  201283 allocs/op
BenchmarkGenerateVars100Pods-20    	      74	  15185648 ns/op	10514404 B/op	  201271 allocs/op
BenchmarkGenerateVars100Pods-20    	      86	  15126049 ns/op	10521262 B/op	  201277 allocs/op
BenchmarkGenerateVars100Pods-20    	      87	  15067870 ns/op	10514019 B/op	  201275 allocs/op
BenchmarkGenerateVars100Pods-20    	      85	  15032633 ns/op	10515568 B/op	  201274 allocs/op
BenchmarkGenerateVars100Pods-20    	      90	  15185170 ns/op	10525087 B/op	  201282 allocs/op
BenchmarkGenerateVars100Pods-20    	      75	  15345854 ns/op	10516840 B/op	  201274 allocs/op
BenchmarkGenerateVars100Pods-20    	      80	  15908398 ns/op	10518576 B/op	  201277 allocs/op
BenchmarkGenerateVars100Pods-20    	      73	  15623320 ns/op	10529545 B/op	  201284 allocs/op
BenchmarkGenerateVars100Pods-20    	      86	  15946078 ns/op	10533571 B/op	  201286 allocs/op
PASS
ok  	github.com/elastic/elastic-agent/internal/pkg/composable	12.832s

Why is it important?

I'd like to make some improvements to both the var generation and the configuration generation in the coordinator, and want a straightforward way of demonstrating their impact.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas

Related issues

@swiatekm swiatekm added skip-changelog Testing chore Tasks that just need to be done, they are neither bug, nor enhancements labels Nov 14, 2024
@swiatekm swiatekm requested a review from a team as a code owner November 14, 2024 14:25
Copy link
Contributor

mergify bot commented Nov 14, 2024

This pull request does not have a backport label. Could you fix it @swiatekm? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label to automatically backport to the 8./d branch. /d is the digit

Copy link
Contributor

mergify bot commented Nov 14, 2024

backport-v8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Nov 14, 2024
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Nov 14, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

Nice!

Really like seeing ways to quantify the improvements.

@swiatekm swiatekm added the skip-it Skips integration tests for a PR label Nov 14, 2024
Copy link
Member

@pchila pchila left a comment

Choose a reason for hiding this comment

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

Looks good.
I imagine we are going to track the results of this benchmark in PRs aimed to improve k8s variable performance but do we have plans to track changes to the benchmark results for the long term ? Are we going to rely on CI to keep track of these results ?

@swiatekm swiatekm force-pushed the chore/var-generation-benchmark branch from a321387 to dcfb0fb Compare November 18, 2024 10:55
@swiatekm
Copy link
Contributor Author

Looks good. I imagine we are going to track the results of this benchmark in PRs aimed to improve k8s variable performance but do we have plans to track changes to the benchmark results for the long term ? Are we going to rely on CI to keep track of these results ?

My impression is that this code changes infrequently enough that this wouldn't give us much benefit vs the work necessary, unless we already have a benchmark result tracking solution that would be easy to use. I was mostly hoping that whenever someone makes a change to var generation, they could run this manually.

@swiatekm swiatekm merged commit be35854 into main Nov 18, 2024
9 checks passed
@swiatekm swiatekm deleted the chore/var-generation-benchmark branch November 18, 2024 12:14
mergify bot pushed a commit that referenced this pull request Nov 18, 2024
swiatekm added a commit that referenced this pull request Nov 18, 2024
(cherry picked from commit be35854)

Co-authored-by: Mikołaj Świątek <[email protected]>
blakerouse pushed a commit to blakerouse/elastic-agent that referenced this pull request Nov 18, 2024
@swiatekm swiatekm added backport-8.15 Automated backport to the 8.15 branch with mergify backport-8.16 Automated backport with mergify backport-8.17 Automated backport with mergify labels Nov 21, 2024
@swiatekm
Copy link
Contributor Author

I thought I could avoid backporting this, but my other changes in #6058 and #6114 depend on it, so I'll have to do it.

mergify bot pushed a commit that referenced this pull request Nov 21, 2024
mergify bot pushed a commit that referenced this pull request Nov 21, 2024
swiatekm added a commit that referenced this pull request Nov 21, 2024
(cherry picked from commit be35854)

Co-authored-by: Mikołaj Świątek <[email protected]>
swiatekm added a commit that referenced this pull request Nov 21, 2024
(cherry picked from commit be35854)

Co-authored-by: Mikołaj Świątek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify backport-8.15 Automated backport to the 8.15 branch with mergify backport-8.16 Automated backport with mergify backport-8.17 Automated backport with mergify chore Tasks that just need to be done, they are neither bug, nor enhancements skip-changelog skip-it Skips integration tests for a PR Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants