Skip to content

Conversation

@AndrewJSchofield
Copy link
Member

@AndrewJSchofield AndrewJSchofield commented Aug 16, 2025

This implements KIP-1147 for kafka-producer-perf-test.sh.

Reviewers: Chia-Ping Tsai chia7712@gmail.com

@github-actions github-actions bot added the tools label Aug 16, 2025
@AndrewJSchofield AndrewJSchofield changed the title KAFKA-19598: [DO-NOT-MERGE] Command-line arguments for producer perf test KAFKA-19598: Command-line arguments for producer perf test Aug 20, 2025
Copy link
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndrewJSchofield thanks for this beautiful patch. I just have a few minor comments. Please take a look.

cmd += " export KAFKA_LOG4J_OPTS=\"%s%s\"; " % (get_log4j_config_param(node), get_log4j_config_for_tools(node))
cmd += "KAFKA_OPTS=%(kafka_opts)s KAFKA_HEAP_OPTS=\"-XX:+HeapDumpOnOutOfMemoryError\" %(kafka_run_class)s org.apache.kafka.tools.ProducerPerformance " \
"--topic %(topic)s --num-records %(num_records)d --record-size %(record_size)d --throughput %(throughput)d --producer-props bootstrap.servers=%(bootstrap_servers)s client.id=%(client_id)s %(metrics_props)s" % args
"--topic %(topic)s --num-records %(num_records)d --record-size %(record_size)d --throughput %(throughput)d --command-property bootstrap.servers=%(bootstrap_servers)s client.id=%(client_id)s %(metrics_props)s" % args
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed this change would cause an issue when running ProducerPerformanceService on an older kafka. However, it seems that ProducerPerformanceService always uses the tool jar from the development branch

"There are three ways to specify the transactional id: set transactional.id=<id> via --command-property, " +
"set transactional.id=<id> in the config file via --command-config, or use --transactional-id <id>.");

parser.addArgument("--bootstrap-server")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should those configuration changes be documented in upgrade.html?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but I think a single task to do the entire KIP once the PRs are done is best. https://issues.apache.org/jira/browse/KAFKA-19635

if (bootstrapServers == null && commandProperties == null && producerConfigs == null && producerConfigFile == null && commandConfigFile == null) {
throw new ArgumentParserException("At least one of --bootstrap-server, --command-property, --producer-props, --producer.config or --command-config must be specified.", parser);
}
if (commandProperties != null && producerConfigs != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems this case does not have a unit test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as temporary code, I didn't write one. But it was a shortcut and I will add one.

}
if (producerConfigs == null && producerConfigFile == null) {
throw new ArgumentParserException("Either --producer-props or --producer.config must be specified.", parser);
if (commandConfigFile != null && producerConfigFile != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I'll add a test.

@chia7712 chia7712 merged commit c565ba1 into apache:trunk Aug 22, 2025
23 checks passed
@AndrewJSchofield AndrewJSchofield deleted the KAFKA-19598 branch August 25, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants