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

Nicolas Perrin commented on FLINK-35210:
----------------------------------------

I see your point.


Unfortunately, the issue only appeared in production settings in the context of 
a 1.15 to 1.16 migration and we only could guess that this migration implied 
more memory load on the instances, leading to disk spilling and eventually 
unresponsive instances. We tested tweaking all the parameters that changed with 
the migration so the behaviour would be the same as it used to be but nothing 
worked apart reducing the local parallelism for the kafka source operators and 
the global parallelism to match the number of instances.

Just to be sure I understand it well: when the parallelism of a kafka source is 
bigger that the number of Kafka partitions, the reading task from no partition 
will:
 * be part of a task slot in case of slot sharing and therefore won't waste 
memory as this task slot will be used by other tasks,
 * have a dedicated task slot in case of non slot sharing and therefore will 
waste the dedicated memory.

However, in the first case the memory footprint won't be the same across nodes 
as the nodes that contain a task slot reading from an existing partition will 
require more memory than the others.

Is my understanding correct?

> Give the option to set automatically the parallelism of the KafkaSource to 
> the number of kafka partitions
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-35210
>                 URL: https://issues.apache.org/jira/browse/FLINK-35210
>             Project: Flink
>          Issue Type: Improvement
>          Components: Connectors / Kafka
>            Reporter: Nicolas Perrin
>            Priority: Minor
>
> Currently the setting of the `KafkaSource` Flink's operator parallelism needs 
> to be manually chosen which can leads to highly skewed tasks if the developer 
> doesn't do this job.
> To avoid this issue, I propose to:
> -  retrieve dynamically the number of partitions of the topic using 
> `KafkaConsumer.
> partitionsFor(topic).size()`,
> - set the parallelism of the stream built from the source based on this value.
>  This way there won't be any idle tasks.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to