Big Data interview short answer questions (two) - MapReduce

What is the core idea 1.MapReduce?

分而治之,先分后和:将一个大的、复杂的工作或任务,拆分成多个小的任务,并行处理,最终进行合并。

2. What is the offset?

存储单元的实际地址与其所在段的段地址之间的距离称为段内偏移,也称为“有效地址或偏移量”.
或者说:存储单元的实际地址与其所在段的段地址之间的距离。
	  本质其实就是“实际地址与其所在段的段地址之间的距离”

What steps 3.shuffle contain?

1.partition partition
按照一定的分区规则,将key value的list进行分区。
2.Sort Ordering Default (lexicographical)
对分区内的数据进行排序,将数据传给Shuffle的combiner
3.combiner (Alternatively, partial polymerization)
对数据进行局部聚合,将数据传给Shuffle的Group.
4.Group (Merge)
 将相同key对应的key提取出来作为唯一的key,将相同key对应的value获取出来作为value的list,将数据传给Reduce

4.MR final results will start to write HDFS through which data is read from the steps?

InputFormat -> Split ->RR -> Map -> partition -> Sort -> Combiner -> Group -> reduce -> outputFormat

1.InputFormat 到hdfs上读取数据将数据传给Split
2.Split将数据进行逻辑切分,将数据传给 RR (recode reader)
3.RR将传入的数据转换成一行一行的数据,输出行首字母偏移量和偏移量对应的数据将数据传给MAP
4.MAP根据业务需求实现自定义代码将数据传给Shuffle的partition
5.partition按照一定的分区规则,将key value的list进行分区,把分区之后的结果传给sort.
6.sort对分区内的数据进行排序,将数据传给Shuffle的combiner.
7.combiner对数据进行局部聚合,将数据传给Shuffle的Group.
8. Group将相同key对应的key提取出来作为唯一的key,将相同key对应的value获取出来作为value的list,将数据传给Reduce.
9. 根据业务需求对传入的数据进行汇总计算,输出给Shuffle(outputFormat)
10.将数据写入HDFS

5. How to set the number of ReduceTask

(Number of Map can not be artificially set, may reduce the number of man-set)

job.setNumReduceTasks(2)

The role of 6.combiner

对数据进行局部聚合,减少带宽占用.

7.combiner running MapReduce in which end?

combiner运行在map端(group 运行在reduce端);

8.Maptask number of artificially set it?

Map的数量不能人为设置,reduce的数量可以人为设置

9. Map describes the output angle from the memory to the input process Reduce

1.Map的输出先写入环形缓冲区(默认大小100M-可以认为调整)(可以再输出的同时写入数据),当缓冲区内的数据
达到阈值(默认0.8-可以人为调整)时,对数据进行flash。
flash 出去的数据的数量达到一定量(默认4个)时,进行数据的合并,将合并之后的数据写入磁盘.

2.Reduce 主动发出拷贝进程(默认5个copy进程)到Map端获取数据。
获取到数据后,将数据写入内存,当数据达到阈值,将数据flash出去。
当flash出去文件达到一定的量时,进行数据的合并。最终将数据发送给reduce.

10. How can make the most efficient execution Map (MapReduce)

1.调大环形缓冲区的大小,100M 调到更大.
2.调大环形缓冲区阈值的大小.
3.对Map 输出的数据进行压缩.(数据在压缩和解压的过程中会消耗CPU)

11. How can make Reduce implementation of the most efficient (MapReduce)

1.尽量将所有的数据写入内存,在内存中进行计算.

12. The cluster tuning core ideas

在网络带宽和磁盘IO是瓶颈的前提下,

能不使用 IO 和 网络 , 就不使用.在必须使用的情况下,尽量减少IO和网络的使用.
所有的能够减少网络开销的,减少IO使用的可选项,都可以作为集群调优的可选项.
调优选项:
1.软件层面 
		(1)操作系统层面
		(2)集群层面
2.硬件层面
3.网络层面

Limited capacity, if there is something wrong I welcome message corrections.

Published 88 original articles · won praise 114 · Views 2988

Guess you like

Origin blog.csdn.net/hongchenshijie/article/details/103085655