纱线阿帕奇星火:输入数据文件的大量(火花合并多个输入文件) [英] Apache Spark on YARN: Large number of input data files (combine multiple input files in spark)

查看:173
本文介绍了纱线阿帕奇星火:输入数据文件的大量(火花合并多个输入文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要一个用于实施最佳实践帮助。
运行环境如下:

A help for the implementation best practice is needed. The operating environment is as follows:


  • 日志数据文件到达不规则。

  • 日志数据文件的大小是从3.9KB到8.5MB。平均约为1MB。

  • 的一个数据文件的记录的数量是从13行到22000线。平均约为2700线。

  • 聚合前
  • 数据文件必须进行后处理。

  • 后期处理算法是可以改变的。

  • 处理后
  • 文件与原始的数据文件分开管理,由于后处理算法可能被改变。

  • 每日聚集执行。所有后处理的数据文件必须经过过滤记录被记录和汇总(平均,最大最小...)进行计算。

  • 由于聚集是细粒,记录的聚合后的数量不那么小。它可以是大约原来的记录的数量的一半。

  • 在一个点上,后处理的文件的数目可以是约200,000。

  • 的数据文件应该能够单独删除。

在一个测试中,我试图通过星火开始sc.textFile()与水珠路径来处理16万后处理文件时,它失败,在司机的过程OutOfMemory例外。

In a test, I tried to process 160,000 post-processed files by Spark starting with sc.textFile() with glob path, it failed with OutOfMemory exception on the driver process.

什么是处理这种数据的最佳做法?
我应该使用HBase的,而不是简单的文件,以节省后期处理的数据?

What is the best practice to handle this kind of data? Should I use HBase instead of plain files to save post-processed data?

推荐答案

我们写自己的装载机。它解决了我们的问题,在HDFS小文件。它采用Hadoop的CombineFileInputFormat。
在我们的情况下,它减少了映射器的数量从100000到约3000和显著更快取得作业。

We wrote own loader. It solved our problem with small files in HDFS. It uses Hadoop CombineFileInputFormat. In our case it reduced the number of mappers from 100000 to approx 3000 and made job significantly faster.

<一个href=\"https://github.com/RetailRocket/SparkMultiTool\">https://github.com/RetailRocket/SparkMultiTool

例如:

import ru.retailrocket.spark.multitool.Loaders 
val sessions = Loaders.combineTextFile(sc, "file:///test/*") 
// or val sessions = Loaders.combineTextFile(sc, conf.weblogs(), size = 256, delim = "\n") 
// where size is split size in Megabytes, delim - line break character 
println(sessions.count())

这篇关于纱线阿帕奇星火:输入数据文件的大量(火花合并多个输入文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