-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
@@ -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 -----------------------"); |
There was a problem hiding this comment.
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) -----------------------")
There was a problem hiding this comment.
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.
There was a problem hiding this 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); |
There was a problem hiding this comment.
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.
site2/docs/reference-cli-tools.md
Outdated
@@ -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| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|`-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| |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this 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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Motivation
Add new option
--num-messages
for aconsumer
andreader
in pulsar-perf, and allow users to set the number of messages to consume in total.Modifications
--num-messages
inPerformanceConsumer
andPerformanceReader
--num-messages
, directly print the aggregated data and exitDocumentation
Need to update docs