Chinaunix首页 | 论坛 | 博客
  • 博客访问: 485630
  • 博文数量: 80
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1916
  • 用 户 组: 普通用户
  • 注册时间: 2013-07-11 22:01
个人简介

从事实时计算多年,熟悉jstorm/spark/flink/kafka/rocketMq, 热衷于开源,希望在这里和前辈们一起学习与分享,得到长足的进步!邮箱:hustfxj@gmail.com 我的githup地址是:https://github.com/hustfxj。欢迎和大家一起交流探讨问题。

文章分类

全部博文(80)

文章存档

2017年(11)

2015年(3)

2014年(33)

2013年(33)

分类: 大数据

2017-05-27 20:02:08

动态资源调配

spark 1.5开始为standalone模式和mesos的粗粒度模式提供了executor的动态管理,具体表现为:如果executor在一段时间内空闲就会移除这个executor。

  • 动态申请executor

如果有新任务处于等待状态,并且等待时间超过Spark.dynamicAllocation.schedulerBacklogTimeout(默认1s),则会依次启动executor,每次启动1,2,4,8…个executor(如果有的话)。启动的间隔由spark.dynamicAllocation.sustainedSchedulerBacklogTimeout控制(默认与schedulerBacklogTimeout相同)。

  • 动态移除executor

executor空闲时间超过spark.dynamicAllocation.executorIdleTimeout设置的值(默认60s ),该executor会被移除,除非有缓存数据。

配置

  • conf/spark-default.conf中配置

spark.dynamicAllocation.enabled true

spark.shuffle.service.enabled true (必须开启)

  • 开启shuffle service(每个worker节点)

sbin/start-shuffle-service.sh

相关配置

参数名 默认值 描述
spark.dynamicAllocation.executorIdleTimeout 60s executor空闲时间达到规定值,则将该executor移除
spark.dynamicAllocation.cachedExecutorIdleTimeout infinity 缓存了数据的executor默认不会被移除
spark.dynamicAllocation.maxExecutors infinity 最多使用的executor数,默认为你申请的最大executor数
spark.dynamicAllocation.minExecutors 0 最少保留的executor数
spark.dynamicAllocation.schedulerBacklogTimeout 1s 有task等待运行时间超过该值后开始启动executor
spark.dynamicAllocation.sustainedSchedulerBacklogTimeout schedulerBacklogTimeout 动态启动executor的间隔
spark.dynamicAllocation.initialExecutors spark.dynamicAllocation.minExecutors 如果所有的executor都移除了,重新请求时启动的初始executor数

其他策略

  • 先后次序调度 spark.scheduler.mode=FIFO
  • 公平调度 spark.scheduler.mode=FAIR
  • 优雅关闭配置项 spark.streaming.stopGracefullyOnShutdown
  • spark.shuffle.service.index.cache.entries
阅读(1768) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~