当前位置:   article > 正文

Spark性能调优案例-优化spark估计表大小失败 和 小表关联 走 broadcast join_spark 小表关联大表 优化

spark 小表关联大表 优化

背景

A任务中关联一张表,该表经过过滤和去重,数据量小于10MB,实际任务耗时较长。
B任务关联一张小表,实际任务耗时较长

排查思路

A任务排查

查看spark UIsql界面:
问题1:发现并没有走广播join
观察此处join,对于76条数据的表,估计的大小超过10M,实际76条数据大小小于spark.sql.autoBroadcastJoinThreshold的值,导致这个问题的原因在对于broadcast join的官方介绍中提到,

参数名 默认值 说明
spark.sql.autoBroadcastJoinThreshold 10485760 (10 MB) Configures the maximum size in bytes for a table that will be broadcast to all worker nodes when performing a join. By setting this value to -1 broadcasting can be disabled. Note that currently statistics are only supported for Hive Metastore tables where the command ANALYZE TABLE COMPUTE STATISTICS noscan has been run.

由于脚本中存在中间的计算,导致不能正确的估算表的大小,

B任

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/724990
推荐阅读
相关标签
  

闽ICP备14008679号