gpt4 book ai didi

hadoop - Mapreduce 中的中间数据溢出(缓冲内存)

转载 作者:可可西里 更新时间:2023-11-01 14:22:51 28 4
gpt4 key购买 nike

我在 Hadoop 2.6.0 中运行一个字数统计作业,我发现 map 输出有几个溢出。

我有以下配置:

mapreduce.task.io.sort.mb = 100
mapreduce.map.sort.spill.percent = 0.80

运行作业后,Map 输出字节数 = 222660096。通过查看下面的容器日志,似乎缓冲区大小几乎是 31055173 字节而不是 100MB。

先spill spill入盘前查看参数值bufstart = 0; bufend = 31055173; bufvoid = 104857600

然后将 Map 输出以字节为单位除以 bufend (222660096/31055173 = 7.17 (= 8 spills))。

为什么会这样?缓冲区大小应为 80MB(软限制),所以我认为我应该只有 3 次溢出。另外,谁能对bufstartbufendbufvoid 给出更好的解释?

2016-03-04 20:38:16,678 INFO [main] org.apache.hadoop.mapred.MapTask: Processing split: hdfs://hmaster:9000/input/Input-128M:0+134217728
2016-03-04 20:38:16,842 INFO [main] org.apache.hadoop.mapred.MapTask (EQUATOR) 0 kvi 26214396(104857584)
2016-03-04 20:38:16,842 INFO [main] org.apache.hadoop.mapred.MapTask: mapreduce.task.io.sort.mb: 100
2016-03-04 20:38:16,842 INFO [main] org.apache.hadoop.mapred.MapTask: soft limit at 83886080
2016-03-04 20:38:16,842 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 0; bufvoid = 104857600
2016-03-04 20:38:16,842 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 26214396; length = 6553600
2016-03-04 20:38:16,854 INFO [main] org.apache.hadoop.mapred.MapTask: Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
2016-03-04 20:38:19,931 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output
2016-03-04 20:38:19,931 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 0; bufend = 31055173; bufvoid = 104857600
2016-03-04 20:38:19,931 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 26214396(104857584); kvend = 13006672(52026688); length = 13207725/6553600
2016-03-04 20:38:19,931 INFO [main] org.apache.hadoop.mapred.MapTask: (EQUATOR) 41540922 kvi 10385224(41540896)
2016-03-04 20:38:28,178 INFO [SpillThread] org.apache.hadoop.mapred.MapTask: Finished spill 0
2016-03-04 20:38:28,179 INFO [main] org.apache.hadoop.mapred.MapTask: (RESET) equator 41540922 kv 10385224(41540896) kvi 7763800(31055200)
2016-03-04 20:38:30,020 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output
2016-03-04 20:38:30,020 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 41540922; bufend = 72594952; bufvoid = 104857600
2016-03-04 20:38:30,020 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 10385224(41540896); kvend = 23391620(93566480); length = 13208005/6553600
2016-03-04 20:38:30,020 INFO [main] org.apache.hadoop.mapred.MapTask: (EQUATOR) 83080708 kvi 20770172(83080688)
2016-03-04 20:38:37,042 INFO [SpillThread] org.apache.hadoop.mapred.MapTask: Finished spill 1
2016-03-04 20:38:37,042 INFO [main] org.apache.hadoop.mapred.MapTask: (RESET) equator 83080708 kv 20770172(83080688) kvi 18148744(72594976)
2016-03-04 20:38:39,045 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output
2016-03-04 20:38:39,045 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 83080708; bufend = 9277592; bufvoid = 104857598
2016-03-04 20:38:39,045 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 20770172(83080688); kvend = 7562280(30249120); length = 13207893/6553600
2016-03-04 20:38:39,045 INFO [main] org.apache.hadoop.mapred.MapTask: (EQUATOR) 19763348 kvi 4940832(19763328)
2016-03-04 20:38:46,376 INFO [SpillThread] org.apache.hadoop.mapred.MapTask: Finished spill 2
2016-03-04 20:38:46,376 INFO [main] org.apache.hadoop.mapred.MapTask: (RESET) equator 19763348 kv 4940832(19763328) kvi 2319404(9277616)
2016-03-04 20:38:48,320 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output
2016-03-04 20:38:48,320 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 19763348; bufend = 50820055; bufvoid = 104857600
2016-03-04 20:38:48,320 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 4940832(19763328); kvend = 17947892(71791568); length = 13207341/6553600
2016-03-04 20:38:48,320 INFO [main] org.apache.hadoop.mapred.MapTask: (EQUATOR) 61305803 kvi 15326444(61305776)
2016-03-04 20:38:55,301 INFO [SpillThread] org.apache.hadoop.mapred.MapTask: Finished spill 3
2016-03-04 20:38:55,301 INFO [main] org.apache.hadoop.mapred.MapTask: (RESET) equator 61305803 kv 15326444(61305776) kvi 12705020(50820080)
2016-03-04 20:38:57,209 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output
2016-03-04 20:38:57,209 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 61305803; bufend = 92359884; bufvoid = 104857600
2016-03-04 20:38:57,209 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 15326444(61305776); kvend = 2118452(8473808); length = 13207993/6553600
2016-03-04 20:38:57,209 INFO [main] org.apache.hadoop.mapred.MapTask: (EQUATOR) 102845638 kvi 25711404(102845616)
2016-03-04 20:39:04,710 INFO [SpillThread] org.apache.hadoop.mapred.MapTask: Finished spill 4
2016-03-04 20:39:04,710 INFO [main] org.apache.hadoop.mapred.MapTask: (RESET) equator 102845638 kv 25711404(102845616) kvi 23089976(92359904)
2016-03-04 20:39:06,608 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output
2016-03-04 20:39:06,608 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 102845638; bufend = 29043356; bufvoid = 104857592
2016-03-04 20:39:06,608 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 25711404(102845616); kvend = 12503720(50014880); length = 13207685/6553600
2016-03-04 20:39:06,608 INFO [main] org.apache.hadoop.mapred.MapTask: (EQUATOR) 39529110 kvi 9882272(39529088)
2016-03-04 20:39:13,669 INFO [SpillThread] org.apache.hadoop.mapred.MapTask: Finished spill 5
2016-03-04 20:39:13,669 INFO [main] org.apache.hadoop.mapred.MapTask: (RESET) equator 39529110 kv 9882272(39529088) kvi 7260844(29043376)
2016-03-04 20:39:15,551 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output
2016-03-04 20:39:15,551 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 39529110; bufend = 70581562; bufvoid = 104857600
2016-03-04 20:39:15,551 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 9882272(39529088); kvend = 22888272(91553088); length = 13208401/6553600
2016-03-04 20:39:15,551 INFO [main] org.apache.hadoop.mapred.MapTask: (EQUATOR) 81067317 kvi 20266824(81067296)
2016-03-04 20:39:16,351 INFO [main] org.apache.hadoop.mapred.MapTask: Starting flush of map output
2016-03-04 20:39:22,600 INFO [SpillThread] org.apache.hadoop.mapred.MapTask: Finished spill 6
2016-03-04 20:39:22,600 INFO [main] org.apache.hadoop.mapred.MapTask: (RESET) equator 81067317 kv 20266824(81067296) kvi 18022368(72089472)
2016-03-04 20:39:22,600 INFO [main] org.apache.hadoop.mapred.MapTask: Spilling map output
2016-03-04 20:39:22,600 INFO [main] org.apache.hadoop.mapred.MapTask: bufstart = 81067317; bufend = 86345178; bufvoid = 104857600
2016-03-04 20:39:22,600 INFO [main] org.apache.hadoop.mapred.MapTask: kvstart = 20266824(81067296); kvend = 18022372(72089488); length = 2244453/6553600
2016-03-04 20:39:23,552 INFO [main] org.apache.hadoop.mapred.MapTask: Finished spill 7
2016-03-04 20:39:23,565 INFO [main] org.apache.hadoop.mapred.Merger: Merging 8 sorted segments
2016-03-04 20:39:23,577 INFO [main] org.apache.hadoop.mapred.Merger: Down to the last merge-pass, with 8 segments left of total size: 1829496 bytes
2016-03-04 20:39:24,096 INFO [main] org.apache.hadoop.mapred.Task: Task:attempt_1457141718249_0001_m_000000_0 is done. And is in the process of committing
2016-03-04 20:39:24,222 INFO [main] org.apache.hadoop.mapred.Task: Task 'attempt_1457141718249_0001_m_000000_0' done.

最佳答案

bufstart 是即将溢出的缓冲区的起始索引

buffend 是将溢出的缓冲区的最后一个索引。

buff void 指示缓冲区的末尾,直到可以完成溢出并且不再继续。

您可以在代码 here 中阅读更多关于索引用法的信息.

此外,mapper 使用排序缓冲区对它处理的键进行排序,并将其写入一个中间文件,该文件将被提供给 reducer/combiner。根据您陈述的行为,我认为发生这种情况是因为您有 7/8 reducers 提供映射器输入,导致相同数量的溢出。你能检查 reducer 日志来确认这一点吗?

关于hadoop - Mapreduce 中的中间数据溢出(缓冲内存),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35880599/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com