用于处理非常小的工作的火花方法

问题描述 投票:-2回答:1

我们有350个小表,每个小表具有少于100条记录。.50大表,每个小表具有3亿条记录(20GB ORC大小)。我们为所有小表传递了1个执行程序+ 1个内核,1g执行程序内存和1g驱动程序内存。具有10个执行程序+ 10个内核,50g执行程序内存和2g驱动程序内存的大型表。在以负载平衡方式运行批处理时,整个批处理时间越来越多,并且整个批处理窗口的内存消耗也达到峰值。内存使用情况图显示为矩形。

[请告诉我,如何处理这种情况,以便为少于100条记录的小型表提供更少的内存。从oozie提交时,每10张小表放置一个大表,而批处理则花费3个小时(群集容量为6个节点,每个节点具有128个核心,总​​内存为1.35TB),并在顺序上进行了一些更改。请建议使用空闲方式,以减少批处理中的内存,并将时间从3小时减少。

apache-spark memory less
1个回答
0
投票

我的经验是,如果为小型表启动并行作业(即驱动程序代码中的并行),则会更有效地使用群集资源。在Scala中,看起来可能像这样:

// define transformations as (srcTable,targetTable and a transformation function which 
// reads the srcTable and saves the output in the targetTable
val transformations : Seq[(String,String, (String,String) => Unit)] = ???

val batchsize : Int  = ???

transformations
  .grouped(batchsize)
  .foreach(batch => batch.par // parallel job launches!
    .foreach{case (srcTable,tgtTable,transformation) => transformation(srcTable,tgtTable)}
  )
© www.soinside.com 2019 - 2024. All rights reserved.