Project

General

Profile

Fixing cloud scheduling » History » Version 3

Peter Amstutz, 07/25/2018 06:29 PM

1 1 Peter Amstutz
h1. Fixing cloud scheduling
2
3
Our current approach to scheduling containers on the cloud using SLURM has a number of problems:
4
5
* 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.
6
* Queue ordering doesn't reflect our desired priority order without a lot of hacking around with "niceness"
7
* Slurm queue forgets dynamic configuration, requires constant maintenance processes to reset slurm dynamic configuration 
8
9 2 Peter Amstutz
Things that slurm currently provides:
10
11
* allocating containers to specific nodes
12
* reporting idle/busy/failed/down state, and out of contact 
13
14 1 Peter Amstutz
Some solutions:
15
16 3 Peter Amstutz
h2. Crunch-dispatch-local
17
18
(currently the preferred option)
19
20
Node manager spins up nodes based on container queue.  Compute nodes run crunch-dispatch-local or similar service, which asks the API server for work and then runs it.  Possibly node manager directly decides which jobs should go onto which nodes.
21
22
Advantages:
23
24
* Complete control over scheduling decisions / priority
25
26
Disadvantages:
27
28
* Additional load on API server (but probably not that much)
29
* 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).
30
* Need to be able to detect node failure.
31
32
Proposed design:
33
34
h3. Starting up
35
36
# Node looks at pending containers to get a "wishlist"
37
# Nodes spin up the way they do now.  However, instead of registering with slurm, they start crunch-dispatch-local.
38
# Node ping token should have corresponding API token to be used by dispatcher to talk to API server
39
# C-d-l pings the API server to indicate it is "idle"
40
41
h3. Running containers
42
43
# C-d-l finds a container appropriate sized for the node and locks it
44
## Could use existing list / lock API
45
## Alternately, to reduce contention, could add a "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 none is available
46
# 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)
47
# C-d-l makes API call to nodes table to say it is "busy"
48
# C-d-l calls crunch-run to run the container
49
# C-d-l must continue to ping that it is "busy" every X seconds
50
# When container finishes, c-d-l pings that it is "idle"
51
52
h3. Shutting down
53
54
# When node manager decides a node is ready for shutdown, it makes an API call on the node record to indicate "draining".
55
# 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.
56
# Node manager sees the node is "drained" and can proceed with shutdown.
57
58
h3. Handling failure
59
60
# If a node enters a failure state and there is a container associated with it, make sure to cancel the container.
61
# API server should have a background process which looks for nodes that haven't pinged recently puts them into failed state.
62
# Node can also put itself into failed state with an API call.
63
64
h1. Other options
65
66 1 Peter Amstutz
h2. Use slurm better
67
68
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.
69
70
Advantages:
71
72
* Least overall change compared to current architecture
73
74
Disadvantages:  
75
76
* Requires coordinated change to API server, node manager, crunch-dispatch-slurm, cluster configuration
77
* Ops seems to think that defining (sizes * max nodes) hostnames might be a problem?
78
* Can't adjust node configurations without restarting the whole cluster
79
80
h2. Cloud provider scheduling APIs
81
82
Use cloud provider scheduling APIs such as Azure Batch, AWS Batch, Google pipelines API to perform cluster scaling and scheduling.
83
84
Would be implemented as custom Arvados dispatcher services: crunch-dispatch-azure, crunch-dispatch-aws, crunch-dispatch-google.
85
86
Advantages:
87
88
* Get rid of Node Manager
89
90
Disadvantages:
91
92
* Has to be implemented per cloud provider.
93
* May be hard to customize behavior, such as job priority.
94
95
h2. Kubernetes
96
97
Submit containers to a Kubernetes cluster.  Kubernetes handles cluster scaling and scheduling.
98
99
Advantages:
100
101
* Get rid of node manager
102
* Desirable as part of overall plan to be able to run Arvados on Kubernetes
103
104
Disadvantages:
105
106
* Running crunch-run inside a container requires docker-in-docker (privileged container) or access to the Docker socket.