我需要改进我的mr工作,它使用hbase作为源和汇。。
基本上,我在mapper中从3个hbase表中读取数据,将它们写成一个巨大的字符串,以便reducer进行一些计算并转储到一个hbase表中。。
Table1 ~ 19 million rows.
Table2 ~ 2 million rows.
Table3 ~ 900,000 rows.
Map器的输出如下所示:
HouseHoldId contentID name duration genre type channelId personId televisionID timestamp
这是表1的一行。类似地,1900万个Map器输出。
我感兴趣的是根据householdind值对它进行排序,所以我使用这种技术。我对成对的v部分不感兴趣,所以我忽略了它。我的Map器类定义如下:
public static class AnalyzeMapper extends TableMapper<Text, IntWritable> { }
我的mr工作需要22个小时才能完成,这一点都不可取。我应该以某种方式优化它,让它跑得更快。。
scan.setCaching(750);
scan.setCacheBlocks(false);
TableMapReduceUtil.initTableMapperJob (
Table1, // input HBase table name
scan,
AnalyzeMapper.class, // mapper
Text.class, // mapper output key
IntWritable.class, // mapper output value
job);
TableMapReduceUtil.initTableReducerJob(
OutputTable, // output table
AnalyzeReducerTable.class, // reducer class
job);
job.setNumReduceTasks(RegionCount);
我的hbase表1有21个区域,因此产生了21个Map器。我们正在运行一个8节点的cloudera集群。
我做错什么了吗?
我应该使用自定义排序比较程序或组比较程序或类似的工具来提高效率吗?
暂无答案!
目前还没有任何答案,快来回答吧!