Skip to content

Conversation

fvaleri
Copy link
Contributor

@fvaleri fvaleri commented Jul 22, 2025

This patch adds the include argument to ConsumerPerformance tool.

ConsoleConsumer and ConsumerPerformance serve different purposes but
share common functionality for message consumption. Currently, there's
an inconsistency in their command-line interfaces:

  • ConsoleConsumer supports an --include argument that allows users to
    specify a regular expression pattern to filter topics for consumption
  • ConsumerPerformance lacks this topic filtering capability, requiring
    users to specify a single topic explicitly via --topic argument

This inconsistency creates two problems:

  • Similar tools should provide similar topic selection capabilities for
    better user experience
  • Users cannot test consumer performance across multiple topics or
    dynamically matching topic sets, making it difficult to test realistic
    scenarios

Reviewers: Chia-Ping Tsai [email protected]

@github-actions github-actions bot added triage PRs from the community core Kafka Broker tools labels Jul 22, 2025
@fvaleri
Copy link
Contributor Author

fvaleri commented Jul 22, 2025

Usage example:

$ bin/kafka-topics.sh --bootstrap-server :9092 --create --topic t1
Created topic t1.
$ bin/kafka-topics.sh --bootstrap-server :9092 --create --topic t2
Created topic t2.
$ bin/kafka-topics.sh --bootstrap-server :9092 --create --topic t3
Created topic t3.

$ bin/kafka-console-producer.sh --bootstrap-server :9092 --topic t1
>foo
>^C
$ bin/kafka-console-producer.sh --bootstrap-server :9092 --topic t2
>bar
>^C
$ bin/kafka-console-producer.sh --bootstrap-server :9092 --topic t3
>baz
>^C

$ bin/kafka-consumer-perf-test.sh --bootstrap-server :9092 --include t.* --messages 3
start.time, end.time, data.consumed.in.MB, MB.sec, data.consumed.in.nMsg, nMsg.sec, rebalance.time.ms, fetch.time.ms, fetch.MB.sec, fetch.nMsg.sec
2025-07-22 17:07:21:762, 2025-07-22 17:07:25:272, 0.0000, 0.0000, 3, 0.8547, 3464, 46, 0.0002, 65.2174

$ bin/kafka-consumer-perf-test.sh --bootstrap-server :9092 --messages 4
Exactly one of the following arguments is required: [topic], [include]
...

$ bin/kafka-consumer-perf-test.sh --bootstrap-server :9092 --topic t1 --include t.* --messages 3
Exactly one of the following arguments is required: [topic], [include]
...

Relevant system test run:

================================================================================
SESSION REPORT (ALL TESTS)
ducktape version: 0.12.0
session_id:       2025-07-22--001
run time:         1 minute 14.771 seconds
tests run:        4
passed:           4
flaky:            0
failed:           0
ignored:          0
================================================================================
test_id:    kafkatest.sanity_checks.test_performance_services.PerformanceServiceTest.test_version.version=2.1.1.metadata_quorum=COMBINED_KRAFT
status:     PASS
run time:   25.090 seconds
{"producer_performance": {"records_per_sec": 26041.7, "mb_per_sec": 2.48}, "end_to_end_latency": {"latency_50th_ms": 0.0, "latency_99th_ms": 1.0, "latency_999th_ms": 3.0}, "consumer_performance": {"records_per_sec": 38625.4826, "mb_per_sec": 3.6824}}
--------------------------------------------------------------------------------
test_id:    kafkatest.sanity_checks.test_performance_services.PerformanceServiceTest.test_version.version=2.1.1.metadata_quorum=ISOLATED_KRAFT
status:     PASS
run time:   31.330 seconds
{"producer_performance": {"records_per_sec": 42372.9, "mb_per_sec": 4.04}, "end_to_end_latency": {"latency_50th_ms": 0.0, "latency_99th_ms": 2.0, "latency_999th_ms": 3.0}, "consumer_performance": {"records_per_sec": 46752.3364, "mb_per_sec": 4.4569}}
--------------------------------------------------------------------------------
test_id:    kafkatest.sanity_checks.test_performance_services.PerformanceServiceTest.test_version.version=dev.metadata_quorum=COMBINED_KRAFT.use_share_groups=True
status:     PASS
run time:   37.767 seconds
{"producer_performance": {"records_per_sec": 25188.9, "mb_per_sec": 2.4}, "end_to_end_latency": {"latency_50th_ms": 0.0, "latency_99th_ms": 3.0, "latency_999th_ms": 5.0}, "consumer_performance": {"records_per_sec": 26714.2857, "mb_per_sec": 2.457}, "share_consumer_performance": {"records_per_sec": 10342.0, "mb_per_sec": 0.1732}}
--------------------------------------------------------------------------------
test_id:    kafkatest.sanity_checks.test_performance_services.PerformanceServiceTest.test_version.version=dev.metadata_quorum=ISOLATED_KRAFT.use_share_groups=True
status:     PASS
run time:   43.212 seconds
{"producer_performance": {"records_per_sec": 20202.0, "mb_per_sec": 1.93}, "end_to_end_latency": {"latency_50th_ms": 0.0, "latency_99th_ms": 2.0, "latency_999th_ms": 3.0}, "consumer_performance": {"records_per_sec": 28150.5376, "mb_per_sec": 2.5891}, "share_consumer_performance": {"records_per_sec": 10342.0, "mb_per_sec": 0.1737}}
--------------------------------------------------------------------------------

