Hadoop调优
mapred.tasktracker.map.tasks.maximum
官方解释:The maximum number of map tasks that will be run simultaneously by a task tracker.
我的理解:一个tasktracker最多可以同时运行的map任务数量
默认值:2
优化值:mapred.tasktracker.map.tasks.maximum = cpu数量
cpu数量 = 服务器CPU总核数 / 每个CPU的核数
服务器CPU总核数 = more /proc/cpuinfo | grep 'processor' | wc -l
每个CPU的核数 = more /proc/cpuinfo | grep 'cpu cores'
mapred.map.tasks
官方的解释:The default number of map tasks per job
我的解释:一个Job会使用task tracker的map任务槽数量,这个值 ≤ mapred.tasktracker.map.tasks.maximum
默认值:2
优化值:
- CPU数量 (我们目前的实践值)
- (CPU数量 > 2) ? (CPU数量 * 0.75) : 1 (mapr的官方建议)
注意:map任务的数量是由input spilit决定的,和上面两个参数无关
mapred.tasktracker.reduce.tasks.maximum
官方解释:The maximum number of reduce tasks that will be run simultaneously by a task tracker.
我的理解:一个task tracker最多可以同时运行的reduce任务数量
默认值:2
优化值: (CPU数量 > 2) ? (CPU数量 * 0.50): 1 (mapr的官方建议)
mapred.reduce.tasks
官方解释:The default number of reduce tasks per job. Typically set to 99% of the cluster's reduce capacity, so that if a node fails the reduces can still be executed in a single wave.
我的理解:一个Job会使用task tracker的reduce任务槽数量
默认值:1
优化值:
- 0.95 * mapred.tasktracker.tasks.maximum
理由:启用95%的reduce任务槽运行task, recude task运行一轮就可以完成。剩余5%的任务槽永远失败任务,重新执行
- 1.75 * mapred.tasktracker.tasks.maximum
理由:因为reduce task数量超过reduce槽数,所以需要两轮才能完成所有reduce task。具体快的原理我没有完全理解,上原文:
hadoop官方wiki: 写道
At 1.75 the faster nodes will finish their first round of reduces and launch a second round of reduces doing a much better job of load balancing.
环境变量
disable ipv6配置,修改bin/hadoop,添加下行:
HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true"
Hive调优:
mapred.reduce.tasks
官方 写道
The default number of reduce tasks per job. Typically set
to a prime close to the number of available hosts. Ignored when
mapred.job.tracker is "local". Hadoop set this to 1 by default, whereas hive uses -1 as its default value.
By setting this property to -1, Hive will automatically figure out what should be the number of reducers.
我的理解
tasktracker执行hive job的reduce任务数,设置为"-1"hive将自动设置该值,策略如下:
1. hive.exec.reducers.bytes.per.reducer(默认为1GB)
2. hive.exec.reducers.max(默认为999)
mapred.reduce.tasks = min ( 参数2,总输入数据量/参数1 )
默认值:-1
优化值:显式设置为Hadoop配置中mapred.reduce.tasks值,参考上文。
标签:map,tasks,mapred,reduce,hadoop,笔记,task,调优,CPU From: https://blog.51cto.com/u_16187922/6715601