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

Merged
merged 1 commit into from
Dec 9, 2024
Merged

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)

@swiatekm swiatekm force-pushed the chore/config-gen-benchmark branch from bc3a83d to e004ea1 Compare December 2, 2024 14:39
@swiatekm swiatekm added skip-ci and removed skip-ci labels Dec 2, 2024
@swiatekm swiatekm force-pushed the chore/config-gen-benchmark branch from e004ea1 to d132329 Compare December 2, 2024 16:14
@swiatekm swiatekm force-pushed the chore/config-gen-benchmark branch from d132329 to a20b23c Compare December 3, 2024 11:13
@swiatekm
Copy link
Contributor Author

swiatekm commented Dec 3, 2024

Needless to say, the unit test failure is unrelated, though it seems strangely consistent in this PR. Looks like a repeated instance of #5938.

@swiatekm swiatekm force-pushed the chore/config-gen-benchmark branch from a20b23c to a2ed4fa Compare December 3, 2024 16:37
Copy link

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.

+1

@swiatekm swiatekm merged commit b3bb590 into main Dec 9, 2024
9 checks passed
@swiatekm swiatekm deleted the chore/config-gen-benchmark branch December 9, 2024 15:59
mergify bot pushed a commit that referenced this pull request Dec 9, 2024
(cherry picked from commit b3bb590)

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator_test.go
mergify bot pushed a commit that referenced this pull request Dec 9, 2024
mergify bot pushed a commit that referenced this pull request Dec 9, 2024
(cherry picked from commit b3bb590)

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator_test.go
swiatekm added a commit that referenced this pull request Dec 9, 2024
(cherry picked from commit b3bb590)

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator_test.go
swiatekm added a commit that referenced this pull request Dec 9, 2024
(cherry picked from commit b3bb590)

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator_test.go
swiatekm added a commit that referenced this pull request Dec 9, 2024
(cherry picked from commit b3bb590)

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator_test.go
swiatekm added a commit that referenced this pull request Dec 9, 2024
(cherry picked from commit b3bb590)

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

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator_test.go

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

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator_test.go
swiatekm added a commit that referenced this pull request Dec 13, 2024
(cherry picked from commit b3bb590)

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator_test.go

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.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.

4 participants