apache-spark - 为什么增加 spark.sql.shuffle.partitions 会导致 FetchFailedException
问题描述
在设置 spark.sql.shuffle.partitions = 2700 时加入表时遇到 FetchFailedException
但是在设置 spark.sql.shuffle.partitions = 500 时运行成功。
据我所知,在随机读取时,增加 shuffle.partitions 会减少每个任务中的数据。
我错过了什么吗?
例外:
FetchFailed(BlockManagerId(699, nfjd-hadoop02-node120.jpushoa.com, 7337, None), shuffleId=4, mapId=59, reduceId=1140, message=
org.apache.spark.shuffle.FetchFailedException: failed to allocate 16777216 byte(s) of direct memory (used: 2147483648, max: 2147483648)
at org.apache.spark.storage.ShuffleBlockFetcherIterator.throwFetchFailedException(ShuffleBlockFetcherIterator.scala:554)
at org.apache.spark.storage.ShuffleBlockFetcherIterator.next(ShuffleBlockFetcherIterator.scala:485)
at org.apache.spark.storage.ShuffleBlockFetcherIterator.next(ShuffleBlockFetcherIterator.scala:64)
at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:435)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:441)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:409)
at org.apache.spark.util.CompletionIterator.hasNext(CompletionIterator.scala:31)
at org.apache.spark.InterruptibleIterator.hasNext(InterruptibleIterator.scala:37)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:409)
at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIteratorForCode
配置:
spark.executor.cores = 1
spark.dynamicAllocation.maxExecutors = 800
解决方案
在阅读了 shuffleFetch 的代码之后。
我遇到的问题是来自 ShuffleMapTask 的真正块太大而无法一次提取到内存中,并且来自驱动程序的块大小是平均块大小如果我的 shuffle 分区超过 2000(根据 spark.shuffle.minNumPartitionsToHighlyCompress )会更小然后是倾斜数据时的实际大小。
推荐阅读
- javascript - 将来自 ajax 请求的 JSON 结果存储到用于 Easyautocomplete 的 javascript 变量中
- java - Spring JPA Repository 合并而不是保存
- php - 多选自动完成文本框无法正常工作
- python-3.x - KeyError: ('', '发生在索引 0')
- ios - 将 UIBarButtonItem 转换为 UIButton
- c++ - cocos2d-x 3.17v中如何创建字符串数组
- mysql - .Net CLI MySQL RDS 连接失败
- webpack - Webpack 4 配置未显示源映射文件
- ios - 文本字段中有多少个字母和数字特殊字符
- amp-html - 如何使用 amp-img 将 webp 回退到 jpg?