ingest: make Enconding sync.Pool more robust#5568
ingest: make Enconding sync.Pool more robust#5568carles-grafana merged 1 commit intografana:mainfrom
Conversation
164fac5 to
511543d
Compare
7b7adf6 to
22bb0b1
Compare
|
@mdisibio Inlining the reset function didn't provide any significant speedup |
|
For the benchmarks to be meaningful you need to run them a decent number of times in this branch and in main and compare the results. Something like: |
Note that in the new benchmark I'm already comparing the new and old implementation of For the existing |
| } | ||
|
|
||
| // Original implementation without clear() for comparison | ||
| func encoderPoolPutOriginal(req *tempopb.PushBytesRequest) { |
There was a problem hiding this comment.
This is an intentional implementation of the original function for the benchmark below.
Do you think it's not worth keeping?
There was a problem hiding this comment.
that's not unprecedented. here we keep the original implementation of truncateRowNumber:
https://github.com/grafana/tempo/blob/main/pkg/parquetquery/iters.go#L80-L88
but we also do this b/c it allows us to validate the more complex implementation against the original:
https://github.com/grafana/tempo/blob/main/pkg/parquetquery/iters_test.go#L28
i'm not opposed to this and will go ahead and approve, but imo this is a simple enough change that we are good removing the old impl
We were resetting the length or the underlying slices but not clearing the contents. This makes a potential future data leak due to a bug less likely. Also add a test to ensure the data is reset when reusing it.
22bb0b1 to
2061156
Compare
We were resetting the length or the underlying slices but not clearing the contents.
This makes a potential future data leak due to a bug less likely.
Also add a test to ensure the data is reset when reusing it.
Benchmark in this branch:
Clearing the slices is significantly slower. (60-85% slower). Is the extra safety worth it?
What this PR does:
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]