Fixing cloud scheduling » History » Version 10

« Previous - Version 10/12 (diff) - Next » - Current version
Peter Amstutz, 07/25/2018 06:49 PM


Fixing cloud scheduling

Our current approach to scheduling containers on the cloud using SLURM has a number of problems:

  • Head-of-line problem: with a single queue, slurm will only schedule the job at the top of the queue, if it cannot be scheduled, every other job has to wait. This results in wasteful idle nodes and reduces throughput.
  • Queue ordering doesn't reflect our desired priority order without a lot of hacking around with "niceness"
  • Slurm queue forgets dynamic configuration, requires constant maintenance processes to reset slurm dynamic configuration

Things that slurm currently provides:

  • allocating containers to specific nodes
  • reporting idle/busy/failed/down state, and out of contact

Crunch-dispatch-local

(currently the preferred option)

Node manager generates wishlist based on container queue. Compute nodes run crunch-dispatch-local or similar service, which asks the API server for work and then runs it.

Advantages:

  • Complete control over scheduling decisions / priority

Disadvantages:

  • Additional load on API server (but probably not that much)
  • Need a new scheme for nodes to report their status so that node manager knows if they are busy, idle. Node manager has to be able to put nodes in equivalent of "draining" state to ensure they don't get shut down while doing work. (We can use the "nodes" table for this).
  • Need to be able to detect node failure.

Starting up

  1. Node looks at pending containers to get a "wishlist"
  2. Nodes spin up the way they do now. However, instead of registering with slurm, they start crunch-dispatch-local.
  3. Node ping token should have corresponding API token to be used by dispatcher to talk to API server
  4. C-d-l pings the API server to ask for work, the ping operation puts the node in either "busy" (if work is returned) or "idle"

Running containers

  1. Add "I am idle, give me work" API which locks and returns the next container that is appropriate for the node, or marks the node as "idle" if no work is available
  2. Node record records which container it is supposed to be running (can be part of the "Lock" call based on the per-node API token)
  3. C-d-l makes API call to nodes table to say it is "busy"
  4. C-d-l calls crunch-run to run the container
  5. C-d-l must continue to ping that it is "busy" every X seconds
  6. When container finishes, c-d-l pings that it is "idle"

Shutting down

  1. When node manager decides a node is ready for shutdown, it makes an API call on the node record to indicate "draining".
  2. C-d-l pings "I am idle" on a "draining" record. This puts the state in "drained" and c-d-l does not get any new work.
  3. Node manager sees the node is "drained" and can proceed with destroying the cloud node.

Handling failure

  1. If a node enters a failure state and there is a container associated with it, the container should either be unlocked (if container is in locked state) or cancelled (if in running state).
  2. API server should have a background process which looks for nodes that haven't pinged recently puts them into failed state.
  3. Node can also put itself into failed state with an API call.

Other options

Kubernetes

Submit containers to a Kubernetes cluster. Kubernetes handles cluster scaling and scheduling.

Advantages:

  • Get rid of node manager
  • Desirable as part of overall plan to be able to run Arvados on Kubernetes

Disadvantages:

  • Running crunch-run inside a container requires docker-in-docker (privileged container) or access to the Docker socket.

Cloud provider scheduling APIs

Use cloud provider scheduling APIs such as Azure Batch, AWS Batch, Google pipelines API to perform cluster scaling and scheduling.

Would be implemented as custom Arvados dispatcher services: crunch-dispatch-azure, crunch-dispatch-aws, crunch-dispatch-google.

Advantages:

  • Get rid of Node Manager

Disadvantages:

  • Has to be implemented per cloud provider.
  • May be hard to customize behavior, such as job priority.

Use slurm better

Most of our slurm problems are self-inflicted. We have a single partition and single queue with heterogeneous, dynamically configured nodes. We would have fewer problems if we adopted a strategy whereby we define configure slurm ranges "compute-small-[0-255]", "compute-medium-[0-255]", "compute-large-[0-255]" with appropriate specs. Define a partition for each size range, so that a job waiting for one node size does not hold up jobs that want a different node size.

Advantages:

  • Least overall change compared to current architecture

Disadvantages:

  • Requires coordinated change to API server, node manager, crunch-dispatch-slurm, cluster configuration
  • Ops seems to think that defining (sizes * max nodes) hostnames might be a problem?
  • Can't adjust node configurations without restarting the whole cluster