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

[benchmarks] Add LogBenchmark when BatchProcessor is used #5746

Merged

Conversation

cijothomas
Copy link
Member

@cijothomas cijothomas commented Jul 11, 2024

Added a Log Benchmark when BatchExportProcessor is used instead of a normal NoOpProcessor. SDK special cases our BatchExportProcessor (not 3rd party authored), to use a different LogRecord pooling mechanism.

This benchmark will show the perf difference, when using that pooling mechanism. (It is much higher than the ThreadLocal based pooling, only useable in sync exporters like etw)

Also renamed Dummy -> NoOp processor, as the processor is a no-op, with no ability to accept alternate behavior.

The following shows the cost when BatchingProcessor is used (compared to other processor), which has to copy all the Log state+scope.

| OneProcessor                  | 111.558 ns | 2.9821 ns |  8.5082 ns | 109.311 ns | 0.0063 |      - |      40 B |
| BatchProcessor                | 263.650 ns | 5.2908 ns | 14.1223 ns | 258.984 ns | 0.0200 | 0.0043 |     128 B |

@CodeBlanch mentioned that the benchmarks is pushing large number of logs forcing the pool to hit the limit, and start allocating.

@cijothomas cijothomas requested a review from a team July 11, 2024 17:26
Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.13%. Comparing base (6250307) to head (b5bfa17).
Report is 279 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5746      +/-   ##
==========================================
+ Coverage   83.38%   86.13%   +2.75%     
==========================================
  Files         297      254      -43     
  Lines       12531    11057    -1474     
==========================================
- Hits        10449     9524     -925     
+ Misses       2082     1533     -549     
Flag Coverage Δ
unittests ?
unittests-Project-Experimental 86.12% <ø> (?)
unittests-Project-Stable 86.08% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 196 files with indirect coverage changes

@@ -134,7 +150,15 @@ public void ThreeProcessors()
this.loggerWithThreeProcessors.SayHello(FoodName, FoodPrice);
}

internal class DummyLogProcessor : BaseProcessor<LogRecord>
internal class NoOpLogProcessor : BaseProcessor<LogRecord>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
internal class NoOpLogProcessor : BaseProcessor<LogRecord>
internal class NoopLogProcessor : BaseProcessor<LogRecord>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It this updated? @cijothomas

@CodeBlanch CodeBlanch added the perf Performance related label Jul 16, 2024
@CodeBlanch CodeBlanch changed the title Add LogBenchmark when BatchProcessor is used [benchmarks] Add LogBenchmark when BatchProcessor is used Jul 16, 2024
@CodeBlanch CodeBlanch merged commit ccd3759 into open-telemetry:main Jul 16, 2024
32 checks passed
@cijothomas cijothomas deleted the cijothomas/batch-log-benchmark branch July 16, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf Performance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants