Skip to content

[SPARK-17984][YARN][Mesos][Deploy][WIP] Add support for NUMA aware feature #15524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ private[yarn] class ExecutorRunnable(
executorCores: Int,
appId: String,
securityMgr: SecurityManager,
localResources: Map[String, LocalResource]) extends Logging {
localResources: Map[String, LocalResource]
allocationMeter: Int) extends Logging {

var rpc: YarnRPC = YarnRPC.create(conf)
var nmClient: NMClient = _
Expand Down Expand Up @@ -207,8 +208,12 @@ private[yarn] class ExecutorRunnable(
}.toSeq

YarnSparkHadoopUtil.addOutOfMemoryErrorArgument(javaOpts)

//sparkConf.get(NUMA_NODE)
val numaNode = allocationMeter%2

val commands = prefixEnv ++ Seq(
YarnSparkHadoopUtil.expandEnvironment(Environment.JAVA_HOME) + "/bin/java",
s" numactl --cpunodebind=$numaNode --preferred=$numaNode " + YarnSparkHadoopUtil.expandEnvironment(Environment.JAVA_HOME) + "/bin/java",
"-server") ++
javaOpts ++
Seq("org.apache.spark.executor.CoarseGrainedExecutorBackend",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ private[yarn] class YarnAllocator(
private var numUnexpectedContainerRelease = 0L
private val containerIdToExecutorId = new HashMap[ContainerId, String]

// Keep track already allocated executor per host
val hostToAllocationMeterMap = new HashMap[String, Int]

// Executor memory in MB.
protected val executorMemory = sparkConf.get(EXECUTOR_MEMORY).toInt
// Additional memory overhead.
Expand Down Expand Up @@ -507,6 +510,10 @@ private[yarn] class YarnAllocator(

if (numExecutorsRunning < targetNumExecutors) {
if (launchContainers) {

val allocationMeter = hostToAllocationMeterMap.getOrElseUpdate(executorHostname, 0)
hostToAllocationMeterMap.put(executorHostname, allocationMeter + 1)

launcherPool.execute(new Runnable {
override def run(): Unit = {
try {
Expand All @@ -521,7 +528,8 @@ private[yarn] class YarnAllocator(
executorCores,
appAttemptId.getApplicationId.toString,
securityMgr,
localResources
localResources,
allocationMeter
).run()
updateInternalState()
} catch {
Expand Down