Skip to content

[SPARK-17365][Core] Remove/Kill multiple executors together to reduce RPC call time. - #15152

Closed
dhruve wants to merge 6 commits into
apache:masterfrom
dhruve:impr/SPARK-17365
Closed

[SPARK-17365][Core] Remove/Kill multiple executors together to reduce RPC call time.#15152
dhruve wants to merge 6 commits into
apache:masterfrom
dhruve:impr/SPARK-17365

Conversation

@dhruve

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

We are killing multiple executors together instead of iterating over expensive RPC calls to kill single executor.

How was this patch tested?

Executed sample spark job to observe executors being killed/removed with dynamic allocation enabled.

… contention
[SPARK-17365][Core] Return executorIds which are actually killed while killing multiple executors
Fix import wrap and remove unused import
Add mima exclude and refactor few methods.
@vanzin

Copy link
Copy Markdown
Contributor

ok to test

@vanzin

Copy link
Copy Markdown
Contributor

add to whitelist

@SparkQA

Copy link
Copy Markdown

Test build #65609 has finished for PR 15152 at commit 5a185d2.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class SparkContext(config: SparkConf) extends Logging

@SparkQA

Copy link
Copy Markdown

Test build #65618 has finished for PR 15152 at commit d779a88.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA

Copy link
Copy Markdown

Test build #65655 has finished for PR 15152 at commit bef1d1e.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dhruve

Copy link
Copy Markdown
ContributorAuthor

PySpark unit tests failure unrelated.

@dhruve

Copy link
Copy Markdown
ContributorAuthor

retest this please

@SparkQA

Copy link
Copy Markdown

Test build #65675 has finished for PR 15152 at commit bef1d1e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dhruve

Copy link
Copy Markdown
ContributorAuthor

@vanzin, @tgravescs Can you review these changes.

I will resolve the MiMa exclude merge conflicts once the PR is ready to be accepted - as these are being added often. Thanks.

@vanzinvanzin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, a few minor things to fix though.

def killExecutor(executorId: String): Boolean = killExecutors(Seq(executorId))
def killExecutor(executorId: String): Boolean = {
val killedExecutors = killExecutors(Seq(executorId))
killedExecutors.nonEmpty && killedExecutors(0).equals(executorId)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seriously hope the backend is not killing some random executor instead of the one that was asked...

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't. Just added an additional check here to be sure. I need to change the short circuit operator here to &.

.filter { id => force || !scheduler.isExecutorBusy(id) }
executorsToKill.foreach { id => executorsPendingToRemove(id) = !replace }

logInfo(s"Requesting to kill filtered executor(s) ${executorsToKill.mkString(", ")}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds weird. The following looks slightly better: "Actual list of executors to be killed is ...".

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one sounds better.

val killResponse = adjustTotalExecutors.flatMap(killExecutors)(ThreadUtils.sameThread)

killResponse.flatMap(killSuccessful =>
Future.successful ( if (killSuccessful) executorsToKill else Seq.empty[String])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no space before '('

assert(executorsPendingToRemove(manager).contains("2"))
assert(executorsPendingToRemove(manager).contains("3"))
assert(!removeExecutor(manager, "100")) // remove non-existent executors
assert(!(removeExecutors(manager, Seq("101", "102")) == Seq("101", "102")))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!= doesn't work?


// Keep removing until the limit is reached
assert(executorsPendingToRemove(manager).isEmpty)
assert(removeExecutors(manager, Seq("1")) == Seq("1"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use === in all these.


def canCreate(masterURL: String): Boolean = masterURL == "myDummyLocalExternalClusterManager"

override def createTaskScheduler(sc: SparkContext,

@vanzinvanzinSep 21, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide#SparkCodeStyleGuide-Indentation

Each parameter on a separate line when breaking. Happens in a bunch of methods here.

): Boolean = sc.requestTotalExecutors(numExecutors, localityAwareTasks, hostToLocalTaskCount)

override def requestExecutors(numAdditionalExecutors: Int): Boolean =
sc.requestExecutors(numAdditionalExecutors)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

@dhruve

Copy link
Copy Markdown
ContributorAuthor

@vanzin - fixed minor nits and indentation.

@SparkQA

Copy link
Copy Markdown

Test build #65729 has finished for PR 15152 at commit b76147c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class ChiSqSelector @Since(\"2.1.0\") () extends Serializable
    • abstract class CompactibleFileStreamLog[T: ClassTag](
    • class FileStreamSinkLog(
    • case class FileEntry(path: String, timestamp: Timestamp, batchId: Long = NOT_SET)
    • class FileStreamSourceLog(

def killExecutor(executorId: String): Boolean = killExecutors(Seq(executorId))
def killExecutor(executorId: String): Boolean = {
val killedExecutors = killExecutors(Seq(executorId))
killedExecutors.nonEmpty & killedExecutors(0).equals(executorId)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be short-circuited, otherwise it will throw an exception if the list is empty.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! The earlier one was fine. Missed it.

@SparkQA

Copy link
Copy Markdown

Test build #65740 has finished for PR 15152 at commit 3d2fac4.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin

Copy link
Copy Markdown
Contributor

LGTM. Merging to master.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@dhruve@vanzin@SparkQA