benchmarks: add BatchSpanProcessor
benchmark
#791
Merged
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.
First step towards #786. The idea of the benchmark is partially based on the BatchSpanProcessorBenchmark.java with some adjustments.
Comparisson: OtelJava vs SDK
Throughput
delayMs
represents how long it takes for the exporter to export spans. BesidesLoggingExporter
, the export of spans will take at least 5+ ms.So, SDK outperforms OtelJava in this case:
Memory allocation
OtelJava is the clear winner here.
The memory usage issues
Queue.dropping
- the queue uses immutable structures, so the memory usage is way bigger. See Dropping queue high memory usage cats-effect#4141.whenA
- could be unproductive in some cases: optimizeIO.whenA
cats-effect#4135. Also,f.whenA(cond)
turnsf
into call-by-name.Improvements
The changes:
whenA
,ifM
withif
statementmapN
with a sequential mapThe baseline:
This PR:
Well, let's be honest. There are some improvements that lie within the error rate deviation (hehe), but nothing crazy.
Bonus point - use
Queue.bounded
Throughput is ~30%, and the normalized (per op) memory usage is ~3-3.5 times lower.
Next steps