Skip to content

Conversation

@jongyoul
Copy link
Member

  • Divided task and executor resources
  • Added spark.mesos.executor.cores and fixed docs

- Divided task and executor resources
- Added `spark.mesos.executor.cpus` and fixed docs
@jongyoul
Copy link
Member Author

/cc @tnachen @pwendell This PR is about @pwendell 's todo. Review this, please.

@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #25997 has started for PR 4170 at commit 71703c8.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #25998 has started for PR 4170 at commit f655eee.

  • This patch merges cleanly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Spark code has been referring cpus to cores, so I assume you want to name this spark.mesos.executor.cores
I think we should re-word this, to something like:
The amount of cores to request for running the mesos executor.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. I'm also confused between cpus and cores. I think cores is more proper term. Thanks.

- changed term from `cpus` to `cores`
- Reworded docs
@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #25999 has started for PR 4170 at commit 9054535.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #25998 has finished for PR 4170 at commit f655eee.

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

@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #25997 has finished for PR 4170 at commit 71703c8.

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

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25998/
Test FAILed.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25997/
Test FAILed.

- changed variable name from `executorCpus` to `executorCores`
- Fixed failed test case.
@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #26003 has started for PR 4170 at commit a28b666.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #25999 has finished for PR 4170 at commit 9054535.

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

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25999/
Test FAILed.

@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #26003 has finished for PR 4170 at commit a28b666.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/26003/
Test PASSed.

@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #26015 has started for PR 4170 at commit d714e8b.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 23, 2015

Test build #26015 has finished for PR 4170 at commit d714e8b.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/26015/
Test PASSed.

@jongyoul
Copy link
Member Author

/cc @mateiz Could you please review this PR which is about offering resources to executor and task.

@mateiz
Copy link
Contributor

mateiz commented Jan 28, 2015

