[ 
https://issues.apache.org/jira/browse/KAFKA-5766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149087#comment-16149087
 ] 

Sebastian Bernauer commented on KAFKA-5766:
-------------------------------------------

Still the same problem

Kafka version 0.11.0.0 (for Scala 2.11; recommended) 

my dependency:

{noformat}
        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka</artifactId>
            <version>1.2.2.RELEASE</version>
        </dependency>
{noformat}

My complete code:

{code:java}
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.serialization.StringDeserializer;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class Main {

    public static void main(String[] args) {
        Map<String, Object> configs = new HashMap<>();
        configs.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
        configs.put(ConsumerConfig.GROUP_ID_CONFIG, "gh399");
        configs.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, 
StringDeserializer.class);
        configs.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, 
StringDeserializer.class);
        configs.put(ConsumerConfig.RETRY_BACKOFF_MS_CONFIG, 500);
        configs.put(ConsumerConfig.RECONNECT_BACKOFF_MS_CONFIG, 500);

        KafkaConsumer<String, String> consumer = new KafkaConsumer<>(configs);
        consumer.assign(Collections.singletonList(new TopicPartition("foo", 
0)));
        while (true) {
            ConsumerRecords<String, String> records = consumer.poll(1000);
            System.out.println(records.count());
        }
    }
}
{code}


> Very high CPU-load of consumer when broker is down
> --------------------------------------------------
>
>                 Key: KAFKA-5766
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5766
>             Project: Kafka
>          Issue Type: Bug
>          Components: consumer
>            Reporter: Sebastian Bernauer
>
> Hi,
> i have a single broker instance at localhost.
> I set up a Consumer with the following code:
> {code:java}
>         Map<String, Object> configs = new HashMap<>();
>         configs.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, 
> "localhost:9092");
>         configs.put(ConsumerConfig.GROUP_ID_CONFIG, "gh399");
>         configs.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, 
> StringDeserializer.class);
>         configs.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, 
> StringDeserializer.class);
>         KafkaConsumer<String, String> consumer = new KafkaConsumer<>(configs);
>         consumer.assign(Collections.singletonList(new TopicPartition("foo", 
> 0)));
>         while (true) {
>             ConsumerRecords<String, String> records = consumer.poll(1000);
>             System.out.println(records.count());
>         }
> {code}
> This works all fine, until i shut down the broker.
> If i do so, it causes a 100% CPU-load of my application.
> After starting the broker again the usage decreases back to a normal level. 
> It would be very nice if you could help me!
> Thanks,
> Sebastian
> Spring-Kafka: 2.0.0.M3
> Kafka: 0.10.2.0
> JDK: 1.8.0_121



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to