Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[testclient] Add new option --num-messages for consumer and reader #12016

Merged
merged 1 commit into from
Sep 14, 2021
Merged

[testclient] Add new option --num-messages for consumer and reader #12016

merged 1 commit into from
Sep 14, 2021

Conversation

yuruguo
Copy link
Contributor

@yuruguo yuruguo commented Sep 12, 2021

Motivation

Add new option --num-messages for a consumer and reader in pulsar-perf, and allow users to set the number of messages to consume in total.

Modifications

  • Add new option --num-messages in PerformanceConsumer and PerformanceReader
  • When the amount of data consumed exceeds the --num-messages, directly print the aggregated data and exit

Documentation

Need to update docs

@@ -293,6 +297,11 @@ public static void main(String[] args) throws Exception {
PerfClientUtils.exit(0);
}
}
if (arguments.numMessages > 0 && totalMessagesReceived.sum() >= arguments.numMessages) {
log.info("------------------- DONE -----------------------");
Copy link
Contributor

@gaoran10 gaoran10 Sep 12, 2021

Choose a reason for hiding this comment

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

Could we add a hint that why the perf tool is done?

Such as log.inf("------------------- DONE (reach consume message num in total) -----------------------")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion, I have added hints to all the places where the number of messages and the test duration are reached.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

Lgtm

@MMirelli ptal

if (arguments.numMessages > 0 && totalMessagesReceived.sum() >= arguments.numMessages) {
log.info("------------------- DONE -----------------------");
printAggregatedStats();
PerfClientUtils.exit(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a dummy 'return' statement.

@yuruguo yuruguo requested a review from gaoran10 September 13, 2021 02:50
@@ -437,6 +437,7 @@ Options
|`-v`, `--encryption-key-value-file`|The file which contains the private key to decrypt payload||
|`-h`, `--help`|Help message|false|
|`--conf-file`|Configuration file||
|`-m`, `--num-messages`|Number of messages to consume in total. If <= 0, it will keep consuming.|0|
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
|`-m`, `--num-messages`|Number of messages to consume in total. If <= 0, it will keep consuming.|0|
|`-m`, `--num-messages`|Number of messages to consume in total. If the value is equal to or smaller than 0, it keeps consuming messages.|0|

Copy link
Member

Choose a reason for hiding this comment

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

Please keep consistent in other descriptions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Anonymitaet Anonymitaet added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Sep 13, 2021
@yuruguo yuruguo requested a review from Anonymitaet September 13, 2021 09:20
Copy link
Contributor

@315157973 315157973 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -240,7 +238,8 @@ public void run() {

// Acquire 1 sec worth of messages to have a slower ramp-up
rateLimiter.acquire((int) msgRate);
final long startTime = System.currentTimeMillis();
final long startTime = System.nanoTime();
final long testEndTime = startTime + (long) (arguments.testTime * 1e9);
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend using TimeUnit.SECONDS.toNanos() instead of 1e9 to make it more understandable to other developers

Copy link
Contributor

@congbobo184 congbobo184 left a comment

Choose a reason for hiding this comment

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

LGTM!

@congbobo184 congbobo184 merged commit e588122 into apache:master Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tool doc Your PR contains doc changes, no matter whether the changes are in markdown or code files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants