- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在阅读 Hadoop:权威指南
。在理解一些概念的过程中,我阅读了一些 SO 帖子,这让我同样感到困惑但也很清晰。以下是一些我需要专家意见的观点,以判断它是否正确以及如果不正确会发生什么情况?
让我们假设这是我的 HDFS 在具有一个节点的伪分布式集群中的样子:
/local/path/to/datanode/storage/0/blk_00001 300 MB
/local/path/to/datanode/storage/0/blk_00002 300 MB
/local/path/to/datanode/storage/0/blk_00003 300 MB
/local/path/to/datanode/storage/0/blk_00004 200 MB
我的文件总大小为 1100 MB,它被分成 300 MB 的 block (这是我的 block 大小)。
现在我要开始我的 Mapreduce 作业了:
据我所知,InputFormat
(依次拆分文件)决定了 map 的数量。
案例 1:
我有以下设置:拆分大小 mapred.min.split.size=400 MB
总共会有三个 MR 作业。每个将有一个 400 MB 的输入大小来处理。
1) 映射器 1:这意味着第一个 MR 作业将使用 blk_00001 中的 300 MB 和 blk_00002 中的 100 MB,(数据局部性丢失)。
2) 映射器 2: 现在,第二个映射器必须从位置 101 MB blk_00002 和另外 200 MB 的 blk_00003 处寻找
。
) Mapper 3: blk_0003 上还有 100 MB 和 blk_0004 上的 200 MB 有待处理。现在大小为 300 MB,应整体处理。
block 大小在 MAPRED 任务中没有作用。
Q1:到这里一切都正确吗??????
案例 2:
现在假设我的 MR 工作有以下设置:mapred.tasktracker.map.tasks.maximum=3
。这意味着对于任何给定节点,并行运行三个映射任务。
Q2:如果上面的所有映射器都在同一节点上并行运行,它们是在具有相似优先级的不同线程中运行,还是在 CPU 级别的单独进程中运行。
案例 3:如果我在 conf.setNumMapTasks(int num)
中的 num
大于拆分数。也就是说,我有 num = 10,拆分数 = 3。将要执行的 MR 作业总数为 3。
**Q3:**正确??
Reducer 任务:
Q4 mapper 必须在 reducer 启动之前完成 - 据我所知,在所有情况下,任何示例都不会。因为键需要排序并按顺序交给 reducers。
Q5那么mapred.reduce.slowstart.completed.maps=0.5
的作用是什么。这意味着当 map 任务完成 50% 时,启动 reducer。但是 reducer 需要 map 作业才能完成。对吗???
2) 如果我不指定任何东西,reducer 的默认数量是多少。
已经proposed使用 0.95 - 1.75 * (nodes * mapred.tasktracker.tasks.maximum)。所以如果我有 5 个节点的集群,每个节点有 5 个核心,公式给出 (0.95 * 5 * 5) = 24 reducers 。
那么我应该设置 conf.setNumReduceTasks(24) 吗????
最佳答案
Q1: Is everything correct till here???????
这取决于输入格式。 FileInputFormat
不会进行小于 block 大小的拆分,无论您将最小拆分大小设置为多少。以下是计算拆分大小的代码。
protected long computeSplitSize(long goalSize, long minSize, long blockSize) {
return Math.max(minSize, Math.min(goalSize, blockSize));
}
Q2: If all the mappers above runs parallel on same node, do they run in different Threads with similar priority or a separate process at CPU level.
每个任务都在自己的环境中运行 Java virtual machine , 所以分开进程。
Q3: if my num in conf.setNumMapTasks(int num) is greater than number of splits. That is say, I have num = 10 and the number of splits = 3. The total MR job that will be executed is 3.
setNumMapTasks()
是 not supported anymore并且仅作为对 MapReduce 系统的提示。
Q4: A mapper has to finish before the reducer starts - in all cases to my knowledge, any examples where it will not be. because the keys need sorting and handed them in order to reducers.
Q5 so what is the effect of mapred.reduce.slowstart.completed.maps=0.5. This would mean when the map task is 50% complete, start the reducers. but the reducer needs map jobs to be complete. correct???
慢启动涉及将数据复制到适当的机器。在所有映射器完成之前,reducer 中的 reduce()
方法不会被调用。
what is the default number of reducers if I don't specify anything.
1
so should I set conf.setNumReduceTasks(24)????
最适合您的任务。
关于hadoop - 澄清映射任务并减少hadoop中的任务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24618037/
我是 Bison 解析的新手,我无法理解它是如何工作的。我有以下语法,其中我保留了最低限度的语法来突出问题。 %left '~' %left '+' %token T_VARIABLE %% star
我链接了 2 个映射器和 1 个缩减器。是否可以将中间输出(链中每个映射器的 o/p)写入 HDFS?我尝试为每个设置 OutputPath,但它似乎不起作用。现在,我不确定是否可以完成。有什么建议吗
我正在编写一些代码来管理自定义磁盘文件结构并将其同步到未连接的系统。我的要求之一是能够在实际生成同步内容之前估计同步的大小。作为一个简单的解决方案,我整理了一个包含完整路径文件名的 map ,作为高效
我来自一个 SQL 世界,其中查找由多个对象属性(published = TRUE 或 user_id = X)完成,并且有 任何地方都没有加入 (因为 1:1 缓存层)。文档数据库似乎很适合我的数据
在 R 中,我有一个整数向量。从这个向量中,我想随机减少每个整数元素的值,以获得向量的总和,即初始总和的百分比。 在这个例子中,我想将向量“x”减少到向量“y”,其中每个元素都被随机减少以获得等于初始
我发现自己遇到过几次我有一个 reducer /组合 fn 的情况,如下所示: def combiner(a: String, b: String): Either[String, String]
Ubuntu 12.04 nginx 1.2.4 avconv版本 avconv version 0.8.10-4:0.8.10-0ubuntu0.12.04.1, Copyright (c) 200
我是 R 编程语言的新手。我有一个包含 2 列(ID 和 Num)的数据集,如下所示: ID Num 3 8 3 12 4 15 4 18 4
我正在使用高阶函数将函数应用于向量中的每个元素并将结果作为标量值返回。 假设我有: v = c(0, 1, 2, 3, 4, 5, 6, 7, 8) 我想计算以左边 5 个整数为中心的所有这些整数的总
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
这个问题在这里已经有了答案: How to write the dataframes in a list to a single csv file (2 个回答) 5年前关闭。 我正在尝试使用 Red
刚开始学习CUDA编程,对归约有些迷茫。 我知道与共享内存相比,全局内存有很多访问延迟,但我可以使用全局内存来(至少)模拟类似于共享内存的行为吗? 例如,我想对长度恰好为 BLOCK_SIZE * T
我经常使用OptiPNG或pngcrush减小PNG图像的文件大小。 我希望能够从.NET应用程序中以编程方式执行此类操作。我正在动态生成要发送到移动设备的PNG,因此我想减小文件大小。 图像质量很重
减少和减少让您在序列上累积状态。 序列中的每个元素都会修改累积的状态,直到 到达序列的末尾。 在无限列表上调用reduce 或reductions 有什么含义? (def c (cycle [0]))
这与R: use the newly generated data in the previous row有关 我意识到我面临的实际问题比我在上面的线程中给出的示例要复杂一些 - 似乎我必须将 3 个
有什么办法可以减少.ttf字体的大小?即如果我们要删除一些我们不使用的glyps。 最佳答案 使用Google Web Fonts,您可以限制字符集,例如: //fonts.googleapis.co
我需要在iOS中制作一个应用程序,在她的工作过程中发出类似“哔”的声音。 我已经使用MPMusicPlayerController实现了与背景ipod的交互。 问题: 由于来自ipod的音乐音量很大,
我有一个嵌套 map m,如下所示: m = Map("电子邮件"-> "a@b.com", "背景"-> Map("语言"-> "英语")) 我有一个数组arr = Array("backgroun
有什么原因为什么不应该转发map / reduce函数中收到的可写内容? 我的意思是-每个map / reduce函数都有一个可写的键/值,并可能发出一个键/值对。如果我想执行一些过滤,我应该只发出接
假设我有一个数据列表 val data = listOf("F 1", "D 2", "U 1", "D 3", "F 10") 我想执行每个元素的给定逻辑。 我必须在外部添加 var acc2 =
我是一名优秀的程序员,十分优秀!