-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[internal/stanza] Batch in emitter instead of converter #6378
Merged
bogdandrutu
merged 21 commits into
open-telemetry:main
from
observIQ:internal-stanza-batch-first
Dec 2, 2021
Merged
[internal/stanza] Batch in emitter instead of converter #6378
bogdandrutu
merged 21 commits into
open-telemetry:main
from
observIQ:internal-stanza-batch-first
Dec 2, 2021
Conversation
This file contains 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
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
BinaryFissionGames
force-pushed
the
internal-stanza-batch-first
branch
from
November 29, 2021 15:20
5c1fde6
to
c885874
Compare
djaglowski
reviewed
Nov 29, 2021
This makes it more clear/explicit what the critical sections are
Also cleaned up comments and removed some unused bits here.
Reducing the scope to just the aggregation loop prevents concurrent access.
BinaryFissionGames
force-pushed
the
internal-stanza-batch-first
branch
from
November 30, 2021 14:35
8be22a4
to
16a4aff
Compare
djaglowski
reviewed
Nov 30, 2021
djaglowski
reviewed
Dec 1, 2021
Folded out makeNewBatch, makeNewBatchNoLock, and appendEntry.
@BinaryFissionGames This is looking really nice. Can you post benchmarks once more now that we've had some changes? |
@djaglowski
|
djaglowski
reviewed
Dec 1, 2021
djaglowski
approved these changes
Dec 1, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thanks @BinaryFissionGames
djaglowski
added
the
ready to merge
Code review completed; ready to merge by maintainers
label
Dec 1, 2021
jamesmoessis
pushed a commit
to atlassian-forks/opentelemetry-collector-contrib
that referenced
this pull request
Dec 8, 2021
…ry#6378) * Batch stanza entries up front * Use same as previous default * fix filelogreceiver tests * refactor emitter.go to always defer mux unlocks This makes it more clear/explicit what the critical sections are * batchCount -> batchSize * flatten resource aggregation code * fix out of date comment for maxBatchSize * Move checks for nil batch to avoid function calls * Move emitter Stop directly after Start * Use aggregation over batch for resource aggregation step Also cleaned up comments and removed some unused bits here. * Move converter resource aggregation map to reduced scope Reducing the scope to just the aggregation loop prevents concurrent access. * Remove reliance on internal/stanza defaults for filelogreceiver * Remove paranoid nil check for cancel func * default cancel func is noop for emitter * Remove unnecessary option interface for emitter. * Make sure to shutdown emitter in correct order. * Combine some statements with following if in emitter * Clarify batching logic in converter tests * Fold some functions in emitter Folded out makeNewBatch, makeNewBatchNoLock, and appendEntry. * add back in appendEntry, makeNewBatch * Fix regressed if statement
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.
Description:
When the worker pattern was implemented, batching was put after the worker loop in the converter. The problem with this is that the workers have very little work to do per cycle. Ideally, workers have large amounts of work they do before they request more. Otherwise, workers begin to incur a lot of overhead from requesting work constantly (in this case selecting from a channel), which can (and does) cause performance issues under high load.
Instead of a unit of work being a single entry, this PR makes a unit of work a batch of entries, moving the batching logic into the LogEmitter.
Testing:
Added tests to LogEmitter to validate MaxBatchSize and FlushInterval are still respected.
Benchmarks of emitter-to-consumer performance:
Before:
After: