Log warnings about high cpu usage when number of consumers is higher than partition count
I have two consumers for a topic that only has one partition. When the idle consumer is running it prints out a constant stream of: "_poll called with a non-zero timeout and sleep=False -- but there was nothing to do. This can cause high CPU usage during idle."
This is similar to issue #494 that had been fixed but it seems that commit b8c2097 broke it again. There is no way to pass the sleep=True parameter to the client object when calling the poll method of the KafkaConsumer object (in group.py). I tried changing line 465 of group.py to: self._client.poll(timeout_ms, sleep=True)
and then everything worked correctly again. I don't see the reason for commit b8c2097 so I don't know if this would break anything else.
I have the same issue.
Can you post code to reproduce + broker version? My quick tests locally do not reproduce this issue.
Here's a simple program that reproduces the issue when you run two instances in parallel: https://gist.github.com/akheron/890d0506b803abb3130b
Kafka version 2.11-0.9.0.0.
EDIT: The topic must have one partition to reproduce with two consumer instances.
ok - I was testing the iterator, not consumer.poll. I can reproduce this. Will fix.
Works like a charm, thanks!
I am on version 1.0.0, what version is the fix released in?
nvm, found it, 1.0.2
I still see the message with 1.0.2. Is the message still supposed to get printed?