我是用级联来做一个HashJoin两个300MB的文件。我执行以下级联工作流:
// select the field which I need from the first file
Fields f1 = new Fields("id_1");
docPipe1 = new Each( docPipe1, scrubArguments, new ScrubFunction( f1 ), Fields.RESULTS );
// select the fields which I need from the second file
Fields f2 = new Fields("id_2","category");
docPipe2 = new Each( docPipe2, scrubArguments, new ScrubFunction( f2), Fields.RESULTS );
// hashJoin
Pipe tokenPipe = new HashJoin( docPipe1, new Fields("id_1"),
docPipe2, new Fields("id_2"), new LeftJoin());
// count the number of each "category" based on the id_1 matching id_2
Pipe pipe = new Pipe(tokenPipe );
pipe = new GroupBy( pipe , new Fields("category"));
pipe = new Every( pipe, Fields.ALL, new Count(), Fields.ALL );我在Hadoop集群上运行这个级联程序,该集群有3个datanode,每个数据节点是8RAM和4个核心(我将mapred.child.java.opts设置为4096MB);但我需要大约30分钟才能得到最终结果。我认为它太慢了,但我认为在我的程序和集群中没有问题。怎样才能让这个级联连接更快呢?
发布于 2013-12-24 14:28:26
如级联用户指南中所述
HashJoin尝试将整个右侧流保存在内存中以便快速比较(而不仅仅是当前分组,因为没有为HashJoin执行分组).Thus右侧流中非常大的元组流可能会超过可配置的溢出到磁盘阈值,从而降低性能并可能导致内存错误。因此,建议使用右侧较小的流。
或
使用可能有帮助的CoGroup
发布于 2017-11-14 22:16:25
您的hadoop集群可能很忙,或者专用于其他工作,这可能会占用您的时间。我不认为用CoGroup替换HashJoin会对你有帮助,因为CoGroup是一个缩减端连接,而HashJoin做的是映射端连接,因此HashJoin的性能会比ConGroup更好。我认为您应该使用不太繁忙的集群再试一次,因为您的代码看起来也很好。
https://stackoverflow.com/questions/20433003
复制相似问题