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
Disable concurrency in zstd and add Benchmark tests for it #9749
Conversation
c9e1529
to
260defb
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9749 +/- ##
=======================================
Coverage 91.02% 91.02%
=======================================
Files 353 353
Lines 18704 18704
=======================================
Hits 17026 17026
Misses 1350 1350
Partials 328 328 ☔ View full report in Codecov by Sentry. |
Which of these tests is the one without concurrency? |
yes the second one, I disabled it using
The benchmark test using a syncpool looks like below
I also tried initializing the compressor in the for loop and still get |
Also, @swiatekm-sumo @atoulme we already seem to be disabling concurrency while uncompressing payloads, as this comment mentions |
3db5d26
to
962db5e
Compare
711e947
to
494d1b1
Compare
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.
Any chance you were able to benchmark the performance of components using this new setting? It would be great to see a comparison
config/confighttp/compressor.go
Outdated
@@ -28,7 +28,7 @@ var ( | |||
_ writeCloserReset = (*snappy.Writer)(nil) | |||
snappyPool = &compressor{pool: sync.Pool{New: func() any { return snappy.NewBufferedWriter(nil) }}} | |||
_ writeCloserReset = (*zstd.Encoder)(nil) | |||
zStdPool = &compressor{pool: sync.Pool{New: func() any { zw, _ := zstd.NewWriter(nil); return zw }}} | |||
zStdPool = &compressor{pool: sync.Pool{New: func() any { zw, _ := zstd.NewWriter(nil, zstd.WithEncoderConcurrency(1)); return zw }}} |
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 @rnishtala-sumo, can you add the same comment re. the setting of concurrency to 1 here for future readers of the code :)
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.
Added a comment above this change, thanks!
@codeboten This test from the PR benchmarks disabling concurrency in zstd is this what you were looking for, or did you want to see a benchmark for an exporter that uses zstd compression? |
44ef00b
to
042febe
Compare
042febe
to
29e2e37
Compare
@dmitryax @swiatekm-sumo @codeboten here's some results from running tests with multiple workers using the testbed in the contrib repo Options used for the test
WIth zstd concurrency
Without zstd concurrency
The above results show some improvement in both memory and CPU with zstd concurrency disabled. As we increase the number of workers (4), the memory usage goes up (even with zstd concurrency disabled), but the CPU performance if better.
Overall disabling zstd concurrency does reduce the memory footprint and helps us the avoid goroutine leaks stated in this issue - klauspost/compress#264 |
@@ -0,0 +1,96 @@ | |||
// Copyright The OpenTelemetry Authors |
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.
does it make sense to remove this test since its only benchmarking underlying components and not options in the collector itself?
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.
The only reason I think we may want to keep this, is because it essentially benchmarks the configcompression.Type
option used in the collector (zstd in the PR). Especially since we know that there's an issue with enabling concurrency in zstd
. Having said that I'm not against removing this test. Also would like you're opinion on this comment
@codeboten @dmitryax please let me know if you'd like to see additional changes to this PR, or more load tests. |
Description: zstd benchmark tests added
The goal of this PR is to disable concurrency in zstd compression to reduce its memory footprint and avoid a known issue with goroutine leaks. Please see - klauspost/compress#264
Link to tracking Issue: #8216
Testing: Benchmark test results below