You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The cluster can be configured to provision different instance types depending on what resources the APIs request. The multi instance type cluster has the following advantages over the single-instance type cluster:
4
+
5
+
***Lower costs**: Reduced overall compute costs by using the most economical instance for the given workloads.
6
+
***Simpler logistics**: Managing multiple clusters on your own is no longer required.
7
+
***Multi-purpose cluster**: The cluster can now take any range of workloads. One cluster for everything. Just throw a bunch of node groups in the cluster config, and you’re set.
8
+
9
+
## Best practices
10
+
11
+
When specifying the node groups in your `cluster.yaml` config, keep in mind that node groups with lower indexes have a higher priority over the other ones. With that mind, the best practices that result from this are:
12
+
13
+
1. Node groups with smaller instances should have the higher priority.
14
+
1. Node groups with CPU-only instances should come before the node groups equipped with GPU/Inferentia instances.
15
+
1. The spot node groups should always come first over the ones that have on-demand instances.
16
+
17
+
## Example node groups
18
+
19
+
### CPU spot/on-demand with GPU on-demand
20
+
21
+
```yaml
22
+
# cluster.yaml
23
+
24
+
node_groups:
25
+
- name: cpu-spot
26
+
instance_type: m5.large
27
+
spot: true
28
+
- name: cpu
29
+
instance_type: m5.large
30
+
- name: gpu
31
+
instance_type: g4dn.xlarge
32
+
```
33
+
34
+
### CPU on-demand, GPU on-demand and Inferentia on-demand
35
+
36
+
```yaml
37
+
# cluster.yaml
38
+
39
+
node_groups:
40
+
- name: cpu
41
+
instance_type: m5.large
42
+
- name: gpu
43
+
instance_type: g4dn.xlarge
44
+
- name: inferentia
45
+
instance_type: inf.xlarge
46
+
```
47
+
48
+
### 3 spot CPU node groups with 1 on-demand CPU
49
+
50
+
```yaml
51
+
# cluster.yaml
52
+
53
+
node_groups:
54
+
- name: cpu-0
55
+
instance_type: t3.medium
56
+
spot: true
57
+
- name: cpu-1
58
+
instance_type: m5.2xlarge
59
+
spot: true
60
+
- name: cpu-2
61
+
instance_type: m5.8xlarge
62
+
spot: true
63
+
- name: cpu-3
64
+
instance_type: m5.24xlarge
65
+
```
66
+
67
+
The above can also be achieved with the following config.
# percentage of on demand instances to use after the on demand base capacity has been met [0, 100] (default: 50)
17
-
# note: setting this to 0 may hinder cluster scale up when spot instances are not available
18
-
on_demand_percentage_above_base_capacity: 0
16
+
# minimum number of on demand instances (default: 0)
17
+
on_demand_base_capacity: 0
19
18
20
-
# max price for spot instances (default: the on-demand price of the primary instance type)
21
-
max_price: # <float>
19
+
# percentage of on demand instances to use after the on demand base capacity has been met [0, 100] (default: 50)
20
+
# note: setting this to 0 may hinder cluster scale up when spot instances are not available
21
+
on_demand_percentage_above_base_capacity: 0
22
22
23
-
# number of spot instance pools across which to allocate spot instances [1, 20] (default: number of instances in instance distribution)
24
-
instance_pools: 3
23
+
# max price for spot instances (default: the on-demand price of the primary instance type)
24
+
max_price: # <float>
25
25
26
-
# fallback to on-demand instances if spot instances were unable to be allocated (default: true)
27
-
on_demand_backup: true
26
+
# number of spot instance pools across which to allocate spot instances [1, 20] (default: number of instances in instance distribution)
27
+
instance_pools: 3
28
28
```
29
29
30
30
Spot instances are not guaranteed to be available. The chances of getting spot instances can be improved by providing `instance_distribution`, a list of alternative instance types to the primary `instance_type` you specified. If left blank, Cortex will only include the primary instance type in the `instance_distribution`. When using `instance_distribution`, use the instance type with the fewest compute resources as your primary `instance_type`. Note that the default value for `max_price` is the on-demand price of the primary instance type, but you may wish to set this to the on-demand price of the most expensive instance type in your `instance_distribution`.
31
31
32
32
Spot instances can be mixed with on-demand instances by configuring `on_demand_base_capacity` and `on_demand_percentage_above_base_capacity`. `on_demand_base_capacity` enforces the minimum number of nodes that will be fulfilled by on-demand instances as your cluster is scaling up. `on_demand_percentage_above_base_capacity` defines the percentage of instances that will be on-demand after the base capacity has been fulfilled (the rest being spot instances). `instance_pools` is the number of pools per availability zone to allocate your instances from. See [here](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_InstancesDistribution.html) for more details.
33
33
34
-
Even if multiple instances are specified in your `instance_distribution` on-demand instances are mixed, there is still a possibility of running into scale up issues when attempting to spin up spot instances. Spot instance requests may not be fulfilled for several reasons. Spot instance pricing fluctuates, therefore the `max_price` may be lower than the current spot pricing rate. Another possibility could be that the availability zones of the cluster ran out of spot instances. `on_demand_backup` can be used mitigate the impact of unfulfilled spot requests by enabling the cluster to spin up on-demand instances if spot instance requests are not fulfilled within 5 minutes.
34
+
Even if multiple instances are specified in your `instance_distribution` on-demand instances are mixed, there is still a possibility of running into scale up issues when attempting to spin up spot instances. Spot instance requests may not be fulfilled for several reasons. Spot instance pricing fluctuates, therefore the `max_price` may be lower than the current spot pricing rate. Another possibility could be that the availability zones of the cluster ran out of spot instances. The addition of another on-demand node group to `node_groups` with a lower priority (by having a higher index in the `node_groups` list) can mitigate the impact of unfulfilled spot requests by enabling the cluster to spin up on-demand instances if spot instance requests are not fulfilled within 5 minutes.
35
35
36
36
There is a spot instance limit associated with your AWS account for each instance family in each region. You can check your current limit and request an increase [here](https://console.aws.amazon.com/servicequotas/home?#!/services/ec2/quotas) (set the region in the upper right corner to your desired region, type "spot" in the search bar, and click on the quota that matches your instance type). Note that the quota values indicate the number of vCPUs available, not the number of instances; different instances have a different numbers of vCPUs, which can be seen [here](https://aws.amazon.com/ec2/instance-types/).
37
37
38
38
## Example spot configuration
39
39
40
-
### Only spot instances with backup
40
+
### Only spot instances
41
41
42
42
```yaml
43
-
44
-
spot: true
45
-
46
-
spot_config:
47
-
on_demand_base_capacity: 0
48
-
on_demand_percentage_above_base_capacity: 0
49
-
on_demand_backup: true # recommended for production clusters
43
+
node_groups:
44
+
- name: node-group-1
45
+
spot: true
50
46
```
51
47
52
48
### 3 on-demand base capacity with 0% on-demand above base capacity
53
49
54
50
```yaml
55
-
min_instances: 0
56
-
max_instances: 5
57
51
58
-
spot: true
59
-
spot_config:
60
-
on_demand_base_capacity: 3
61
-
on_demand_percentage_above_base_capacity: 0
52
+
node_groups:
53
+
- name: node-group-1
54
+
min_instances: 0
55
+
max_instances: 5
56
+
spot: true
57
+
spot_config:
58
+
on_demand_base_capacity: 3
59
+
on_demand_percentage_above_base_capacity: 0
62
60
63
61
# instance 1-3: on-demand
64
62
# instance 4-5: spot
@@ -67,13 +65,14 @@ spot_config:
67
65
### 0 on-demand base capacity with 50% on-demand above base capacity
0 commit comments