【问题标题】:Thrift driver OutOfMemory when running multiple Hive queries simultaneously同时运行多个 Hive 查询时的 Thrift 驱动程序 OutOfMemory
【发布时间】:2018-03-24 00:10:43
【问题描述】:

我们使用 Spark2 Thrift 来运行 Hive 查询。

Thrift 是 HDP 2.6 的一部分,我们的 spark 版本是 2.1.0.2.6.0.3-8。

我们同时运行的查询越多,我们在驱动程序中遇到 OOM 的速度就越快。这些查询还包含 JOIN 和 UNION。

从 jstat 看来,似乎没有内存泄漏,但是无论给驱动程序多少内存,似乎永远都不够。同时运行的查询越多,Thrift 驱动程序开始执行完整 GC 直到崩溃的速度越快,因为完整 GC 无法清理旧内存(因为它正在被使用)。

OOM 永远不会发生在执行程序中,只会发生在驱动程序中。

是否有人使用 Thrift over spark 并遇到此问题?如果是这样 - 如何将 Thrift 驱动程序配置为在同时运行多个查询时不会在 OOM 上崩溃?

这些是我们使用的配置:

节俭火花驱动器:

  • spark.driver.memory=15g

Thrift 火花执行器:

  • spark.executor.memory=10g

  • 核数 = 7

来自 /usr/hdp/current/spark2-thriftserver/conf/spark-thrift-sparkconf.conf 的配置参数:

  • spark.broadcast.blockSize 32m

  • spark.driver.extraLibraryPath /usr/hdp/current/hadoop-client/lib/native:/usr/hdp/current/hadoop-client/lib/native/Linux-amd64-64

  • spark.driver.maxResultSize 0

  • spark.dynamicAllocation.enabled true

  • spark.dynamicAllocation.executorIdleTimeout 45s

  • spark.dynamicAllocation.initialExecutors 2

  • spark.dynamicAllocation.maxExecutors 15

  • spark.dynamicAllocation.minExecutors 0

  • spark.dynamicAllocation.schedulerBacklogTimeout 1s

  • spark.eventLog.dir hdfs:///spark2-history/

  • spark.eventLog.enabled true

  • spark.executor.extraLibraryPath /usr/hdp/current/hadoop-client/lib/native:/usr/hdp/current/hadoop-client/lib/native/Linux-amd64-64

  • spark.executor.memory 10g

  • spark.files.maxPartitionBytes 268435456

  • spark.files.openCostInBytes 33554432

  • spark.hadoop.cacheConf false

  • spark.history.fs.logDirectory hdfs:///spark2-history/

  • spark.history.provider org.apache.spark.deploy.history.FsHistoryProvider

  • spark.kryoserializer.buffer.max 2000m

  • spark.master 纱线客户端

  • spark.memory.offHeap.enabled true

  • spark.memory.offHeap.size 104857600

  • spark.scheduler.allocation.file /usr/hdp/current/spark2-thriftserver/conf/spark-thrift-fairscheduler.xml

  • spark.scheduler.mode 公平

  • spark.shuffle.service.enabled true

  • spark.sql.autoBroadcastJoinThreshold 1073741824

  • spark.sql.shuffle.partitions 100

  • spark.storage.memoryMapThreshold 8m

【问题讨论】:

  • 我猜“Spark over Thrift”这个词更合适。
  • @elad-eldor 你有没有找到解决办法?

标签: out-of-memory thrift apache-spark-2.0


【解决方案1】:

尝试将调度程序模式更改为 FIFO。

另外,不要忘记内存中有 2 个不同的区域: - 贮存 - 执行

存储将默认使用 60% 的驱动程序内存,因此如果您从不缓存数据,请减少它以在需要的地方提供更多内存(他们说它是自动完成的,但是......)。

如果可能,尝试将 spark shuffle 分区减少到 100,然后减少到 10。

尝试堆外(从未测试过,但可以提供帮助)。

【讨论】:

  • 为什么 FIFO 比 FAIR 更好?另外 - 你的意思是使用 10 个随机分区而不是 100 个?
  • FIFO 更适合资源(因为一次运行单个查询)。我发现对于小工作负载减少 Spark 分区会更好,试试看,在 webUI 上检查分区的大小,最大为 2Go,更少的分区意味着更少的 shuffle 操作(因此更少的资源使用)。
  • 我们拥有多用户环境,其中包含多个应该同时运行的查询。您是否建议在这样的环境中从 FAIR 更改为 FIFO?并将随机分区的数量从 100 个减少到 10 个?
猜你喜欢
  • 1970-01-01
  • 2017-03-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多