elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
21 stars 144 forks source link

[8.15](backport #6028) Add var generation benchmark #6116

Closed mergify[bot] closed 1 day ago

mergify[bot] commented 1 day ago

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

Related issues

elasticmachine commented 1 day ago

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

elastic-sonarqube[bot] commented 1 day ago

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube