Skip to content

KAFKA-19624: Improve consistency of command-line arguments for consumer performance tests#20385

Merged
AndrewJSchofield merged 28 commits into
apache:trunkfrom
aheev:KAFKA-19487
Sep 23, 2025
Merged

KAFKA-19624: Improve consistency of command-line arguments for consumer performance tests#20385
AndrewJSchofield merged 28 commits into
apache:trunkfrom
aheev:KAFKA-19487

Conversation

@aheev

@aheev aheev commented Aug 20, 2025

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added triage PRs from the community tools labels Aug 20, 2025
@aheev

aheev commented Aug 20, 2025

Copy link
Copy Markdown
Contributor Author

@AndrewJSchofield can you please review this?

@aheev aheev changed the title KAFKA-19487: Improving consistency of command-line arguments for consumer performance tests KAFKA-19624: Improving consistency of command-line arguments for consumer performance tests Aug 20, 2025
@AndrewJSchofield AndrewJSchofield added ci-approved and removed triage PRs from the community labels Aug 22, 2025
@brandboat

Copy link
Copy Markdown
Member

ping @aheev, could you please fix the conflicts?



# Conflicts:
#	tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java
#	tools/src/test/java/org/apache/kafka/tools/ConsumerPerformanceTest.java
@aheev

aheev commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

ping @aheev, could you please fix the conflicts?

done

@brandboat brandboat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the patch, left some comments below.

Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java
@aheev
aheev requested a review from brandboat August 25, 2025 06:27
@aheev

aheev commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

FAILED ❌ RestoreIntegrationTest > "shouldInvokeUserDefinedGlobalStateRestoreListener(boolean).useNewProtocol=false"

This test seems to be flaky. It succeeds on my machine and fails sometimes. Also the changes are not even related to the test

Just tested. Same issue on trunk too

Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java Outdated
Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java

@m1a2st m1a2st left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this patch, some comments left

Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java
Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java Outdated
@AndrewJSchofield
AndrewJSchofield self-requested a review August 25, 2025 14:42

@AndrewJSchofield AndrewJSchofield left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR. Please add some tests for the variation combinations of new/old options to make sure the rules in the KIP are correctly implemented.

Comment thread tests/kafkatest/services/performance/consumer_performance.py Outdated
Comment thread tests/kafkatest/services/performance/share_consumer_performance.py Outdated
Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java
Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java Outdated
Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java
Comment thread tools/src/main/java/org/apache/kafka/tools/ConsumerPerformance.java Outdated
Comment thread tools/src/main/java/org/apache/kafka/tools/ShareConsumerPerformance.java Outdated
Comment thread tools/src/main/java/org/apache/kafka/tools/ShareConsumerPerformance.java Outdated
Comment thread tools/src/main/java/org/apache/kafka/tools/ShareConsumerPerformance.java Outdated

@brandboat brandboat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the update, some minor comments.

Comment thread tools/src/main/java/org/apache/kafka/tools/ShareConsumerPerformance.java Outdated
Comment thread tools/src/test/java/org/apache/kafka/tools/ConsumerPerformanceTest.java Outdated
Comment thread tools/src/test/java/org/apache/kafka/tools/ShareConsumerPerformanceTest.java Outdated
Comment thread tools/src/test/java/org/apache/kafka/tools/ShareConsumerPerformanceTest.java Outdated

@brandboat brandboat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

Comment thread tools/src/test/java/org/apache/kafka/tools/ConsumerPerformanceTest.java Outdated
Comment thread tests/kafkatest/services/performance/consumer_performance.py Outdated
Comment thread tests/kafkatest/services/performance/share_consumer_performance.py Outdated
@aheev

aheev commented Sep 7, 2025

Copy link
Copy Markdown
Contributor Author

@Yunyung ConsumerPerformanceService and ShareConsumerPerformanceService are used in benchmark_test.py(which uses DEV_BRANCH and test_performance_services.py(which uses LATEST_2_1 and DEV_BRANCH)

  • ShareConsumerPerformanceService runs only in test_performance_services.py runs on branches >= 4.1. Hence, we can ignore this
  • As for ConsumerPerformanceService, I have added changes, but, while running the test, ProducerPerformanceService, which is used to produce data in turn consumed by ConsumerPerformanceService, fails, thereby blocking the ConsumerPerformanceService to consume on LATEST_2_1. It fails on trunk too
[INFO:2025-09-07 09:01:58,715]: RunnerClient: kafkatest.sanity_checks.test_performance_services.PerformanceServiceTest.test_version.version=2.1.1.metadata_quorum=ISOLATED_KRAFT: FAIL: Exception('ProducerPerformanceService-0-125869363841104-worker-1: Traceback (most recent call last):\n  File "/usr/local/lib/python3.10/dist-packages/ducktape/services/background_thread.py", line 36, in _protected_worker\n    self._worker(idx, node)\n  File "/opt/kafka-dev/tests/kafkatest/services/performance/producer_performance.py", line 130, in _worker\n    wait_until(lambda: self.alive(node), timeout_sec=20, err_msg="ProducerPerformance failed to start")\n  File "/usr/local/lib/python3.10/dist-packages/ducktape/utils/util.py", line 58, in wait_until\n    raise TimeoutError(err_msg() if callable(err_msg) else err_msg) from last_exception\nducktape.errors.TimeoutError: ProducerPerformance failed to start\n')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/ducktape/tests/runner_client.py", line 351, in _do_run
    data = self.run_test()
  File "/usr/local/lib/python3.10/dist-packages/ducktape/tests/runner_client.py", line 411, in run_test
    return self.test_context.function(self.test)
  File "/usr/local/lib/python3.10/dist-packages/ducktape/mark/_mark.py", line 438, in wrapper
    return functools.partial(f, *args, **kwargs)(*w_args, **w_kwargs)
  File "/opt/kafka-dev/tests/kafkatest/sanity_checks/test_performance_services.py", line 58, in test_version
    self.producer_perf.run()
  File "/usr/local/lib/python3.10/dist-packages/ducktape/services/service.py", line 345, in run
    self.wait()
  File "/usr/local/lib/python3.10/dist-packages/ducktape/services/background_thread.py", line 72, in wait
    self._propagate_exceptions()
  File "/usr/local/lib/python3.10/dist-packages/ducktape/services/background_thread.py", line 103, in _propagate_exceptions
    raise Exception(self.errors)
Exception: ProducerPerformanceService-0-125869363841104-worker-1: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/ducktape/services/background_thread.py", line 36, in _protected_worker
    self._worker(idx, node)
  File "/opt/kafka-dev/tests/kafkatest/services/performance/producer_performance.py", line 130, in _worker
    wait_until(lambda: self.alive(node), timeout_sec=20, err_msg="ProducerPerformance failed to start")
  File "/usr/local/lib/python3.10/dist-packages/ducktape/utils/util.py", line 58, in wait_until
    raise TimeoutError(err_msg() if callable(err_msg) else err_msg) from last_exception
ducktape.errors.TimeoutError: ProducerPerformance failed to start

I think we need to fix our test suite first
@AndrewJSchofield what is the way forward here?

@aheev

aheev commented Sep 13, 2025

Copy link
Copy Markdown
Contributor Author

@AndrewJSchofield @Yunyung gentle ping on this one

@AndrewJSchofield

Copy link
Copy Markdown
Member

@aheev Sorry for the delay. I'll review it early next week.

@AndrewJSchofield

Copy link
Copy Markdown
Member

@aheev This is what I get when I run the tests on your branch:

================================================================================
SESSION REPORT (ALL TESTS)
ducktape version: 0.12.0
session_id:       2025-09-16--001
run time:         68 minutes 36.085 seconds
tests run:        74
passed:           74
flaky:            0
failed:           0
ignored:          0
================================================================================

I do get the following warnings on trunk and your branch:

[WARNING - 2025-09-16 07:49:08,187 - service_registry - stop_all - lineno:53]: Error stopping service <ProducerPerformanceService-0-281473709848272: num_nodes: 1, nodes: ['ducker07']>: 1

@AndrewJSchofield AndrewJSchofield left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the updates.

The share_consumer_performance.py test file also needs changes to account for --messages changing into --num-records.

I've been running the ducktape tests and tests/kafkatest/sanity_checks/test_performance_services.py does seem flaky. However, I have had passes on v2.1.1 and dev across all variations. So, I think we can rule out problems being introduced by this PR.

Please merge latest changes from trunk.

Comment thread tests/kafkatest/services/performance/share_consumer_performance.py Outdated
@aheev

aheev commented Sep 18, 2025

Copy link
Copy Markdown
Contributor Author

@aheev This is what I get when I run the tests on your branch:

================================================================================
SESSION REPORT (ALL TESTS)
ducktape version: 0.12.0
session_id:       2025-09-16--001
run time:         68 minutes 36.085 seconds
tests run:        74
passed:           74
flaky:            0
failed:           0
ignored:          0
================================================================================

I do get the following warnings on trunk and your branch:

[WARNING - 2025-09-16 07:49:08,187 - service_registry - stop_all - lineno:53]: Error stopping service <ProducerPerformanceService-0-281473709848272: num_nodes: 1, nodes: ['ducker07']>: 1

I got similar results

@aheev

aheev commented Sep 18, 2025

Copy link
Copy Markdown
Contributor Author

The share_consumer_performance.py test file also needs changes to account for --messages changing into --num-records.

done

@aheev aheev changed the title KAFKA-19624: Improving consistency of command-line arguments for consumer performance tests KAFKA-19624: Improve consistency of command-line arguments for consumer performance tests Sep 18, 2025
@aheev

aheev commented Sep 20, 2025

Copy link
Copy Markdown
Contributor Author

@AndrewJSchofield addressed your comments. Can you please take a re-look?

@AndrewJSchofield AndrewJSchofield left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR. Looks good to me.

@AndrewJSchofield
AndrewJSchofield merged commit dbe9d34 into apache:trunk Sep 23, 2025
24 checks passed
@mkansara23

Copy link
Copy Markdown

Hi @AndrewJSchofield ,

I noticed 36 rename refactoring in your recent commit:

  • Variable Declaration Statement messagesReadByConsumer -> recordsReadByConsumer.
  • Single Variable Declaration totalMessagesRead -> totalRecordsRead.
  • Method Declaration updateMessagesConsumed -> updateRecordsConsumed.
  • Method Declaration numMessages -> numRecords.
  • Single Variable Declaration messagesRead -> recordsRead.
  • Field Declaration messagesConsumed -> recordsConsumed.
  • Single Variable Declaration lastMessagesRead -> lastRecordsRead.
  • Variable Declaration Statement messagesRead -> recordsRead.
  • Variable Declaration Statement totalMessagesRead -> totalRecordsRead.
  • Variable Declaration Statement numMessages -> numRecords.
  • Variable Declaration Statement lastMessagesRead -> lastRecordsRead.
  • Method Declaration messagesConsumed -> recordsConsumed.
  • Variable Declaration Statement intervalMessagesRead -> intervalRecordsRead.
  • Single Variable Declaration messagesConsumed -> recordsConsumed.
  • Method Declaration consumeMessagesForSingleShareConsumer -> - consumeRecordsForSingleShareConsumer.
  • Variable Declaration Statement intervalMessagesPerSec -> intervalRecordsPerSec.

How did you identify that these 36 elements were connected and should be renamed together?

  • Did you find this task challenging in any way?
  • Did you perform the renames manually or with tools?
  • Would it be helpful if tools could detect and rename connected program elements together instead of one by one?

@AndrewJSchofield

Copy link
Copy Markdown
Member

@mkansara23 The code changes were performed by @aheev. Maybe they have an opinion.

@aheev

aheev commented Sep 29, 2025

Copy link
Copy Markdown
Contributor Author

Hi @AndrewJSchofield ,

I noticed 36 rename refactoring in your recent commit:

  • Variable Declaration Statement messagesReadByConsumer -> recordsReadByConsumer.
  • Single Variable Declaration totalMessagesRead -> totalRecordsRead.
  • Method Declaration updateMessagesConsumed -> updateRecordsConsumed.
  • Method Declaration numMessages -> numRecords.
  • Single Variable Declaration messagesRead -> recordsRead.
  • Field Declaration messagesConsumed -> recordsConsumed.
  • Single Variable Declaration lastMessagesRead -> lastRecordsRead.
  • Variable Declaration Statement messagesRead -> recordsRead.
  • Variable Declaration Statement totalMessagesRead -> totalRecordsRead.
  • Variable Declaration Statement numMessages -> numRecords.
  • Variable Declaration Statement lastMessagesRead -> lastRecordsRead.
  • Method Declaration messagesConsumed -> recordsConsumed.
  • Variable Declaration Statement intervalMessagesRead -> intervalRecordsRead.
  • Single Variable Declaration messagesConsumed -> recordsConsumed.
  • Method Declaration consumeMessagesForSingleShareConsumer -> - consumeRecordsForSingleShareConsumer.
  • Variable Declaration Statement intervalMessagesPerSec -> intervalRecordsPerSec.

How did you identify that these 36 elements were connected and should be renamed together?

  • Did you find this task challenging in any way?
  • Did you perform the renames manually or with tools?
  • Would it be helpful if tools could detect and rename connected program elements together instead of one by one?

We wanted to get rid of message naming convention in tests, so while I was going through the tests, I just a did a search and replace for message keyword. Delegating the task to an AI agent would have been simpler though

Can I know what's the motive behind your query?

@mkansara23

mkansara23 commented Sep 29, 2025

Copy link
Copy Markdown

Hi @aheev ,
I noticed 36 rename refactoring in your recent commit:

  • Variable Declaration Statement messagesReadByConsumer -> recordsReadByConsumer.
  • Single Variable Declaration totalMessagesRead -> totalRecordsRead.
  • Method Declaration updateMessagesConsumed -> updateRecordsConsumed.
  • Method Declaration numMessages -> numRecords.
  • Single Variable Declaration messagesRead -> recordsRead.
  • Field Declaration messagesConsumed -> recordsConsumed.
  • Single Variable Declaration lastMessagesRead -> lastRecordsRead.
  • Variable Declaration Statement messagesRead -> recordsRead.
  • Variable Declaration Statement totalMessagesRead -> totalRecordsRead.
  • Variable Declaration Statement numMessages -> numRecords.
  • Variable Declaration Statement lastMessagesRead -> lastRecordsRead.
  • Method Declaration messagesConsumed -> recordsConsumed.
  • Variable Declaration Statement intervalMessagesRead -> intervalRecordsRead.
  • Single Variable Declaration messagesConsumed -> recordsConsumed.
  • Method Declaration consumeMessagesForSingleShareConsumer -> - consumeRecordsForSingleShareConsumer.
  • Variable Declaration Statement intervalMessagesPerSec -> intervalRecordsPerSec.

How did you identify that these 36 elements were connected and should be renamed together?

  • Did you find this task challenging in any way?
  • Did you perform the renames manually or with tools?
  • Would it be helpful if tools could detect and rename connected program elements together instead of one by one?

We wanted to get rid of message naming convention in tests, so while I was going through the tests, I just a did a search and replace for message keyword. Delegating the task to an AI agent would have been simpler though

Can I know what's the motive behind your query?

Thank you for your response! I am conducting a study to understand patterns and challenges in cluster-renames—situations where multiple related program elements are renamed together in the same commit.
The goal is to learn how developers approach these cluster-renames and whether parts of this process can be supported or automated through AI Agents.

If you were to estimate, how long did those renames take you, and what part of the process did you find the most challenging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants