Skip to content

BrokerConnection slow initialization in version >= 1.4.0 when using broker-version auto-detection #1468

@romulorosa

Description

@romulorosa

Hello everyone,

I've updated my kafka-python from 1.3.5 to 1.4.0 and could notice that a producer initialization in 1.4.0 is slower than in 1.3.5.

Using 1.3.5

In [1]: from kafka.producer.kafka import KafkaProducer
   ...: import time
   ...: 
   ...: start = time.time()
   ...: p = KafkaProducer(bootstrap_servers='kafka:9092')
   ...: end = time.time()
   ...: print(end - start)
   ...: 
0.12534785270690918

Using 1.4.0

In [1]: from kafka.producer.kafka import KafkaProducer
   ...: import time
   ...: 
   ...: start = time.time()
   ...: p = KafkaProducer(bootstrap_servers='kafka:9092')
   ...: end = time.time()
   ...: print(end - start)
   ...: 
1.1414685249328613

Also I've performed some tests using python profile and the result shows that poll method is taking more time to run.

Using 1.3.5

screenshot from 2018-04-03 16-04-54

Using 1.4.0

screenshot from 2018-04-03 16-04-17

Does anyone know the reason of this overhead?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions