Compute configuration options for GCP
Cloud specific configurations are only available with self-hosted Anyscale Clouds.
GCP-specific options
Common configurations for GCP are listed below. For a complete reference on what might be configurable, see the GCP docs and contact Anyscale support.
Managing capacity reservations
Securing certain instance types from cloud providers can sometimes be challenging due to high demand or limited availability. With Anyscale, you can leverage your cloud provider capacity reservations, ensuring the availability of required node types for your workloads. To configure capacity reservations for a specific worker node type, modify the advanced configuration through the console UI or by editing the compute config YAML file.
To add a reservation with the console UI, navigate to a worker node and expand the Advanced config section. Under the Instance config tab, input the following JSON, substituting in your specific reservation name:
{
"instanceProperties": {
"reservationAffinity": {
"consumeReservationType": "SPECIFIC_RESERVATION",
"key": "compute.googleapis.com/reservation-name",
"values": ["RESERVATION_NAME"]
}
}
}
Expand for a sample YAML file that you can use with the Anyscale CLI/SDK
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- instance_type: INSTANCE_TYPE_ACCELERATED
min_nodes: MIN_NODES
max_nodes: MAX_NODES
advanced_instance_config:
instanceProperties:
reservationAffinity:
consumeReservationType: SPECIFIC_RESERVATION
key: compute.googleapis.com/reservation-name
values: [RESERVATION_NAME]
For additional details on utilizing open reservations in Google Cloud, see the Google Cloud documentation.
Changing the default disk size
The default disk size for all nodes in an Anyscale cluster is 150 GB. You can change the default disk size for the entire cluster or an individual worker node type.
To modify the default disk size from the console UI, use the Advanced configuration section for the Worker node or the Advanced settings section for the entire cluster. This example increases the default to 500 GB.
{
"instance_properties": {
"disks": [
{
"boot": true,
"auto_delete": true,
"initialize_params": {
"disk_size_gb": 500
}
}
]
}
}
Expand for a sample YAML file that you can use with the Anyscale CLI/SDK
This sample YAML will modify the disk for all nodes in the Anyscale cluster.
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- instance_type: INSTANCE_TYPE_ACCELERATED
min_nodes: MIN_NODES
max_nodes: MAX_NODES
advanced_instance_config:
instanceProperties:
disks:
- boot: true
auto_delete: true
initialize_params:
- disk_size_gb: 500
NVMe configuration
Anyscale supports Non-Volatile Memory Express (NVMe) interface to access SSD storage volumes, which provides additional temporary storage to the instances. This enables higher performance, lower latency, scalability, and support for versatile use cases across a variety of workloads. Anyscale exposes /mnt/local_storage
as the mount path in the Ray container by default. For instance types that don't have NVMe, /mnt/local_storage
just falls back to the root disk.
You need to manually specify the number of NVMe devices to attach to the instance. See GCP local SSD documentation for more details. Note that each local SSD has 375 GB. Specify the number of NVMe devices to attach in the Advanced settings > Instance config section of the compute config. Here is an example:

