当前位置: 代码迷 >> 综合 >> yarn job推测执行
  详细解决方案

yarn job推测执行

热度:91   发布时间:2024-01-05 10:26:23.0

?

什么是推测执行?

所谓的推测执行,就是当所有task都开始运行之后,Job Tracker会统计所有任务的平均进度,如果某个task所在的task node机器配置比较低或者CPU load很高(原因很多),导致任务执行比总体任务的平均执行要慢,此时Job Tracker会启动一个新的任务(duplicate task),原有任务和新任务哪个先执行完就把另外一个kill掉

怎么配置推测执行参数?

推测执行需要设置Job的两个参数:

mapred.map.tasks.speculative.executionmapred.reduce.tasks.speculative.execution

两个参数的默认值均为true.

推测执行调度策略是什么?

推测执行逻辑:

// 1. Check bottom up for speculative tasks from the running cache// 2. Check breadth-wise for speculative tasks// 3. Check non-local tips for speculation

关键逻辑比较执行时间超过平均task执行时间某个百分比,定位为需要推测执行的job

//SPECULATIVE_GAP =0.2(averageProgress - progress >= SPECULATIVE_GAP ) && (currentTime - startTime >= SPECULATIVE_LAG

P.s. 看源码的时候看到调度map task的策略,故记下。

JobInProgress添加新的maptask的调度策略

// When scheduling a map task:// 0) Schedule a failed task without considering locality// 1) Schedule non-running tasks// 2) Schedule speculative tasks// 3) Schedule tasks with no location information

map task调度策略:

1、失败的task,不考虑地点

2、没跑过的task

3、推测执行的task

4、nonLocalRunningMaps中的task

?