执行者可以在spark中共享核心吗?

时间:2015-12-12 20:31:20

标签: memory parallel-processing apache-spark pyspark mesos

配置spark作业时,我有时会看到人们建议每个执行程序的核心数大于核心总数除以执行程序数。

值得注意的是,在example中,@ 0x0FFF建议以下内容:

struct complex_comparison
{
    bool operator()(const MyStruct& lhs, const MyStruct& rhs)
    {
        return lhs.B1 && lhs.B2 != rhs.B1 && rhs.B2 ? lhs.B1 && lhs.B2 > rhs.B1 && rhs.B2 :
                                   lhs.B1 != rhs.B1 ? lhs.B1 > rhs.B1 :
                                   lhs.N1 < rhs.N1;
    }
};

如果我们计算执行者核心的总数,我们会得到--num-executors 4 --executor-memory 12g --executor-cores 4 * 4 cores per executor = 4 executors total
然而,在问题的开头,它说“我有一个NameNode和两个DataNode,每个有30GB的RAM,每个4个核心”。因此,核心总数为16 cores total * 2 worker nodes = 4 cores each

8 cores是否可以使用16 cores这个硬件?如果是这样,怎么样?

1 个答案:

答案 0 :(得分:1)

所以,正如我在评论中所写,Spark会为每个核心旋转一个线程,并且 我知道对于YARN,您不能分配比执行程序可用的更多内核。如果你这样做,它就不会启动那些执行者。在Cloudera的this blog post中也对此进行了更详细的描述。