[ https://issues.apache.org/jira/browse/KAFKA-938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sam Meder updated KAFKA-938: ---------------------------- Attachment: timeunit.patch > High CPU usage when more or less idle > ------------------------------------- > > Key: KAFKA-938 > URL: https://issues.apache.org/jira/browse/KAFKA-938 > Project: Kafka > Issue Type: Bug > Components: core > Affects Versions: 0.8 > Reporter: Sam Meder > Priority: Critical > Fix For: 0.8 > > Attachments: timeunit.patch > > > We've noticed Kafka using a lot of CPU in a pretty much idle environment and > tracked it down to it's DelayedItem implementation. In particular, the time > conversion for how much longer to wait: > def getDelay(unit: TimeUnit): Long = { > val elapsedMs = (SystemTime.milliseconds - createdMs) > unit.convert(max(delayMs - elapsedMs, 0), unit) > } > does not actually convert, so Kafka ends up treating a ms value like > nanoseconds, e.g. waking up every 100 ns or so. The above code should really > be: > def getDelay(unit: TimeUnit): Long = { > val elapsedMs = (SystemTime.milliseconds - createdMs) > unit.convert(max(delayMs - elapsedMs, 0), TimeUnit.MILLISECONDS) > } > I'll attach a patch. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira