This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
producer_worker: revert use of ValueGenerator::Generate()
#63
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5b86025 to
b5cc3b1
Compare
andrwng
previously approved these changes
Dec 12, 2024
andrwng
reviewed
Dec 12, 2024
andrwng
left a comment
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.
nit: the numbers would go well in the commit message too IMO, for git history spelunking
b5cc3b1 to
fa1591a
Compare
andrwng
previously approved these changes
Dec 12, 2024
3ef680c to
0dfae76
Compare
7 tasks
Using the modified `Generate()` function was a lot slower than just simply making
an empty payload:
```
Benchmark_random_payload10-32 2445903 485.2 ns/op
Benchmark_random_payload100-32 678870 1773 ns/op
Benchmark_random_payload1000-32 105667 13700 ns/op
Benchmark_random_payload1e4-32 9104 126782 ns/op
Benchmark_random_payload1e5-32 1135 1151425 ns/op
Benchmark_random_payload1e6-32 100 13046547 ns/op
==========================================================
Benchmark_empty_payload10-32 79950942 20.54 ns/op
Benchmark_empty_payload100-32 24089101 54.78 ns/op
Benchmark_empty_payload1000-32 3789248 366.1 ns/op
Benchmark_empty_payload1e4-32 670096 2059 ns/op
Benchmark_empty_payload1e5-32 58912 23021 ns/op
Benchmark_empty_payload1e6-32 5600 290045 ns/op
```
As can be seen, generating the random payload and ensuring it is UTF-8 valid
is orders of magnitude slower than the empty payload.
Revert the use of `Generate()` here in place of the empty payload.
However, if the user has indicated they want to validate the latest key-value
pair produced, generate a `(value-{%018d}, offset)` message in the record.
This does mean that message sizes that are less than 24 bytes are not honored
if the `validate-latest-values` flag is passed.
0dfae76 to
3c87c1c
Compare
Contributor
Author
|
Testing CI here: redpanda-data/redpanda#24558 |
Contributor
Author
|
Redpanda CI is green. |
andrwng
approved these changes
Dec 13, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Using the modified
ValueGenerator::Generate()function for each record in theproducer_workerwas a lot slower than just simply making an empty payload.The following benchmarks were generated:
As can be seen, generating the random payload and ensuring it is UTF-8 valid is orders of magnitude slower than the empty payload.
Revert the use of
Generate()here in place of the empty payload.However, if the user has indicated they want to validate the latest key-value pair produced, generate a
(value-{%018d}, offset)message in the record.This does mean that message sizes that are less than 24 bytes are not honored if the
validate-latest-valuesflag is passed.