You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Sam Meder (JIRA)" <ji...@apache.org> on 2013/06/11 23:42:20 UTC
[jira] [Updated] (KAFKA-938) High CPU usage when more or less idle
[ https://issues.apache.org/jira/browse/KAFKA-938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sam Meder updated KAFKA-938:
----------------------------
Status: Patch Available (was: Open)
> 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