[jira] [Commented] (KAFKA-17100) GlobalStreamThread#start should not busy-wait
[ https://issues.apache.org/jira/browse/KAFKA-17100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17874809#comment-17874809 ] Ramin Gharib commented on KAFKA-17100: -- Hello [~gharris1727] I have created a PR using CountDownLatch: [https://github.com/apache/kafka/pull/16914] I used `wait/notify`, but the implementation is a bit bulkier. > GlobalStreamThread#start should not busy-wait > - > > Key: KAFKA-17100 > URL: https://issues.apache.org/jira/browse/KAFKA-17100 > Project: Kafka > Issue Type: Task > Components: streams >Reporter: Greg Harris >Assignee: Ela Bhattacharya >Priority: Minor > Labels: newbie > > The current GlobalStreamThread#start implementation > [https://github.com/apache/kafka/blob/25230b538841a5e7256b1b51725361dd59435901/streams/src/main/java/org/apache/kafka/streams/processor/internals/GlobalStreamThread.java#L456-L461] > is primarily a busy-wait loop, in which the thread repeatedly checks > stillInitializing() and sleeps for 1ms on each iteration. > This wastes CPU cycles, and instead some synchronizer should be used. This > could be wait()/notify(), a Condition, a CountDownLatch, a Future, for some > examples. I don't know which of these is best for this situation, since it > appears that both stillInitializing == false and startupException != null are > both conditions for exiting the loop. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (KAFKA-17100) GlobalStreamThread#start should not busy-wait
[ https://issues.apache.org/jira/browse/KAFKA-17100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17863980#comment-17863980 ] kangning.li commented on KAFKA-17100: - hi [~gharris1727] , If you are not start working on this issue, I would like to handle it. thanks > GlobalStreamThread#start should not busy-wait > - > > Key: KAFKA-17100 > URL: https://issues.apache.org/jira/browse/KAFKA-17100 > Project: Kafka > Issue Type: Task > Components: streams >Reporter: Greg Harris >Priority: Minor > Labels: newbie > > The current GlobalStreamThread#start implementation > [https://github.com/apache/kafka/blob/25230b538841a5e7256b1b51725361dd59435901/streams/src/main/java/org/apache/kafka/streams/processor/internals/GlobalStreamThread.java#L456-L461] > is primarily a busy-wait loop, in which the thread repeatedly checks > stillInitializing() and sleeps for 1ms on each iteration. > This wastes CPU cycles, and instead some synchronizer should be used. This > could be wait()/notify(), a Condition, a CountDownLatch, a Future, for some > examples. I don't know which of these is best for this situation, since it > appears that both stillInitializing == false and startupException != null are > both conditions for exiting the loop. -- This message was sent by Atlassian Jira (v8.20.10#820010)