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 config generation benchmark #6180

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Dec 2, 2024

What does this PR do?

Add a benchmark for config generation in the coordinator. 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.

From profiling the live agent experiencing these issues, this benchmark covers the most expensive parts, so it should be representative.

Current results on main:

goos: linux
goarch: amd64
pkg: github.com/elastic/elastic-agent/internal/pkg/agent/application/coordinator
cpu: 13th Gen Intel(R) Core(TM) i7-13700H
BenchmarkCoordinator_generateComponentModel-20    	      30	  36693604 ns/op	35875285 B/op	  810689 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      28	  37448198 ns/op	35886685 B/op	  810670 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      27	  37193185 ns/op	35867024 B/op	  810650 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      22	  47190285 ns/op	35865402 B/op	  810526 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      31	  59598417 ns/op	35889725 B/op	  810712 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      31	  38748898 ns/op	35890251 B/op	  810715 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      28	  38338585 ns/op	35878466 B/op	  810667 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      27	  38126388 ns/op	35889337 B/op	  810647 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      31	  37849710 ns/op	35884377 B/op	  810712 allocs/op
BenchmarkCoordinator_generateComponentModel-20    	      27	  37850712 ns/op	35882968 B/op	  810648 allocs/op
PASS
ok  	github.com/elastic/elastic-agent/internal/pkg/agent/application/coordinator	24.152s

Why is it important?

I'd like to make some improvements to 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 enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog skip-it Skips integration tests for a PR backport-8.15 Automated backport to the 8.15 branch with mergify backport-8.x Automated backport to the 8.x branch with mergify backport-8.16 Automated backport with mergify backport-8.17 Automated backport with mergify labels Dec 2, 2024
@swiatekm swiatekm removed the backport-8.15 Automated backport to the 8.15 branch with mergify label Dec 2, 2024
@swiatekm swiatekm force-pushed the chore/config-gen-benchmark branch 2 times, most recently from 7ec41a2 to bc3a83d Compare December 2, 2024 13:43
@swiatekm swiatekm marked this pull request as ready for review December 2, 2024 13:43
@swiatekm swiatekm requested a review from a team as a code owner December 2, 2024 13:43
@elasticmachine
Copy link
Contributor

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

Copy link

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.16 Automated backport with mergify backport-8.17 Automated backport with mergify enhancement New feature or request skip-changelog skip-it Skips integration tests for a PR Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants