更新时间:2024-05-06 GMT+08:00
分享

Yarn模式下动态资源调度

操作场景

对于Spark应用来说,资源是影响Spark应用执行效率的一个重要因素。当一个长期运行的服务(比如JDBCServer),若分配给它多个Executor,可是却没有任何任务分配给它,而此时有其他的应用却资源紧张,这就造成了很大的资源浪费和资源不合理的调度。

动态资源调度就是为了解决这种场景,根据当前应用任务的负载情况,实时的增减Executor个数,从而实现动态分配资源,使整个Spark系统更加健康。

操作步骤

  1. 需要先配置External shuffle service。
  2. 登录FusionInsight Manager,选择“集群 > 待操作集群的名称 > 服务 > Spark2x > 配置 > 全部配置”。在搜索框中输入“spark.dynamicAllocation.enabled”参数名称,将JDBCServer下的该参数值设置为“true”,表示开启动态资源调度功能。
下面是一些可选配置,如表1所示。
表1 动态资源调度参数

配置项

说明

默认值

spark.dynamicAllocation.minExecutors

最小Executor个数。

0

spark.dynamicAllocation.initialExecutors

初始Executor个数。

0

spark.dynamicAllocation.maxExecutors

最大Executor个数。

2048

spark.dynamicAllocation.schedulerBacklogTimeout

调度第一次超时时间。

1s

spark.dynamicAllocation.sustainedSchedulerBacklogTimeout

调度第二次及之后超时时间。

1s

spark.dynamicAllocation.executorIdleTimeout

普通Executor空闲超时时间。

60s

spark.dynamicAllocation.cachedExecutorIdleTimeout

含有cached blocks的Executor空闲超时时间。

  • JDBCServer2x:2147483647s
  • IndexServer2x:2147483647s
  • SparkResource2x:120

使用动态资源调度功能,必须配置External Shuffle Service。

分享:

    相关文档

    相关产品