You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "kangning.li (Jira)" <ji...@apache.org> on 2024/07/09 01:31:00 UTC

[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)