Repository navigation
management: stop converting the whole unit config for every stream - #53726
Merged
shahzad31 merged 3 commits intoNov 9, 2026
Merged
Conversation
injectGlobalProcesssors called expected.GetSource().AsMap() for each stream. The source of a unit holds all of its streams, so converting it for every stream made building the inputs of a unit quadratic in its stream count. Elastic Agent builds this config several times at startup, and with 10k Synthetics streams in one component it spent about 140s doing so before it started the collector. Only the global processors are needed, so convert just that field. Injecting processors into every stream of a unit with 8000 streams drops from 8.1s to 3ms. With 10k streams the agent now starts the collector 4s after it starts, down from about 143s.
|
This pull request doesn't have a |
Contributor
🤖 GitHub commentsJust comment with:
|
Contributor
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
This was referenced Oct 13, 2026
shahzad31
marked this pull request as ready for review
November 3, 2026 11:34
orestisfl
approved these changes
Nov 3, 2026
orestisfl
reviewed
Nov 3, 2026
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Contributor
|
@Mergifyio backport 9.6 9.5 9.4 |
Contributor
✅ Backports have been createdDetails
|
This was referenced Nov 9, 2026
Merged
Merged
shahzad31
added a commit
that referenced
this pull request
Nov 16, 2026
…53726) (#54587) * management: stop converting the whole unit config for every stream injectGlobalProcesssors called expected.GetSource().AsMap() for each stream. The source of a unit holds all of its streams, so converting it for every stream made building the inputs of a unit quadratic in its stream count. Elastic Agent builds this config several times at startup, and with 10k Synthetics streams in one component it spent about 140s doing so before it started the collector. Only the global processors are needed, so convert just that field. Injecting processors into every stream of a unit with 8000 streams drops from 8.1s to 3ms. With 10k streams the agent now starts the collector 4s after it starts, down from about 143s. * Address review: drop comment, use b.Loop in benchmark (cherry picked from commit f73af48) Co-authored-by: Shahzad <shahzad31comp@gmail.com>
shahzad31
added a commit
that referenced
this pull request
Nov 16, 2026
…53726) (#54589) * management: stop converting the whole unit config for every stream injectGlobalProcesssors called expected.GetSource().AsMap() for each stream. The source of a unit holds all of its streams, so converting it for every stream made building the inputs of a unit quadratic in its stream count. Elastic Agent builds this config several times at startup, and with 10k Synthetics streams in one component it spent about 140s doing so before it started the collector. Only the global processors are needed, so convert just that field. Injecting processors into every stream of a unit with 8000 streams drops from 8.1s to 3ms. With 10k streams the agent now starts the collector 4s after it starts, down from about 143s. * Address review: drop comment, use b.Loop in benchmark (cherry picked from commit f73af48) Co-authored-by: Shahzad <shahzad31comp@gmail.com>
shahzad31
added a commit
that referenced
this pull request
Nov 16, 2026
…53726) (#54588) * management: stop converting the whole unit config for every stream injectGlobalProcesssors called expected.GetSource().AsMap() for each stream. The source of a unit holds all of its streams, so converting it for every stream made building the inputs of a unit quadratic in its stream count. Elastic Agent builds this config several times at startup, and with 10k Synthetics streams in one component it spent about 140s doing so before it started the collector. Only the global processors are needed, so convert just that field. Injecting processors into every stream of a unit with 8000 streams drops from 8.1s to 3ms. With 10k streams the agent now starts the collector 4s after it starts, down from about 143s. * Address review: drop comment, use b.Loop in benchmark (cherry picked from commit f73af48) Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This was referenced Nov 17, 2026
1 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed commit message
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration files./changelog/fragmentsusing the changelog tool.Disruptive User Impact
None, the resulting config is the same.
How to test this PR locally
End to end: Elastic Agent with 10k
synthetics/httpmonitors, in one component in the OTel runtime (single_receiver: true). Agent started to collector started: 143s before, 4s after (the agent profile showed the time ininjectGlobalProcesssorsthroughstructpb.Struct.AsMap, reached fromgetReceiversConfigForComponent). Time to the first check went from about 216s to about 90s. The rest is a 60s FQDN lookup timeout in the collector, which this PR does not touch.Related issues
Use cases
Any receiver or component with thousands of streams in one unit: the agent builds the receiver config several times, and the time grew with the square of the stream count.
Logs
One run on a laptop, standalone agent, fake Elasticsearch sink. The agent only picks this up through a beats submodule bump.