为什么在结构化流中每个阶段最多要处理200个任务?

问题描述 投票:0回答:1

我有一个在yarn模式下运行的spark结构化流应用程序。

我正在尝试减少任务数量,并且我注意到大多数阶段都有200个任务。并且我已经设置了--conf "spark.sql.shuffle.partitions=40" --conf "spark.default.parallelism=40",但这不起作用。

类似的代码:

df.withWatermark("ts", "5 minutes")
    .groupBy(window($"ts", "5 minutes"),  $"user",... )
    .agg(count($"A"), sum($"B"))
    .select("window.start", "window.end",... )
    .writeStream
    .outputMode("update")
    .foreach(writer())
    .option("checkpointLocation", checkpointDir)
    .trigger()
    .start()
scheduled-tasks shuffle spark-structured-streaming
1个回答
0
投票

任务是分区上的一项工作/过程。在给定阶段的理想情况下,任务数与分区数成正比。因此,请检查您DataFrame中的分区数。希望这可以帮助。

syntax: df.rdd.getNumPartitions
© www.soinside.com 2019 - 2024. All rights reserved.