`
zhaomengsen
  • 浏览: 202702 次
  • 性别: Icon_minigender_1
  • 来自: 河北
社区版块
存档分类
最新评论

Speculative Execution in Hadoop

    博客分类:
  • hive
 
阅读更多
所谓的推测执行,就是当所有task都开始运行之后,Job Tracker会统计所有任务的平均进度,如果某个task所在的task node机器配置比较低或者CPU load很高(原因很多),导致任务执行比总体任务的平均执行要慢,此时Job Tracker会启动一个新的任务(duplicate task),原有任务和新任务(一个task会有多个attempt同时执行)哪个先执行完就把另外一个kill掉,这也是我们经常在Job Tracker页面看到任务执行成功,但是总有些任务被kill,就是这个原因。另外,根据mapreduce job的特点,同一个task执行多次的结果是一样的,所以task只要有一次执行成功,job就是成功的,被kill的task对job的结果没有影响。


配置参数:

mapred.map.tasks.speculative.execution=true

mapred.reduce.tasks.speculative.execution=true

这两个是推测执行的配置项,当然如果你从来不关心这两个选项也没关系,它们默认值是true

而Hadoop 会根据task progress score决定是否killed一个task:


Hadoop monitors task progress using a progress score between 0 and 1.

For a map, the progress score is the fraction of input data read.

For a reduce task, the execution is divided into three phases, each of which accounts for 1/3 of the score:
• The copy phase, when the task fetches map outputs.
• The sort phase, when map outputs are sorted by key.
• The reduce phase, when a user-defined function is applied to the list of map outputs with each key.
In each phase, the score is the fraction of data processed.
For example,
• a task halfway through the copy phase has a progress score of 1 / 2 * 1 / 3 = 1 / 6
• a task halfway through the reduce phase has a progress score of 1 / 3 + 1 / 3 + 1 / 2 * 1 / 3 = 5 / 6

Hadoop looks at the average progress score of each category of tasks (maps and reduces) to define a threshold for speculative execution. When a task’s progress score is less than the average for its category by a threshold, and the task has run for a certain amount of time, it is considered slow. The scheduler also ensures that at most one speculative copy of each task is running at a time. When running multiple jobs, Hadoop uses a FIFO discipline where the earliest submitted job is asked for a task to run, then the second, etc. There is also a priority system for putting jobs into higher-priority queues.

(来源:http://adhoop.wordpress.com/2012/02/24/speculative-execution-in-hadoop/)


扩展阅读: Hadoop.The.Definitive.Guide.3rd.Edition
分享到:
评论

相关推荐

    hadoop 2.2 安装包

    6. **MapReduce优化**:包括 speculative execution(推测执行)优化,减少延迟任务对整体性能的影响,以及TaskTracker替换为ResourceTracker,使得任务调度更加高效。 此外,Hadoop 2.2还引入了对Java之外的语言...

    hadoop 配置项的调优

    2. **mapred.map.tasks.speculative.execution** 和 **mapred.reduce.tasks.speculative.execution**:这两个参数控制是否启用推测执行。当某些任务由于硬件或负载问题执行较慢时,推测执行会启动新的任务副本,加快...

    Hadoop实战源代码

    4. **容错与优化**:可能有关于错误处理的代码,以及如何利用Hadoop的特性如 speculative execution(推测执行)来提高效率。 5. **HDFS操作**:如何上传、下载和管理HDFS上的文件,以及使用Hadoop命令行工具进行...

    hadoop开发者

    此外,可能还会探讨Hadoop作业的优化技巧,如压缩、 speculative execution(推测执行)等。 第三期可能涵盖Hadoop生态系统中的其他组件,如Hive(用于数据仓库的工具,提供SQL接口处理Hadoop数据)、Pig(高级数据...

    Hadoop权威指南中文版

    - **Speculative Execution**:为失败的任务启动额外的实例,以便快速恢复故障节点的工作。 #### 四、YARN架构与功能 - **架构组成**:YARN主要包括三个关键组件: - **ResourceManager**:集群中的单点管理实体...

    Hadoop数据迁移--使用importtsv两步载入数据

    此外,用户还可以通过调整mapred.map.tasks.speculative.execution和mapred.reduce.tasks.speculative.execution参数来控制任务的推测执行,进一步优化导入性能。 整个Hadoop数据迁移过程中,importtsv工具发挥了...

    Hadoop2.6.4的源码包

    - **性能优化**:包括数据本地化、 speculative execution(推测执行)、I/O优化等,源码分析能够揭示其背后的实现细节。 6. **安全与隐私** Hadoop 2.6.4引入了安全性机制,如Kerberos认证,确保数据的安全传输...

    hadoop-2.6.0-x64.tar 。。

    此外,此版本还引入了“ speculative execution”,即推测执行,通过预估慢速任务并启动新的副本来加速整体作业完成时间。 对于Linux操作系统,Hadoop 2.6.0-x64是针对64位架构优化的,这意味着它能充分利用现代...

    提高hadoop的mapreduce job效率笔记

    7. ** speculative execution(推测执行)**: 当某些 Task 运行缓慢时,Hadoop 可以启动额外的 Task 实例来尝试替换它们。这有助于减少整体作业时间,但也可能浪费资源。因此,合理配置推测执行阈值是必要的。 8....

    hadoop_the_definitive_guide_3nd_edition

    Speculative Execution 213 Output Committers 215 Task JVM Reuse 216 Skipping Bad Records 217 7. MapReduce Types and Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

    Hadoop权威指南_第2版_中文版.pdf

    - **优化技术**:为了提高MapReduce的性能,引入了多种优化技术,比如Combiner(局部聚合)、Speculative Execution(投机执行)等。 #### 四、Hadoop生态系统 - **Hive**:基于Hadoop的一个数据仓库工具,可以将...

    Mapreduce体系

    为了优化性能,Hadoop引入了推测执行(Speculative Execution)。这个特性允许系统在某些任务执行较慢时,启动额外的备份任务来尝试加速处理。然而,这并不总是有效,特别是在任务执行缓慢是由代码问题或资源限制...

    Hbase中文文档

    7.4. Speculative Execution 8. HBase安全 8.1. 安全客户端访问 HBase 8.2. 访问控制 9. 架构 9.1. 概述 9.2. Catalog Tables 9.3. 客户端 9.4. Client Request Filters 9.5. Master 9.6. RegionServer 9.7. Regions...

    hadoop map-reduce中的文件并发操作

    此外,推测执行可能导致多个任务尝试写入同一文件,因此需要关闭推测执行(设置`mapred.reduce.tasks.speculative.execution`为`false`),或者在每个任务中使用尝试ID(attempt ID)作为文件名的一部分,以防止冲突...

    MapReduce中文文档翻译

    还可以通过 speculative execution 避免慢节点影响整体性能。 总的来说,MapReduce提供了一个简洁而强大的接口,实现了大规模数据处理的自动化并行化和分布式执行,极大地简化了大数据计算的复杂性。尽管后来出现了...

    云计算基础——分布式计算

    4. **Speculative Execution(备份任务)**:为了提高系统的容错性和性能,Map/Reduce框架会执行“投机”任务,即在同一时间在不同节点上运行相同任务的副本。这样,即使某个任务执行失败,系统仍然可以通过其他成功...

    MapReduce:简单字数

    因此,有许多优化策略被提出,如Combiner函数(在本地减少数据传输量)、 speculative execution(预测性执行,防止慢节点拖慢整体进度)和partitioner(自定义分区策略以优化数据分布)。 **现代改进**: 随着技术...

    hive常见的优化方案ppt

    13. **投机执行与慢启动**:`mapreduce.map.speculative`和`mapreduce.reduce.speculative`可以开启投机执行,减少任务延迟。`mapreduce.map.task.timeout`和`mapreduce.reduce.task.timeout`用于设置任务超时时间。...

Global site tag (gtag.js) - Google Analytics