@chia7712
Copy link
Member

please fix the build error:

Execution failed for task ':server-common:spotlessJavaCheck'.
> The following files had format violations:
      src/test/java/org/apache/kafka/server/util/CommandLineUtilsTest.java
          @@ -17,6 +17,7 @@
           package·org.apache.kafka.server.util;
           
           import·org.apache.kafka.common.utils.Exit;
          +
           import·org.junit.jupiter.api.Test;
           
           import·java.util.List;
  Run './gradlew :server-common:spotlessApply' to fix these violations.

@fvaleri
Copy link
Contributor Author

fvaleri commented Jul 22, 2025

@chia7712 done.

@fvaleri
Copy link
Contributor Author

fvaleri commented Jul 23, 2025

The only failed test is DescribeStreamsGroupTest.testDescribeWithoutGroupOption that is fixed by #20225. Rebased.

@fvaleri fvaleri force-pushed the cons-perf-include branch from 505ac75 to d4080a6 Compare July 24, 2025 12:47
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.

@fvaleri thanks for this patch. one major comment is left.

@github-actions github-actions bot removed the triage PRs from the community label Jul 25, 2025
@fvaleri fvaleri requested a review from chia7712 July 28, 2025 16:50
@fvaleri fvaleri force-pushed the cons-perf-include branch from d4080a6 to ab9efad Compare July 31, 2025 09:50
@fvaleri
Copy link
Contributor Author

fvaleri commented Aug 18, 2025

@chia7712 gentle reminder about this patch

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.

@fvaleri thanks for this patch. I have one last question. PTAL

@fvaleri fvaleri requested a review from chia7712 August 21, 2025 13:52
@chia7712
Copy link
Member

@fvaleri Could you please rebase the code to include the CI changes? Otherwise, the build under JDK 24 will always fail

This patch adds the include argument to ConsumerPerformance tool.

ConsoleConsumer and ConsumerPerformance serve different purposes but share common functionality
for message consumption. Currently, there's an inconsistency in their command-line interfaces:

- ConsoleConsumer supports an --include argument that allows users to specify a regular expression pattern to filter topics for consumption
- ConsumerPerformance lacks this topic filtering capability, requiring users to specify a single topic explicitly via --topic argument

This inconsistency creates two problems:

- Similar tools should provide similar topic selection capabilities for better user experience
- Users cannot test consumer performance across multiple topics or dynamically matching topic sets, making it difficult to test realistic scenarios

Signed-off-by: Federico Valeri <[email protected]>
Signed-off-by: Federico Valeri <[email protected]>
Signed-off-by: Federico Valeri <[email protected]>
Signed-off-by: Federico Valeri <[email protected]>
@fvaleri fvaleri force-pushed the cons-perf-include branch from ef12dd2 to e0d66b1 Compare August 23, 2025 18:35
@fvaleri
Copy link
Contributor Author

fvaleri commented Aug 23, 2025

@fvaleri Could you please rebase the code to include the CI changes? Otherwise, the build under JDK 24 will always fail

Sure, just pushed the rebase. Thanks.

@chia7712
Copy link
Member

open https://issues.apache.org/jira/browse/KAFKA-19641 to trace the flaky

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.

@fvaleri could you please update upgrade.html to include this new feature?

Signed-off-by: Federico Valeri <[email protected]>
@fvaleri
Copy link
Contributor Author

fvaleri commented Aug 24, 2025

@chia7712 upgrade note added. Thanks for opening the flaky test issue.

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.

LGTM

@chia7712 chia7712 merged commit f97b95c into apache:trunk Aug 24, 2025
21 of 23 checks passed
@fvaleri fvaleri deleted the cons-perf-include branch August 25, 2025 05:41
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