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

Martijn Visser commented on FLINK-26379:
----------------------------------------

The Flink Kafka Producer has been deprecated and replaced by the Kafka Sink. 
Could you check if this would solve your problem?

> First message produced via Flink Kafka Connector is slow
> --------------------------------------------------------
>
>                 Key: FLINK-26379
>                 URL: https://issues.apache.org/jira/browse/FLINK-26379
>             Project: Flink
>          Issue Type: Improvement
>          Components: Connectors / Kafka
>    Affects Versions: 1.14.3
>            Reporter: Ragu Krishnamurthy
>            Priority: Major
>
> Topic partition map is initialized when the first message is processed rather 
> then constructor
>  
> *Code at constructor*
> [https://github.com/apache/flink/blob/5c6a220cc5e63b3c308e394b9199fb7740c08539/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer.java#L740]
> {code:java}
>         this.topicPartitionsMap = new HashMap<>(); {code}
>  
> *Code at invoke method*
> [https://github.com/apache/flink/blob/5c6a220cc5e63b3c308e394b9199fb7740c08539/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer.java#L879]
> {code:java}
>  int[] partitions = topicPartitionsMap.get(targetTopic);            
> if (null == partitions) {                
>  partitions = getPartitionsByTopic(targetTopic, transaction.producer);        
>              topicPartitionsMap.put(targetTopic, partitions);            
> } {code}
> Can this behavior be changed?



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to