0

We have a cluster with 6 EC2 nodes in AWS (16 cpu, 64 gb per node - 1 node running mesos master and 5 nodes running mesos slave). The mesos dispatcher is running on the master node. We use this cluster exclusively to run spark jobs. Our spark configuration is 5 cpu and 10 gb per executor (same for driver). I

In one of our scheduled jobs, we have a scenario where we need to do a few hundred spark-submits at the same time. When this happens, the dispatchers starts drivers for all these spark-submits leaving no room for any executors in the cluster.

I'm looking at a few options. I would like to get some pointers from members in the spark/mesos community.

Some options which I don't want to get into are : increasing the cluster size, asking the analysts to change their job structure to combine all spark-submits into a single one, switching to YARN/EMR (actually I tried this and got into some messy queue problems there)

Option 1 : Using Mesos roles

I found some documentation on the use of quotas and roles to solve this. But I'm not sure about the following :

  • How to create a mesos role and update the resources to be made available to this role ?

  • How to set up separate roles for spark drivers and spark executors ?

By default all resources are in the * role. There is a flag called spark.mesos.role that I can set while doing spark-submit but not sure how to create this role and ensure this role is used only for executors ?

Option 2 : Modifying the mesos cluster scheduler

When spark-submit happens to mesos dispatcher, it adds the driver request to a WaitingQueue. When drivers fail while executing and if supervise mode is available, they are sent to a PendingRetryQueue with custom retry schedule settings. When resources are available from mesos, these drivers from the PendingRetryQueue are scheduled first and WaitingQueue are scheduled next.I was thinking of keeping the WaitingQueue with size 5 (spark.mesos.maxDrivers) and when there are more spark-submits than the queue size, I would add these drivers to the PendingRetryQueue and schedule them to run later. Currently, as per my understanding, when there are more that 200 drivers in the WaitingQueue mesos rest server sends a failed message and doesn't add it to the PendingRetryQueue.

Any help on implementing either of the options would be very helpful to me. Thanks in advance.

Update : Just saw that by when I give spark-submit with a role, it runs only executors in that role and drivers run in the default * role. I think this should solve this issue for me. Once I test this, I'll post my update here and close this. Thanks

Srinivas K
  • 123
  • 6

2 Answers2

0

As mentioned in the update, by default the mesos runs spark drivers in default role (*) and executors in the role provided by 'spark.mesos.role' parameter. To control the resources available for each role, we can use quotas , guarantees or reservations. We went ahead with static reservations since it suited our requirements.Thanks.

Srinivas K
  • 123
  • 6
-1

Option 1 is the good one.

First set dispatcher quota by creating a file like dispatcher-quota.json

cat dispatcher-quota.json
{
 "role": "dispatcher",
 "guarantee": [
   {
     "name": "cpus",
     "type": "SCALAR",
     "scalar": { "value": 5.0 }
   },
   {
     "name": "mem",
     "type": "SCALAR",
     "scalar": { "value": 5120.0 }
   }
 ]
}

Then push it to you're mesos master (leader) with

curl -d @dispatcher-quota.json -X POST http://<master>:5050/quota

So now you will have a quota for driver

Ensure you dispatcher is running with the right service role set if needed ajust it. If in DC/OS use

$ cat options.json
{
    "service": {
        "role": "dispatcher"
    }
}
$ dcos package install spark --options=options.json

Otherwise feel free to share how you've deployed you dispatcher. I will provide you a how to guide.

That's ok for drivers. Now let's work with executor folowing the same way

$ cat executor-quota.json
{
  "role": "executor",
  "guarantee": [
    {
      "name": "cpus",
      "type": "SCALAR",
      "scalar": { "value": 100.0 }
    },
    {
      "name": "mem",
      "type": "SCALAR",
      "scalar": { "value": 409600.0 }
    }
  ]
}
$ curl -d @executor-quota.json -X POST http://<master>:5050/quota 

Adapt values to you requirements

Then ensure to launch executor on with the correct role by providing

--conf spark.mesos.role=executor \

Source of my explanation came from https://github.com/mesosphere/spark-build/blob/master/docs/job-scheduling.md don't hesistate if it's not enought.

This should do the work

airliquide
  • 520
  • 7
  • 16
  • Thanks for the link. I tried the curl request. But since there was no role called dispatcher it doesn't work. Also this seems to be for dcos. Do you have any ideas on how to create mesos roles separately for spark drivers ? Thanks – Srinivas K Nov 26 '19 at 12:55
  • @SrinivasK how have you deployed you're dispatcher ? – airliquide Nov 26 '19 at 14:30