in-mapper combining

Data-Intensive Text Processing with MapReduce中关于mapReduce算法的本地聚合优化策略中提到的in-mapper combining算法的优点是:1、可以控制什么时候做聚合操作以及如何做,相反,如果是单独跑一个combiner的话,并能框架会调用combiner多少次,也许没有调用,也许调用很多次。2in-mapper combining更加高效,单独跑一个combiner的话是在map之后,只能减少网络传输的中间数据并不能减少key-value pairs。而在in-mapper combining中一个key只有一个value

但是in-mapper combining也有两个缺点,1、中断编程框架 2、可扩展性的瓶颈,因为要有足够的内存来存储中间数据

解决in-mapper combining时的内存紧张的方案有两个:1、定期的将内存中固定大小的key-value pairs写会磁盘 2、检测内存的使用率,当达到一定的量时,将内存数据写回磁盘

1: class Mapper
2: method Initialize
3: H new AssociativeArray
4: method Map(docid a; doc d)
5: for all term t  doc d do
6: H{t} H{t} + 1 . //Tally counts across documents
7: method Close
8: for all term t H do
9: Emit(term t; count H{t})

 

你可能感兴趣的:(mapreduce,框架,算法,Class,processing,磁盘)