Query frontend: Add benchmarks for labels codec and query range codec #4723
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
As a part of working on query frontend performance related task (#4571), I'm adding benchmarks to query frontend packages for codecs.
Results:
queryfrontend ❯ go test -bench=. query-frontend-benchmarks goos: linux goarch: amd64 pkg: github.com/thanos-io/thanos/pkg/queryfrontend cpu: Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz BenchmarkLabelsCodecEncodeAndDecodeRequest/SeriesRequest-12 217172 5070 ns/op 3496 B/op 44 allocs/op BenchmarkLabelsCodecEncodeAndDecodeRequest/LabelsRequest-12 165806 7023 ns/op 3937 B/op 57 allocs/op BenchmarkLabelsCodecDecodeResponse/SeriesResponse-12 335694 3269 ns/op 2056 B/op 34 allocs/op BenchmarkLabelsCodecDecodeResponse/SeriesResponseWithHeaders-12 279236 3689 ns/op 2528 B/op 39 allocs/op BenchmarkLabelsCodecDecodeResponse/LabelsResponse-12 569709 2272 ns/op 1328 B/op 20 allocs/op BenchmarkLabelsCodecDecodeResponse/LabelsResponseWithHeaders-12 468223 2578 ns/op 1800 B/op 25 allocs/op BenchmarkLabelsCodecMergeResponses_1/SeriesResponses-12 1980333 635.0 ns/op 368 B/op 10 allocs/op BenchmarkLabelsCodecMergeResponses_1/LabelsResponses-12 460894840 2.546 ns/op 0 B/op 0 allocs/op BenchmarkLabelsCodecMergeResponses_10/SeriesResponses-12 216445 5103 ns/op 2929 B/op 68 allocs/op BenchmarkLabelsCodecMergeResponses_10/LabelsResponses-12 659503 1676 ns/op 593 B/op 4 allocs/op BenchmarkLabelsCodecMergeResponses_100/SeriesResponses-12 18146 63734 ns/op 31966 B/op 618 allocs/op BenchmarkLabelsCodecMergeResponses_100/LabelsResponses-12 51276 22847 ns/op 7151 B/op 11 allocs/op BenchmarkLabelsCodecMergeResponses_1000/SeriesResponses-12 1598 699492 ns/op 342276 B/op 6046 allocs/op BenchmarkLabelsCodecMergeResponses_1000/LabelsResponses-12 3666 298388 ns/op 101812 B/op 36 allocs/op BenchmarkQueryRangeCodecEncodeAndDecodeRequest-12 169071 6655 ns/op 4000 B/op 58 allocs/op PASS ok github.com/thanos-io/thanos/pkg/queryfrontend 19.568s
Verification
Benchmarks ran