It will take a while for kafka to consume the data.

Why do you use the kafka client script written by python to produce data as soon as the program runs, but it takes a while to consume the data (there is data in the topic). (both pykafka and confluentKafka are the same)

there is only a very small probability that the data can be consumed immediately, and most of them have to wait a few minutes, which affects the efficiency of the test.

  • A consumer object given to confluentKafka encapsulated by itself

  • topic

Mar.20,2021

not for a few minutes. Can you post the code


https://stackoverflow.com/que. at the bottom of the answer, pay attention to the setting of the session.timeout.ms parameter in conf.


when you instantiate the consumer object, you add these two parameters, session_timeout_ms=6000,heartbeat_interval_ms=2000

.
consumer = KafkaConsumer(self.kafkatopic, group_id = self.groupid,
                                      bootstrap_servers = '{kafka_host}:{kafka_port}'.format(
            kafka_host=self.kafkaHost,
            kafka_port=self.kafkaPort
            ),
                                      session_timeout_ms=6000,
                                      heartbeat_interval_ms=2000)

there is an explanation of parameters on the official website python.readthedocs.io/en/master/apidoc/KafkaConsumer.html" rel=" nofollow noreferrer "> https://kafka-python.readthed.
is mainly this sentence:" If no heartbeats are received by the broker before the expiration of this session timeout, then the broker will remove this consumer from the group and initiate a rebalance. "
in addition, the default value of the local session_timeout_ms is 30s, not the 10s mentioned in the official website!


excuse me, have you solved your problem? When I consume kafka data, I traverse the messages and there is no response. Can you help me out?


Hello, have you solved your problem? I have the same problem as you. I changed the parameters but did not solve

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39372-2c1a4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39372-2c1a4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?