-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-5376][Mesos] MesosExecutor should have correct resources #4170
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
Conversation
- Divided task and executor resources - Added `spark.mesos.executor.cpus` and fixed docs
|
Test build #25997 has started for PR 4170 at commit
|
- Removed `TODO` comments
|
Test build #25998 has started for PR 4170 at commit
|
docs/configuration.md
Outdated
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
Test build #25999 has started for PR 4170 at commit
|
|
Test build #25998 has finished for PR 4170 at commit
|
|
Test build #25997 has finished for PR 4170 at commit
|
|
Test FAILed. |
|
Test FAILed. |
- changed variable name from `executorCpus` to `executorCores` - Fixed failed test case.
|
Test build #26003 has started for PR 4170 at commit
|
|
Test build #25999 has finished for PR 4170 at commit
|
|
Test FAILed. |
|
Test build #26003 has finished for PR 4170 at commit
|
|
Test PASSed. |
- Added memResource to MesosTaskInfo
|
Test build #26015 has started for PR 4170 at commit
|
|
Test build #26015 has finished for PR 4170 at commit
|
|
Test PASSed. |
|
/cc @mateiz Could you please review this PR which is about offering resources to executor and task. |
|
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). |
|
@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. |
|
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. |
|
@mateiz That's a sample screenshot. |
|
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. |
|
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? |
|
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. |
|
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 |
|
@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. |
|
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. |
|
I believed that when we launch mesos driver launchTasks, container run the command |
|
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. |
|
@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? |
|
@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. |
|
I'll close this PR. It's wrong approach. |
|
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... 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. |
|
@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. |
|
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 |
|
@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? |
|
I think making it a configurable parameter sounda reasonable to me. |
|
@tnachen @elyast I made a new issue about configuring mesos executor cores. https://issues.apache.org/jira/browse/SPARK-6350 |
|
cool thanks |


spark.mesos.executor.coresand fixed docs