You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
storage/ingest: refactor recordConsumer.Consume to take iter.Seq (#12482)
#### What this PR does
The PR updates internals of `pkg/storage/ingest`. Now, the
`recordConsumer.Consume` accepts an iterator over Kafka records,
`iter.Seq[*kgo.Record]`.
Following the discussion in
#12443 (comment), we
want the block-builder to reuse the `pusherConsumer`, but we want to
avoid exposing the existing `record` data structs. Instead of expanding
the existing interface, I propose we refactor the `recordConsumer` and
get rid of the intermediate `record` data type completely.
---
I checked the benchmarks of the `PusherConsumer`, and, although this
wasn't planned, I got some positive results from the refactoring (_I
didn't investigate if the results represent real use case, or this is
just a side effect of the benchmarks themselves_):
```
goos: darwin
goarch: arm64
pkg: github.com/grafana/mimir/pkg/storage/ingest
cpu: Apple M2
│ 1.bench │ 2.bench │
│ sec/op │ sec/op vs base │
PusherConsumer/sequential_pusher-8 332.6µ ± 0% 333.7µ ± 0% ~ (p=0.089 n=10)
PusherConsumer/parallel_pusher-8 332.1µ ± 0% 334.0µ ± 0% +0.59% (p=0.003 n=10)
geomean 332.4µ 333.9µ +0.46%
│ 1.bench │ 2.bench │
│ B/op │ B/op vs base │
PusherConsumer/sequential_pusher-8 41.05Ki ± 0% 40.41Ki ± 0% -1.57% (p=0.000 n=10)
PusherConsumer/parallel_pusher-8 41.64Ki ± 0% 40.97Ki ± 0% -1.61% (p=0.000 n=10)
geomean 41.35Ki 40.69Ki -1.59%
│ 1.bench │ 2.bench │
│ allocs/op │ allocs/op vs base │
PusherConsumer/sequential_pusher-8 564.0 ± 0% 519.0 ± 0% -7.98% (p=0.000 n=10)
PusherConsumer/parallel_pusher-8 570.0 ± 0% 525.0 ± 0% -7.89% (p=0.000 n=10)
geomean 567.0 522.0 -7.94%
```
#### Checklist
- [x] Tests updated.
- [ ] Documentation added.
- [ ] `CHANGELOG.md` updated - the order of entries should be
`[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry
is not needed, please add the `changelog-not-needed` label to the PR.
- [ ]
[`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md)
updated with experimental features.
Signed-off-by: Vladimir Varankin <[email protected]>
0 commit comments