KAFKA-6743 ConsumerPerformance fails to consume all messages #4818
Conversation
Remove consumer offset reset on startup
f14792b to
5891628
Compare
hachikuji
left a comment
There was a problem hiding this comment.
Thanks for the patch. Left one comment. Also, maybe we can change the title? Does this patch have anything to do with offset reset behavior?
| val printMetricsOpt = parser.accepts("print-metrics", "Print out the metrics. This only applies to new consumer.") | ||
| val showDetailedStatsOpt = parser.accepts("show-detailed-stats", "If set, stats are reported for each reporting " + | ||
| "interval as configured by reporting-interval") | ||
| val pollLoopTimeoutOpt = parser.accepts("polling-loop-timeout", "Consumer polling loop timeout.") |
There was a problem hiding this comment.
The performance tool is part of the public API, so adding new options requires a short KIP.
To be honest, the default timeout of 1 second doesn't make much sense to me. I would probably consider either removing the timeout entirely or at least increasing it to something more substantial (say one minute). If we decide to keep it, we should add a message to indicate that the tool exited before consuming all messages.
There was a problem hiding this comment.
Jason, thanks a lot for your remark. I'll be back in a while with new KIP.
There was a problem hiding this comment.
Thanks! I left a few comments on the dev list.
There was a problem hiding this comment.
I've updated the KIP number to show the correct number KIP-281
There was a problem hiding this comment.
@hachikuji please, review this one
@MosheBlumbergX thank you!
Waiting for some more feedback on KIP-281, friends.
Thanks
There was a problem hiding this comment.
@rootex- Sorry, sent my initial response to the wrong thread. I've replied to the right one now.
There was a problem hiding this comment.
@hachikuji No problem, appreciate for your feedback!
…imeout to 10 seconds, updated the warning message
|
@rootex- Thanks for the updates. Can you reply to the KIP thread? Since there haven't been many comments, you can probably go ahead and start a vote. |
|
@hachikuji Thank you for the quick response, just replied to the KIP [DISCUSS] thread. And started the KIP [VOTE] thread |
| } | ||
| if (messagesRead < count) | ||
| println(s"WARNING: Exiting before consuming the expected number of messages: timeout ($timeout ms) exceeded. " + | ||
| s"Probably too much time spent on processing a polled list of records. Be sure to increase the --timeout option") |
There was a problem hiding this comment.
Nit: Missing "." at the end.
There was a problem hiding this comment.
I also wonder if this is the right place to print this message. Perhaps this should be outside the while loop?
There was a problem hiding this comment.
@dhruvilshah3, my bad, thank you for pointing this out. Updated
|
Thanks for the PR! Left a minor comment, otherwise LGTM. |
|
Relates to #4082 |
| val printMetricsOpt = parser.accepts("print-metrics", "Print out the metrics. This only applies to new consumer.") | ||
| val showDetailedStatsOpt = parser.accepts("show-detailed-stats", "If set, stats are reported for each reporting " + | ||
| "interval as configured by reporting-interval") | ||
| val pollLoopTimeoutOpt = parser.accepts("timeout", "Consumer polling loop timeout.") |
There was a problem hiding this comment.
Can we make this more descriptive? How about this?
The maximum allowed time between returned records
Also, maybe we can change the name to recordFetchTimeout or something like that?
There was a problem hiding this comment.
Could we also mention that the timeout is in milliseconds? And perhaps also name the variable recordFetchTimeoutMs.
There was a problem hiding this comment.
Hello, guys. Sure, I'll take care of that today.
Would you like to apply changes for both the variable name and the UI parameter? If yes, then KIP should be updated too.
Thanks for closing the vote session. Been away for a while, I have more time now.
|
@rootex- I went ahead and called the vote. I'm going to go ahead and push a change to this branch to move things along. |
|
@hachikuji Jason, thanks for closing the vote session. I'll push the changes today. |
|
@rootex- Thanks, I can merge once the changes are ready. |
|
@hachikuji Jason, would you like to apply changes for both the variable name |
|
@rootex- Oh, I was actually referring to the variable |
…Timeout description
…errors.TimeoutException. Supported versions: kafka 0.11 and newer
|
@hachikuji Jason, thanks for explaining. It's all done now 👌 If everything's fine, let's merge it right away 👍 |
hachikuji
left a comment
There was a problem hiding this comment.
LGTM, thanks for the patch! Note that i made a minor tweak to the warning message.
…1] (apache#4818) This patch implements KIP-281, which adds a configurable timeout to the consumer performance tool with a default value of 10 seconds. The old timeout was hard-coded as 1 second. Additionally, this patch adds a warning message when the tool exits after a timeout rather than returning silently. Reviewers: Dhruvil Shah <dhruvil@confluent.io>, Jason Gustafson <jason@confluent.io>
ConsumerPerformance fails to consume all messages
on topics with large number of partitions due to a relatively short default polling loop timeout (1000 ms) that is not reachable and modifiable by the end user.
Demo
Create a topic of 10 000 partitions, send a 50 000 000 of 100 byte records using kafka-producer-perf-test and consume them using kafka-consumer-perf-test (ConsumerPerformance). You will likely notice that the number of records returned by the kafka-consumer-perf-test is many times less than expected 50 000 000.
This happens due to specific ConsumerPerformance implementation. As the result, in some rough cases it may take a long enough time to process/iterate through the records polled in batches, thus, the time may exceed the default hardcoded polling loop timeout and this is probably not what we want from this utility.
Possible options
KAFKA-6743: ConsumerPerformance fails to consume all messages on topics with large number of partitions
KIP-281: ConsumerPerformance: Increase Polling Loop Timeout and Make It Reachable by the End User
Result
bin/kafka-consumer-perf-test.sh... --polling-loop-timeout <TIME_IN_MS>Committer Checklist (excluded from commit message)