{
"instance_properties": {
"disks": [
{
"boot": true,
"type": "PERSISTENT",
"initializeParams": {
"diskSizeGb": 150
}
},
{
"type": "SCRATCH",
"interface": "NVME",
"autoDelete": true,
"initializeParams": {
"diskType": "local-ssd"
}
},
{
"type": "SCRATCH",
"interface": "NVME",
"autoDelete": true,
"initializeParams": {
"diskType": "local-ssd"
}
}
]
}
}
Subnets and service accounts
Specify the following configurations for the entire cluster (do not specify them for individual node groups unless you have to):
- Subnets:
- any subnet registered with the cloud.
- Service accounts:
- any service account for the cluster to run with. It must have permissions specified for a Ray Cluster service account in the cloud deployment documentation
To modify them from the console UI, use the Advanced settings section for the entire cluster.
{
"instance_properties": {
"service_accounts": [
{
"email": "service-account-to-use",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
],
"network_interfaces": [
{
"subnetwork": "subnetUrl",
"access_configs": [
{
"type": "ONE_TO_ONE_NAT"
}
]
}
]
}
}
Expand for a sample YAML file that you can use with the Anyscale CLI/SDK
This sample YAML will modify the service account and subnets for all nodes in the Anyscale cluster.
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- instance_type: INSTANCE_TYPE_ACCELERATED
min_nodes: MIN_NODES
max_nodes: MAX_NODES
advanced_instance_config:
instance_properties:
service_accounts:
- email: service-account-to-use
scopes:
- "https://www.googleapis.com/auth/cloud-platform"
network_interfaces:
- subnetwork: subnetUrl
access_configs:
- type: ONE_TO_ONE_NAT
Advanced features
The following options are common to any cloud.
Adjustable downscaling
The Anyscale platform automatically downscales worker nodes that have been idle for a given period. By default, the timeout period ranges from 30 seconds to 4 minutes and is dynamically adjusted for each node group based on the workload. For example, short, bursty workloads have shorter timeouts and more aggressive downscaling. Adjustable downscaling allows users to adjust this timeout value at the cluster-level based on their workload needs.
- Console
- CLI
To adjust the timeout value from the Anyscale console, use the Advanced features tab under the Advanced settings for the cluster. This example sets the timeout to 60 seconds for all nodes in the cluster.
{
"idle_termination_seconds": 60
}
To adjust the timeout value from the Anyscale CLI, use the flags
field. This example YAML sets the timeout value to 60 seconds for all nodes in the cluster.
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- instance_type: INSTANCE_TYPE_WORKER
min_nodes: MIN_NODES
max_nodes: MAX_NODES
flags:
idle_termination_seconds: 30
Cross-zone scaling
Cross-zone scaling is a feature that allows Anyscale to launch your Ray cluster across multiple availability zones. By default, all worker nodes are launched in the same availability zone. With cross-zone scaling enabled, Anyscale first attempts to launch worker nodes in existing zones, but if that fails, then tries the next-best zone (based on availability).
Use this feature if:
- You want to maximize the chances of provisioning desired instance types.
- You want to spread Serve app replicas across multiple zones for better resilience and availability.
- Your workloads have no heavy inter-node communication or the incurred inter-availability zone cost is acceptable.
- Console
- CLI
To enable or disable this feature from the Anyscale console, use the "Enable cross-zone scaling" checkbox under the Advanced settings for the cluster.
To enable or disable this feature from the Anyscale CLI, use the enable_cross_zone_scaling
field. This example YAML enables cross-zone scaling for all nodes in the cluster.
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- instance_type: INSTANCE_TYPE_WORKER
min_nodes: MIN_NODES
max_nodes: MAX_NODES
enable_cross_zone_scaling: true
Resource limits
Cluster-wide resource limits allow you to define minimum and maximum values for any resource across all nodes in the cluster. There are two common use cases for this feature:
- Specifying the maximum number of GPUs to avoid unintentionally launching a large number of expensive instances.
- Specifying a custom resource for specific worker nodes and using that custom resource value to limit the number of nodes of those types.
- Console
- CLI
To set the maximum number of CPUs and GPUs in a cluster from the Anyscale console, use the "Maximum CPUs" and "Maximum GPUs" fields under the Advanced settings for the cluster.
To set other resource limits, use the Advanced features tab under the Advanced settings for the cluster. To add a custom resource to a node group, use the Ray config tab under the Advanced config section for that node group.
This example limits the minimum resources to 1 GPU and 1 CUSTOM_RESOURCE
and limits the maximum resources to 5 CUSTOM_RESOURCE
.
{
"min_resources": {
"GPU": 1,
"CUSTOM_RESOURCE": 1
},
"max_resources": {
"CUSTOM_RESOURCE": 5,
}
}
To set resource limits for a cluster from the Anyscale CLI, use the min_resources
and max_resources
fields. This example YAML adds a custom resource to a worker node, limits the minimum resources to 8 CPU and 1 CUSTOM_RESOURCE
, and limits the maximum resources to 1 GPU and 5 CUSTOM_RESOURCE
.
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- instance_type: INSTANCE_TYPE_WORKER
resources:
CUSTOM_RESOURCE: 1
min_nodes: MIN_NODES
max_nodes: MAX_NODES
min_resources:
CPU: 8
CUSTOM_RESOURCE: 1
max_resources:
GPU: 1
CUSTOM_RESOURCE: 5
Workload starting and recovering timeouts
The workload starting timeout allows you to configure how long a workload should attempt to acquire the minimum resources when it first starts, before Anyscale terminates it.
After a workload is running, it may enter the RECOVERING
state if it's attempting to recover the minimum resources, for example, due to spot preemption. The workload recovering timeout allows you to configure how long a workload may remain in the RECOVERING
state, to avoid the cost of idling existing nodes.
By default, Anyscale sets both timeouts to 25 minutes.
These timeouts only apply to jobs and workspaces, not services.
- Console
- CLI
To configure the workload starting and recovering timeouts from the Anyscale console, use the Advanced features tab under the Advanced settings for the cluster. This example increases the workload starting timeout to 1 hour and decreases the workload recovering timeout to 10 minutes.
Valid time units are: s
, m
, and h
. For example, 1h30m
.
{
"workload_starting_timeout": "1h",
"workload_recovering_timeout": "10m"
}
To configure the workload starting and recovering timeouts from the Anyscale CLI, use the flags
field. This example increases the workload starting timeout to 1 hour and decreases the workload recovering timeout to 10 minutes.
Valid time units are: s
, m
, and h
. For example, 1h30m
.
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- instance_type: INSTANCE_TYPE_WORKER
flags:
workload_starting_timeout: 1h
workload_recovering_timeout: 10m
Zonal startup timeout
Anyscale attempts to pack cluster and worker group nodes into the same zone to improve cluster communication performance and minimize cross zone data transfer.
However, machines may not always be available because of capacity constraints, IP addresses, or other reasons. If Anyscale is unable to get the requested minimum resources, Anyscale terminates any existing nodes and sequentially tries the request in a different zone within the cloud deployment.
By default, Anyscale sets the zonal startup timeout to 10 minutes.
- Console
- CLI
To configure the workload zonal startup timeout from the Anyscale console, use the Advanced features tab under the Advanced settings for the cluster. This example increases the workload zonal startup timeout to 60 seconds.
Valid time units are: s
, m
, and h
. For example, 1h30m
.
{
"default_zone_starting_timeout": "60s"
}
To configure the workload zonal startup timeout from the Anyscale CLI, use the flags
field. This example increases the workload zonal startup timeout to 60 seconds.
Valid time units are: s
, m
, and h
. For example, 1h30m
.
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- instance_type: INSTANCE_TYPE_WORKER
flags:
default_zone_starting_timeout: 60s
Worker group ranking
The worker group ranking feature is in developer preview.
Some workloads may require prioritizing specific worker groups over others. This could involve utilizing on-demand capacity reservations before scaling out to use spot instances, or influencing the utilization of a particular node type before another.
Anyscale's default ranking prioritizes CPU-only worker groups above GPU worker groups, spot above on-demand, and availability of the instance type. With the instance ranking feature, you can instead specify a custom ranking order for the worker groups. In addition, with node replacement enabled, Anyscale automatically replaces lower-ranked nodes with higher-ranked nodes when they become available.
When you provide multiple rankers, Anyscale prioritizes earlier rankers over later rankers. If an ordering in a later ranker conflicts with an earlier ranker, Anyscale ignores the conflicting ranking in the later ranker.
- Console
- CLI
To specify a custom worker group ranking from the Anyscale console, use the Advanced features tab under the Advanced settings for the cluster. This example specifies a ranking for 3 worker groups named spot-worker-1
, spot-worker-2
, and on-demand-worker
, where Anyscale prioritizes both spot groups over the on-demand group, but the two spot groups have equal priority.
{
"instance_ranking_strategy": [
{
"ranker_type": "custom_group_order",
"ranker_config": {
"group_order": [
["spot-worker-1", "spot-worker-2"],
"on-demand-worker"
]
}
},
]
}
To specify a custom worker group ranking from the Anyscale CLI, use the flags
field. This example specifies a ranking for 3 worker groups named spot-worker-1
, spot-worker-2
, and on-demand-worker
, Anyscale prioritizes both spot groups over the on-demand group, but the two spot groups have equal priority.
cloud: CLOUD_NAME
head_node:
instance_type: INSTANCE_TYPE_HEAD
worker_nodes:
- name: spot-worker-1
instance_type: INSTANCE_TYPE_WORKER_1
market_type: SPOT
- name: spot-worker-2
instance_type: INSTANCE_TYPE_WORKER_2
market_type: SPOT
- name: on-demand-worker
instance_type: INSTANCE_TYPE_WORKER_3
market_type: ON_DEMAND
flags:
instance_ranking_strategy:
- ranker_type: custom_group_order
ranker_config:
group_order:
- - spot-worker-1
- spot-worker-2
- on-demand-worker