产生非常小的工作的火花方法

时间:2020-01-26 11:46:23

标签: apache-spark memory less

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

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

1 个答案:

答案 0 :(得分: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)}
  )