-
Notifications
You must be signed in to change notification settings - Fork 611
ingest-storage: Add consumer support for a new record version 2, based on Remote Write 2.0 #11406
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
}) | ||
} | ||
|
||
func BenchmarkDeserializeRecordContent(b *testing.B) { |
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.
For those curious, the v2 benchmark gives one extra allocation per timeseries over v1. This PR doesn't try to add any optimizations beyond what's already there. This is on par with my initial test results.
go test ./pkg/storage/ingest/... -run ^$ -bench BenchmarkDeserializeRecordContent -benchtime=1000x -benchmem
BenchmarkDeserializeRecordContent/deserialize_v1-16 1000 5242524 ns/op 12498059 B/op 39975 allocs/op
BenchmarkDeserializeRecordContent/deserialize_v2-16 1000 4888400 ns/op 12886412 B/op 49978 allocs/op
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.
Please use benchstat
next time to compare benchmarks 😉 Run each benchmark at least 6 times to get better results from benchstat
.
pkg/storage/ingest/pusher.go
Outdated
@@ -66,7 +66,7 @@ func (c pusherConsumer) Consume(ctx context.Context, records []record) (returnEr | |||
}(time.Now()) | |||
|
|||
type parsedRecord struct { | |||
*mimirpb.WriteRequest | |||
*mimirpb.PreallocWriteRequest |
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.
This PR depends on #11393. I inlined those changes into this PR until that's merged.
This is logically equivalent to:
WriteRequest: &mimirpb.WriteRequest{
Timeseries: mimirpb.PreallocTimeseriesSliceFromPool(),
},
PreallocWriteRequest.Unmarshal() calls PreallocTimeseriesSliceFromPool()
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.
Overall LGTM (modulo a comment about the symbols builder that I think is wrong). Waiting for the rebase once the other PR is merged.
}) | ||
} | ||
|
||
func BenchmarkDeserializeRecordContent(b *testing.B) { |
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.
Please use benchstat
next time to compare benchmarks 😉 Run each benchmark at least 6 times to get better results from benchstat
.
c28c1f3
to
f24b2e6
Compare
f24b2e6
to
d638be4
Compare
What this PR does
Introduces a new record version
V2
, and implements consumer-side support for it.It's inspired by Prometheus Remote Write 2.0, but not strictly compatible with it. A notable difference is that the symbol refs are shifted up by 64. This reserves space for a future common symbols table, allowing us to completely avoid sending certain commonly used symbols through Kafka.
The format is internal to Mimir, it doesn't need to exactly match any external standard. Aside from within test code, there is currently no way to produce records of the V2 format. Therefore, we're still able to iterate on the format in the future and make breaking changes. I'm not adding this to the changelog for that reason; when we decide to "lock down" the format, the changelog will be updated at that time.
The implementation heavily leverages @krajorama's work in #11100 and inherits several optimizations from it.
Which issue(s) this PR fixes or relates to
Rel https://github.com/grafana/mimir-squad/issues/2253
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.