Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Mesos Schedulers and Executors by example

Tags:

I am trying to understand how the various components of Mesos work together, and found this excellent tutorial that contains the following architectural overview:

enter image description here

I have a few concerns about this that aren't made clear (either in the article or in the official Mesos docs):

  • Where are the Schedulers running? Are there "Scheduler nodes" where only the Schedulers should be running?
  • If I was writing my own Mesos framework, what Scheduler functionality would I need to implement? Is it just a binary yes/no or accept/reject for Offers sent by the Master? Any concrete examples?
  • If I was writing my own Mesos framework, what Executor functionality would I need to implement? Any concrete examples?
  • What's a concrete example of a Task that would be sent to an Executor?
  • Are Executors "pinned" (permanently installed on) Slaves, or do they float around in an "on demand" type fashion, being installed and executed dynamically/on-the-fly?
like image 402
smeeb Avatar asked Jul 06 '15 14:07

smeeb


People also ask

What is a Mesos executor?

An executor is a process that is launched on agent nodes to run the framework's tasks. Executor is started by a Mesos Agent and subscribes to it to get tasks to launch. A single executor can launch multiple tasks. Communication between executors and agents is via Mesos HTTP API.

How Apache Mesos works?

Mesos consists of a master daemon that manages agent daemons running on each cluster node, and Mesos frameworks that run tasks on these agents. The master enables fine-grained sharing of resources (CPU, RAM, …) across frameworks by making them resource offers.

What are the key goals of Mesos?

The goal of Apache Mesos, here on referred to as Mesos, is to provide an abstraction layer for compute resources (CPU, RAM, Disk, Ports, etc.). This allows applications and developers to request arbitrary units of compute power without an IT provider having to worry about how this translates to bare-metal or VMs.

What is Marathon and Mesos?

Mesos comes with a number of frameworks, application stacks that use its resource sharing capabilities. Each framework consists of a scheduler and a executor. Marathon is a framework (or meta framework) that can launch applications and other frameworks.


2 Answers

Great questions! I believe it would be really helpful to have a look at a sample framework such as Rendler. This will probably answer most of your question and give you feeling for the framework internal.

Let me now try to answer the question which might be still be open after this.

  • Scheduler Location

Schedulers are not on on any special nodes, but keep in mind that schedulers can failover as well (as any part in a distributed system).

  • Scheduler functionality

Have a look at Rendler or at the framework development guide.

  • Executor functionality/Task

I believe Rendler is a good example to understand the Task/Executor relationship. Just start reading the README/description on the main github page.

  • Executor pinning

Executors are started on each node when the first Task requiring such executor is send to this node. After this it will remain on that node.

Hope this helped!

like image 129
js84 Avatar answered Nov 01 '22 02:11

js84


To add to js84's excellent response,

  • Scheduler Location: Many users like to launch the schedulers via another framework like Marathon to ensure that if the scheduler or its node dies, then it can be restarted elsewhere.
  • Scheduler functionality: After registering with Mesos, your scheduler will start getting resource offers in the resourceOffers() callback, in which your scheduler should launch (at least) one task on a subset (or all) of the resources being offered. You'll probably also want to implement the statusUpdate() callback to handle task completion/failure. Note that you may not even need to implement your own scheduler if an existing framework like Marathon/Chronos/Aurora/Kubernetes could suffice.
  • Executor functionality: You usually don't need to create a custom executor if you just want to launch a linux process or docker container and know when it completes. You could just use the default mesos-executor (by specifying a CommandInfo directly in TaskInfo, instead of embedded inside an ExecutorInfo). If, however you want to build a custom executor, at minimum you need to implement launchTask(), and ideally also killTask().
  • Example Task: An example task could be a simple linux command like sleep 1000 or echo "Hello World", or a docker container (via ContainerInfo) like image : 'mysql'. Or, if you use a custom executor, then the executor defines what a task is and how to run it, so a task could instead be run as another thread in the executor's process, or just become an item in a queue in a single-threaded executor.
  • Executor pinning: The executor is distributed via CommandInfo URIs, just like any task binaries, so they do not need to be preinstalled on the nodes. Mesos will fetch and run it for you.
like image 32
Adam Avatar answered Nov 01 '22 03:11

Adam