Sorry, what was the problem here? Executors do use memory, in fact they use all of the memory of that JVM (the only reason we assign memory to tasks is that Mesos didn't support tasks with 0 memory).

@jongyoul
Copy link
Member Author

@mateiz We agree with one executor and multi task is intended behaviour. In this situation, MesosScheduler offers CPUS_PER_TASK resources to executor when we launch separate task. If we launch two tasks on different salves, we offers 4 * CPUS_PER_TASK(= 2 for executor and 2 for tasks) for running only two tasks. @pwendell thinks that's too much resources and It's enough for executor to have one cores. In my PR, I enable to set executor's cores. In memory, we just offered memory to executor only. If we launch two tasks again, we offers 2 * calculateTotalMemory(sc) to all tasks. I think we offer two executor memories and two task memories. I agree that executor uses memory by itself, but we should fix amount of those value. If we completed two tasks on same slaves - which same frameworks and exeuctor and containers - , mesos' ui shows only calculateTotalMemory for that framework.

@jongyoul
Copy link
Member Author

Thus, I believe that executor has executor cores and executor memory setting on ExecutorInfo, and task has its own cores and memories setting on TaskInfo while launching per task.

@jongyoul
Copy link
Member Author

@mateiz That's a sample screenshot.
screen shot 2015-01-28 at 10 55 07 am

@mateiz
Copy link
Contributor

mateiz commented Jan 28, 2015

Sorry, I'm not sure I understand about the memory. There should be the same amount of memory for each executor. More executors means more total memory. But the way that was being calculated before is fine, what's wrong with it?

For CPUs, I understand wanting to start executors off at 0 CPUs and just having 1 per task. I actually thought we did that initially, not sure why it's 1.

@mateiz
Copy link
Contributor

mateiz commented Jan 28, 2015

Basically I don't understand what your patch is fixing. What's an example of config settings that gave the wrong allocation before, and what will they give now?

@jongyoul
Copy link
Member Author

Sorry, I haven't shown you my configuration. my configuraion is 5G for SPARK_EXECUTOR_MEMORY and 5 for spark.task.cpus. In my screenshot, we launch two tasks on the same machine. Don't you think It's good to offer task memory twice? My PR gives correct resource management information to mesos' master. For CPUs, I don't know proper value of executor cpus, but not CPUS_TASK_CPUS. Recommend this value, please.

@mateiz
Copy link
Contributor

mateiz commented Jan 28, 2015

Right, as I said, it doesn't make sense to offer task memory twice. Each executor is a single JVM, and JVMs cannot scale their memory up and down. The executor's memory is set to the same value that we configure that JVM with, with -Xmx. There's no way to make tasks use more memory than that, no matter how many tasks are running on there.

@tnachen
Copy link
Contributor

tnachen commented Jan 28, 2015

@jongyul sorry didn't get to finish reviewing the PR, and I agree with matei that in spark usage of mesos it doesn't make sense to give tasks memory, as we share the same executor that is kept running.

@jongyoul
Copy link
Member Author

I don't know the behaviour in coarse-grained mode, but in fine-grained mode, we use multiple JVM for running tasks. we run spark-class by launcher. This means we launch JVM by running per task. Am I wrong? If I've misunderstood how mesos works, I'm so sorry.

@jongyoul
Copy link
Member Author

I believed that when we launch mesos driver launchTasks, container run the command bin/spark-class everytime running task. And in my qna email for mesos, @tnachen answers that one container run multiple command simultaneously. And my some tests show two tasks runs simutaneously because they write a same log file at the same time. And my digging codes results no limit to launch task on a mesos container. However, @mateiz told me that one executor only runs a single JVM and launch a single task at any time.

@tnachen
Copy link
Contributor

tnachen commented Jan 28, 2015

If you read the fine-grained mode source code, you'll notice that Spark is using the slave id as the executor id, which is what we discussed on the mesos mailing list, that the executor will be re-used if all tasks reuse the same executor id.
Therefore, it's only launching one executor per slave, and if the executor dies Mesos will relaunch it when the task asks for it again.

@jongyoul
Copy link
Member Author

@tnachen Yes, I fully understand reusing executor while a framework is alive. However, how about that case that we launch two tasks on a same executor? What you've answered is they are launched at the same time, isn't it?

@tnachen
Copy link
Contributor

tnachen commented Jan 28, 2015

@jongyoul So an executor can only "launch" one task at a time, but can have multiple tasks running simultaneously as you mentioned.

It doesn't matter if they're all part of the same launchTasks message or seperate, as long as the framework and executor id are the same it will be launched in the same executor.

@jongyoul
Copy link
Member Author

@tnachen @mateiz So sorry for taking up a lot of time. I've found that only one executor as a process runs at any time, and I understand executor can have multiple tasks at the same time. I've believed each executor is launched separately when driver launchTasks.

@jongyoul
Copy link
Member Author

I'll close this PR. It's wrong approach.

@elyast
Copy link
Contributor

elyast commented Mar 13, 2015

One comment, however if you run multiple Spark applications even tough executor-id == slave-id, multiple executors can be started on the same host. (And every one of them will consume 1 CPU without scheduling any tasks). This can be painful when you want to run multiple streaming applications on Mesos in fine grained mode, because each streaming driver's executors will consume 1 CPU...

executors

Screen shots illustrate situation on single slave, when there are two executors running for 2 different Spark applications (one is streaming app, second one is Zeppelin), and as u can see there 0 active tasks the consumption of CPU is 2.

@tnachen
Copy link
Contributor

tnachen commented Mar 13, 2015

@elyast yes you are correct it is only applicable per Spark app. It is entirely possible to make executor cpu less than 1 (as it's based on shares), but it's not possible for now to share mesos executor across apps.

@elyast
Copy link
Contributor

elyast commented Mar 13, 2015

Sure its totally fine not to share, but at least it should be possible to configure allocation. Allocating 1 CPU per executor may just too much, obviously it depends how cpu intensive is his work, but I guess @mateiz know that much better than me

@jongyoul
Copy link
Member Author

@elyast Thanks for interesting this PR, which was about resources of cores and memory. I misunderstood how mesos works specially in memory side, so I closed this PR. However, I agree with you that executor cores are sometime too much. @tnachen we cannot adjust memory issue, but, changing executor cores is meaningful and should fix that executor has same cores with CPUS_PER_TASK initially. See TODO(pwendell) in MesosSchedulerBackend.scala. I want to fix this TODO to extract a configuration parameter. What do you think of it?

@tnachen
Copy link
Contributor

tnachen commented Mar 15, 2015

I think making it a configurable parameter sounda reasonable to me.

@jongyoul
Copy link
Member Author

@tnachen @elyast I made a new issue about configuring mesos executor cores. https://issues.apache.org/jira/browse/SPARK-6350

@elyast
Copy link
Contributor

elyast commented Mar 17, 2015

cool thanks

Sign up for free to 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.

6 participants