一种Hadoop小文件存储优化策略研究

2015-04-29 00:44:03杜忠晖何慧王星
智能计算机与应用 2015年3期

杜忠晖 何慧 王星

摘 要:随着“大数据”时代的到来,Hadoop等大数据处理平台也应运而生。但其存储载体——Hadoop分布式文件系统却在海量小文件存储方面存在着很大缺陷,存储海量小文件会导致整个集群的负载增高、运行效率下降。为了解决这一针对小文件的存储缺陷,通常的方法是将小文件进行合并,将合并后的大文件进行存储,但以往方法并未将文件体积大小分布加以利用,未能进一步提升小文件合并效果。本文提出一种基于数据块平衡的小文件合并算法,优化合并后的大文件体积分布,有效降低HDFS数据分块,从而减少集群主节点内存消耗、降低负载,使数据处理过程可以更高效的运行。

关键词:HDFS;小文件存储;小文件合并算法

中图分类号:TP391.41 文献标识号:A 文章编码:2095-2163(2015)03-

Research on Small Files Optimized Storage Strategy in Hadoop System

DU Zhonghui, HE Hui, WANG Xing

(School of Computer Science and Technology, Harbin Institute of Technology, Harbin 150001, China)

Abstract: With the advent of "BIG data", big data processing platform such as Hadoop has emerged. But its storage carrier --Hadoop distributed file system has many significant flaws on the storage of mass small files, storing massive amounts of small files will not only increase the load of entire cluster, but also decrease operating efficiency. In order to solve the defect, the usual method is to merge small files to a big one, and then it will be stored instead. However, the conventional method does not take advantage of the volume size distribution, so it failed to further enhance the combined effect of small files. This paper presents a data block based on a balance of small files merging algorithm to optimize distribution of merged large files volume, which could effectively reducing the HDFS data block. Thereby the reducing of primary node memory consumption and running load will cause data processing can be run more efficiently.

Keywords: HDFS; Storage of Small Files; Small Files Merge Algorithm

0 引 言

在2012年,“大数据”开始在国内兴起、并普受关注,随后即公认为2013年则是中国的“大数据元年”[1]。根据ZDNET的数据显示[2],2013年中国产生的数据总量超过0.8ZB(相当于8亿TB),已两倍于2012年,具体来说就相当于2009年全球的数据总量。由此预计到2020年,中国产生的数据总量将是2013年的10倍,也就是必将超过8.5ZB。

Hadoop在诸如可伸缩性、健壮性、计算性能和成本上均具有无可替代的优势,并在事实上已然成为当前互联网企业大数据分析的主流平台[3]。Hadoop采用的是Hadoop分布式文件系统(Hadoop Distributed Filesystem,以下简称HDFS)来进行数据存储。但由于Hadoop集群利用了Namenode主节点存储集群中所有数据块的信息元数据,所以当存储对象变为体积在5MB以下的海量小文件时,Namenode节点的运行压力将会急剧上升——占用更多的内存来存储信息元数据;……

登录APP查看全文