KAFKA-4432: Added support to supply custom message payloads to perf-producer script.#2158
KAFKA-4432: Added support to supply custom message payloads to perf-producer script.#2158SandeshKarkera wants to merge 4 commits intoapache:trunkfrom
Conversation
|
@ijuma can you please review? |
|
@guozhangwang @dguy @mjsax @norwood @enothereska can you please take a look? |
| throw new ArgumentParserException("Either --producer-props or --producer.config must be specified.", parser); | ||
| } | ||
|
|
||
| if ((recordSize == null && payloadFilePath == null) || (recordSize != null && payloadFilePath != null)) { |
There was a problem hiding this comment.
you can validate this in the ArgumentParser by using parser.addMutuallyExclusiveGroup() and adding --record-size and --payload-file to the returned group and making the group .required()
|
@norwood Thanks for the review. I've removed the validation for record-size and payload-file and added them to a MutuallyExclusiveGroup as suggested. |
|
Jenkins build job is failing due to time out issue. |
|
@norwood, can you please review and let me know if this can be merged? |
| throw new IllegalArgumentException("File does not exist or empty file provided."); | ||
| } | ||
|
|
||
| String[] payloadList = new String(Files.readAllBytes(path), "UTF-8").split(payloadDelimiter); |
There was a problem hiding this comment.
this seems like it could be dangerous depending on how large your input file is. it would probably be best to use BufferedReader, but if you have to support custom delimiters this could get complicated.
There was a problem hiding this comment.
@norwood We have to store all the messages in memory, otherwise, picking a new random message to send will be slow and complicated.
Given that all messages are stored in memory, I think its OK to use Files.readAllBytes()
There was a problem hiding this comment.
@norwood Do let me know your thoughts on the point mentioned above.
There was a problem hiding this comment.
sorry. yeah, this makes sense. thx.
you will still need to get a commiter to 👍 this, but lgtm
|
@junrao @ijuma @guozhangwang Can you please review and merge? |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
@junrao @jkreps @guozhangwang @ijuma @mumrah @sriramsub @d3fmacro : Guys, this PR has been open for a long time. It has been reviewed by @norwood . I'd really appreciate if one of you can take a look and merge this. |
|
@SandeshKarkera : Thanks for the patch and sorry for the delay. LGTM |
…roducer script. Current implementation of ProducerPerformance creates static payload. This is not very useful in testing compression or when you want to test with production/custom payloads. So, we decided to add support for providing payload file as an input to producer perf test script. We made the following changes: 1. Added support to provide a payload file which can have the list of payloads that you actually want to send. 2. Moved payload generation inside the send loop for cases when payload file is provided. Following are the changes to how the producer-performance is evoked: 1. You must provide "--record-size" or "--payload-file" but not both. This is because, record size cannot be guaranteed when you are using custom events. e.g. ./kafka-producer-perf-test.sh --topic test_topic --num-records 100000 --producer-props bootstrap.servers=127.0.0.1:9092 acks=0 buffer.memory=33554432 compression.type=gzip batch.size=10240 linger.ms=10 --throughput -1 --payload-file ./test_payloads --payload-delimiter , 2. Earlier "--record-size" was a required config, now you must provide exactly one of "--record-size" or "--payload-file". Providing both will result in an error. 3. Support for an additional parameter "--payload-delimiter" has been added which defaults to "\n" Author: Sandesh K <sandesh.karkera@flipkart.com> Reviewers: dan norwood <norwood@confluent.io>, Jun Rao <junrao@gmail.com> Closes #2158 from SandeshKarkera/PerfProducerChanges (cherry picked from commit a37bf5f) Signed-off-by: Jun Rao <junrao@gmail.com>
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
…roducer script. Current implementation of ProducerPerformance creates static payload. This is not very useful in testing compression or when you want to test with production/custom payloads. So, we decided to add support for providing payload file as an input to producer perf test script. We made the following changes: 1. Added support to provide a payload file which can have the list of payloads that you actually want to send. 2. Moved payload generation inside the send loop for cases when payload file is provided. Following are the changes to how the producer-performance is evoked: 1. You must provide "--record-size" or "--payload-file" but not both. This is because, record size cannot be guaranteed when you are using custom events. e.g. ./kafka-producer-perf-test.sh --topic test_topic --num-records 100000 --producer-props bootstrap.servers=127.0.0.1:9092 acks=0 buffer.memory=33554432 compression.type=gzip batch.size=10240 linger.ms=10 --throughput -1 --payload-file ./test_payloads --payload-delimiter , 2. Earlier "--record-size" was a required config, now you must provide exactly one of "--record-size" or "--payload-file". Providing both will result in an error. 3. Support for an additional parameter "--payload-delimiter" has been added which defaults to "\n" Author: Sandesh K <sandesh.karkera@flipkart.com> Reviewers: dan norwood <norwood@confluent.io>, Jun Rao <junrao@gmail.com> Closes apache#2158 from SandeshKarkera/PerfProducerChanges
Current implementation of ProducerPerformance creates static payload. This is not very useful in testing compression or when you want to test with production/custom payloads. So, we decided to add support for providing payload file as an input to producer perf test script.
We made the following changes:
Following are the changes to how the producer-performance is evoked:
e.g. ./kafka-producer-perf-test.sh --topic test_topic --num-records 100000 --producer-props bootstrap.servers=127.0.0.1:9092 acks=0 buffer.memory=33554432 compression.type=gzip batch.size=10240 linger.ms=10 --throughput -1 --payload-file ./test_payloads --payload-delimiter ,