-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[confighttp] Reuse zstd reader objects #13396
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
Conversation
49a3fbd to
9fb5b2f
Compare
d39a418 to
4bd351e
Compare
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (85.00%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #13396 +/- ##
==========================================
- Coverage 91.95% 91.92% -0.04%
==========================================
Files 529 529
Lines 31446 31461 +15
==========================================
+ Hits 28917 28921 +4
- Misses 1998 2006 +8
- Partials 531 534 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4bd351e to
38f2d1f
Compare
38f2d1f to
a8bbbdf
Compare
codeboten
left a comment
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.
Thanks @ethercrow! The change looks good, can you post a benchmark to show the performance before and after this change?
|
Sorry, I have never run this code. My problem turned out to be in zstd decoding in grpc, which is handled by another library entirely. I was just assuming that the only place in the collector codebase involving zstd decoding must be the culprit. |
|
@ethercrow ah thanks for the update... is this change no longer necessary then? |
|
I think it's still a good change to make. I will probably do some real world testing in future, when I have some collectors communicating through otlphttp. Just can't promise any specific date. |
jmacd
left a comment
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.
Nice!
Note that https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/internal/otelarrow/compression/zstd has re-use, too, good to have.
codeboten
left a comment
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.
Ran some benchmarks before and after the change, change looks good:
goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/collector/config/confighttp
cpu: Apple M3 Max
│ /tmp/a │ /tmp/b │
│ sec/op │ sec/op vs base │
ServerWithDecompression/test-14 170.2µ ± ∞ ¹ 120.3µ ± ∞ ¹ ~ (p=0.333 n=2) ²
│ /tmp/a │ /tmp/b │
│ B/op │ B/op vs base │
ServerWithDecompression/test-14 14.18Mi ± ∞ ¹ 11.44Mi ± ∞ ¹ ~ (p=0.333 n=2) ²
│ /tmp/a │ /tmp/b │
│ allocs/op │ allocs/op vs base │
ServerWithDecompression/test-14 262.5 ± ∞ ¹ 254.5 ± ∞ ¹ ~ (p=0.333 n=2) ²
Pull Request is not mergeable
ae60504
Description
Allocating zstd reader objects on every incoming requests leads to a lot of byte buffers being allocated and collected. The compression library recommends reusing readers to avoid these allocations.
Link to tracking issue
Fixes #11824