首页 文章

Spark on Yarn:在客户端检查驱动程序内存?

提问于
浏览
0

我以为我理解了纱线架构上的火花,但现在我想知道:当我推出时

spark-submit --master yarn-cluster --class     com.domain.xxx.ddpaction.DdpApp --num-executors 24 --deploy-mode cluster --driver-memory 4g --executor-memory 2g --executor-cores 1 --conf "spark.yarn.jar=/spark/lib/spark-assembly-1.1.0-hadoop2.4.0.jar" ddpaction-3.1.0.jar yarn-cluster config.yml

它失败了

# Native memory allocation (malloc) failed to allocate 2863333376 bytes for committing reserved memory

我启动spark-submit的服务器有少于2GB的空闲内存,这会导致错误,但资源管理器 where the driver should execute 远远超过4GB设置作为driver-memory参数 . 为什么在我的理解中只应在资源管理器中的纱线群集上检查和分配的驱动程序内存值是否在以纱线群集模式启动spark-submit的服务器上分配?

2 回答

  • 1

    这是Spark-1.4.0中修复的错误请参阅SPARK-3884

  • 2

    看起来火花提交脚本有一个不好的简化:

    elif [ "$1" = "--driver-memory" ]; then
        export SPARK_SUBMIT_DRIVER_MEMORY=$2
    

    因此,spark-submit使用驱动程序内存参数值来设置其分配的内存;这在纱线客户模式中是正确的,而不是在纱线集群中 . 我通过以下方式替换这些行来解决我的问题:

    elif [ "$1" = "--spark-submit-memory" ]; then
        export SPARK_SUBMIT_DRIVER_MEMORY=$2
    

    所以现在我可以设置(如果需要)分配给spark-submit的内存到一个驱动程序的不同值 .

相关问题