Greg Harris created KAFKA-17100: ----------------------------------- Summary: 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
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)