This page describes how to create and manage Spanner instance partitions .
Create an instance partition
Console
-
In the Google Cloud console, open the Spannerpage.
-
Select the instance in which you want to add instance partitions.
-
In the navigation menu, select Instance partitions.
-
Click Create instance partition.
-
Enter an Instance partition IDto permanently identify your instance partition. The instance partition ID must also be unique within your instance. You can't change the instance partition ID later.
-
In the Choose a configurationsection, select Regionalor Multi-region. Alternatively, if you want to compare the specifications between the regions, then click Compare region configurations.
-
Select a configuration from the drop-down menu.
-
In the Configure compute capacitysection, under Select unit, click one of the following:
- Nodesfor large instances. A node is 1000 processing units.
- Processing unitsfor small instance partitions.
For more information, see Compute capacity, nodes, and processing units .
-
Under Choose a scaling mode, click one of the following:
-
Manual allocationif you want to manually set compute capacity for fixed compute resources and costs.
- Quantityindicates the number of processing units or nodes to use for this instance.
-
Autoscalingto let Spanner automatically add and remove compute capacity. Managed autoscaler is available in the Spanner Enterprise edition and Enterprise Plus edition . For more information about the managed autoscaler, see Managed autoscaler for Spanner . Configure the following managed autoscaler options:
- Minimumindicates the minimum limit to scale down to, depending on the measurement unit that you choose for Compute capacity. For more information, see Determine the minimum limit .
- Maximumindicates the maximum limit to scale up to, depending on the measurement unit that you choose for Compute capacity. For more information, see Determine the maximum limit .
- High priority CPU utilization targetindicates the target percentage of CPU to use for high priority tasks. For more information, see Determine the CPU utilization target .
- Total CPU utilization targetindicates the target percentage of CPU to use for all low, medium, and high priority tasks. For more information, see Determine the total CPU utilization target .
- Storage utilization targetindicates the target percentage of storage to use. For more information, see Determine the Storage Utilization Target .
-
-
Click Createto create the instance partition.
gcloud
To create an instance partition, use gcloud spanner instance-partitions create
.
gcloud spanner instance-partitions create INSTANCE_PARTITION_ID \ --config= INSTANCE_PARTITION_CONFIG \ --description=" INSTANCE_PARTITION_DESCRIPTION " \ --instance= INSTANCE_ID \ [--nodes= NODE_COUNT | --processing-units= PROCESSING_UNIT_COUNT ]
Replace the following:
- INSTANCE_PARTITION_ID : the permanent instance partition identifier that is unique within your instance. You can't change the instance partition ID later.
- INSTANCE_PARTITION_CONFIG : the permanent identifier of your instance partition configuration, which defines the geographic location of the instance partition and affects where data is stored.
- INSTANCE_PARTITION_DESCRIPTION : the name to display for the instance partition in the Google Cloud console. The instance partition name must be unique within your instance.
- INSTANCE_ID : the permanent identifier for your Spanner instance where this instance partition resides.
- NODE_COUNT : the compute capacity of the instance partition, expressed as a number of nodes. One node equals 1000 processing units.
- PROCESSING_UNIT_COUNT : the compute capacity of the instance, expressed as a number of processing units. Your instance partition must have at least 1000 processing units. Enter quantities in multiples of 1000 (1000, 2000, 3000 and so on).
For example, to create an instance partition europe-partition
in eur3
with 5 nodes, run the following:
gcloud
spanner
instance-partitions
create
europe-partition
--config =
eur3
\
--description =
"europe-partition"
--instance =
test-instance
--nodes =
5
Use managed autoscaling
You can use
managed autoscaling with the gcloud spanner instance-partitions create
command. For more information, see Managed autoscaler
.
Use the following command to create an instance partition with managed autoscaler:
gcloud spanner instance-partitions create INSTANCE_PARTITION_ID \ --config= INSTANCE_PARTITION_CONFIG \ --description=" INSTANCE_PARTITION_DESCRIPTION " \ --instance= INSTANCE_ID \ --autoscaling-min-processing-units= MINIMUM_PROCESSING_UNITS \ --autoscaling-max-processing-units= MAXIMUM_PROCESSING_UNITS \ --autoscaling-high-priority-cpu-target= HIGH_PRIORITY_CPU_PERCENTAGE \ --autoscaling-total-cpu-target= TOTAL_CPU_PERCENTAGE \ --autoscaling-storage-target= STORAGE_PERCENTAGE
or
gcloud spanner instance-partitions create INSTANCE_PARTITION_ID \ --config= INSTANCE_PARTITION_CONFIG \ --description=" INSTANCE_PARTITION_DESCRIPTION " \ --instance= INSTANCE_ID \ --autoscaling-min-nodes= MINIMUM_NODES \ --autoscaling-max-nodes= MAXIMUM_NODES \ --autoscaling-high-priority-cpu-target= HIGH_PRIORITY_CPU_PERCENTAGE \ --autoscaling-total-cpu-target= TOTAL_CPU_PERCENTAGE --autoscaling-storage-target= STORAGE_PERCENTAGE
Replace the following:
- INSTANCE_PARTITION_ID : the permanent instance partition identifier that is unique within your instance. You can't change the instance partition ID later.
- INSTANCE_PARTITION_CONFIG : the permanent identifier of your instance partition configuration, which defines the geographic location of the instance partition and affects where data is stored.
- INSTANCE_PARTITION_DESCRIPTION : the name to display for the instance partition in the Google Cloud console. The instance partition name must be unique within your instance.
- INSTANCE_ID : the permanent identifier for your Spanner instance where this instance partition resides.
- MINIMUM_PROCESSING_UNITS or MINIMUM_NODES : the minimum number of processing units or nodes when scaling down. For more information, see Determine the minimum limit .
- MAXIMUM_PROCESSING_UNITS or MAXIMUM_NODES : the maximum number of processing units or nodes when scaling up. For more information, see Determine the maximum limit .
- HIGH_PRIORITY_CPU_PERCENTAGE : the target percentage of high priority CPU to use, based on the priority of the task . The CPU percentage can range from 10 to 90%. For more information, see Determine the high priority CPU utilization target .
- TOTAL_CPU_PERCENTAGE : the target percentage of total priority CPU to use. The total CPU target has to be greater than the high priority CPU target. The CPU percentage can range from 10 to 90%. For more information, see Determine the total CPU utilization target .
- STORAGE_PERCENTAGE : the target percentage of storage to use, from 10 to 99%. For more information, see Determine the storage utilization target .
Client libraries
C++
To learn how to install and use the client library for Spanner, see Spanner client libraries .
C#
To learn how to install and use the client library for Spanner, see Spanner client libraries .
Go
To learn how to install and use the client library for Spanner, see Spanner client libraries .
Java
To learn how to install and use the client library for Spanner, see Spanner client libraries .
Node.js
To learn how to install and use the client library for Spanner, see Spanner client libraries .
PHP
To learn how to install and use the client library for Spanner, see Spanner client libraries .
Python
To learn how to install and use the client library for Spanner, see Spanner client libraries .
Describe an instance partition
gcloud
To describe an instance partition, use gcloud spanner instance-partitions describe
.
gcloud spanner instance-partitions describe PARTITION_ID \ --instance= INSTANCE_ID
Replace the following:
- INSTANCE_PARTITION_ID : the permanent identifier for the instance partition.
- INSTANCE_ID : the permanent identifier for the instance.
For example, to describe the instance partition europe-partition
,
run the following:
gcloud
spanner
instance-partitions
describe
europe-partition
--instance =
test-instance
List instance partitions
Console
-
In the Google Cloud console, open the Spannerpage.
-
Select an instance from the list.
-
In the navigation menu, select Instance partitions.
A list of instance partitions associated with that instance is shown.
gcloud
To list your instance partitions, use gcloud spanner instance-partitions list
.
gcloud spanner instance-partitions list --instance= INSTANCE_ID
The gcloud CLI prints a list of your Spanner instance partitions, along with each instance partition's ID, display name, configuration, and compute capacity.
Edit an instance partition
The following section explains how to change the compute capacity of your instance partition. You can't change the instance partition ID, name, or configuration.
Change the compute capacity
You must provision enough compute capacity to keep CPU utilization and storage utilization below the recommended maximums. For more information, see the quotas and limits for Spanner.
If you want to increase the compute capacity of an instance partition, your Google Cloud project must have sufficient quota to add the compute capacity. The time it takes for the increase request to complete depends on the size of the request. In most cases, requests complete within a few minutes. On rare occasions, a scale up might take up to an hour to complete.
Console
-
In the Google Cloud console, open the Spannerpage.
-
Select an instance from the list.
-
In the navigation menu, select Instance partitions.
-
In the list of instance partitions, under the Actionscolumn, click More Actionsand select Edit.
-
Change the compute capacity by choosing a measurement unit (processing units or nodes), and then entering a quantity. When using processing units, enter quantities in multiples of 1000 (1000, 2000, 3000 and so on). Each node equals 1000 processing units.
Your instance partition must have at least one node (1000 processing units).
-
Click Save.
If you see a dialog that says you have insufficient quota to add compute capacity , follow the instructions to request a higher quota.
gcloud
To change the compute capacity of your instance partition, use gcloud spanner instance-partitions update
.
When using this command, specify the compute capacity
as a
number of nodes or processing units.
gcloud spanner instance-partitions update INSTANCE_PARTITION_ID \ --instance= INSTANCE_ID \ [--nodes= NODE_COUNT | --processing-units= PROCESSING_UNIT_COUNT ] [--async]
Replace the following:
- INSTANCE_PARTITION_ID : the permanent identifier for the instance partition.
- INSTANCE_ID : the permanent identifier for the instance.
- NODE_COUNT : the new compute capacity of the instance partition, expressed as a number of nodes. One node equals 1000 processing units.
- PROCESSING_UNIT_COUNT : the new compute capacity of the instance partition, expressed as a number of processing units. Your instance partition must have at least 1000 processing units. Enter quantities in multiples of 1000 (1000, 2000, 3000 and so on).
Optional flags:
-
--async: Use this flag if you want your request to return immediately, without waiting for the operation in progress to complete.
You can check the status of your request by running gcloud spanner operations describe
.
Enable or modify the managed autoscaler on an instance partition
The following limitations apply when you enable or change the managed autoscaling feature on an existing instance partition:
-
You can't move an instance while the managed autoscaler is enabled.
Console
-
In the Google Cloud console, open the Spannerpage.
-
Select an instance from the list.
-
In the navigation menu, select Instance partitions.
-
In the list of instance partitions, under the Actionscolumn, click More Actionsand select Edit.
-
Under Configure compute capacity, click Autoscaling.
-
For Minimum, select the minimum limit to use when scaling down. For more information, see Determine the minimum limit .
-
For Maximum, select the maximum limit to use when scaling up. For more information, see Determine the maximum limit .
-
For High priority CPU utilization target, enter the percentage of CPU to use for high priority tasks. For more information, see Determine the CPU utilization target .
-
For Total CPU utilization target, enter the target CPU percentage to use for all low, medium, and high priority tasks . The CPU percentage can range from 10 to 90%. For more information, see Determine the total CPU utilization target .
-
For Storage utilization target, enter the percentage of storage to use. For more information, see Determine the storage utilization target .
-
Click Save.
gcloud
Use the gcloud spanner instance-partitions update
command to enable the managed autoscaler on an instance partition. For more
information and limitations, see Google Cloud CLI
flags and limitations
.
You can add the managed autoscaler with the following command:
gcloud spanner instance-partitions update INSTANCE_PARTITION_ID \ --instance= INSTANCE_ID \ --autoscaling-min-processing-units= MINIMUM_PROCESSING_UNITS \ --autoscaling-max-processing-units= MAXIMUM_PROCESSING_UNITS \ --autoscaling-high-priority-cpu-target= HIGH_PRIORITY_CPU_PERCENTAGE \ --autoscaling-total-cpu-target= TOTAL_CPU_PERCENTAGE \ --autoscaling-storage-target= STORAGE_PERCENTAGE
or
gcloud spanner instance-partitions update INSTANCE_PARTITION_ID \ --instance= INSTANCE_ID \ --autoscaling-min-nodes= MINIMUM_NODES \ --autoscaling-max-nodes= MAXIMUM_NODES \ --autoscaling-high-priority-cpu-target= HIGH_PRIORITY_CPU_PERCENTAGE \ --autoscaling-total-cpu-target= TOTAL_CPU_PERCENTAGE \ --autoscaling-storage-target= STORAGE_PERCENTAGE
Replace the following:
- INSTANCE_PARTITION_ID : the permanent identifier for the instance partition.
- INSTANCE_ID : the permanent identifier for the instance.
- MINIMUM_PROCESSING_UNITS or MINIMUM_NODES : the minimum number of processing units or nodes to use when scaling down. For more information, see Determine the minimum limit .
- MAXIMUM_PROCESSING_UNITS or MAXIMUM_NODES : the maximum number of processing units or nodes to use when scaling up. For more information, see Determine the maximum limit .
- HIGH_PRIORITY_CPU_PERCENTAGE : the target percentage of high priority CPU to use, based on the priority of the task . The CPU percentage can range from 10 to 90%. For more information, see Determine the high priority CPU utilization target .
- TOTAL_CPU_PERCENTAGE : the target percentage of total priority CPU to use. The total CPU target has to be greater than the high priority CPU target. The CPU percentage can range from 10 to 90%. For more information, see Determine the total CPU utilization target .
- STORAGE_PERCENTAGE : the target percentage of storage to use, from 10% to 99%. For more information, see Determine the Storage Utilization Target .
After you enable the managed autoscaler on an instance partition, you can also modify the managed autoscaler settings. For example, if you want to increase the maximum number of processing units to 10000, run the following command:
gcloud spanner instance-partitions update test-instance-partition \
--instance=test-instance
--autoscaling-max-processing-units=10000
Change an instance partition from using managed autoscaler to manual scaling
Console
-
Go to the Spanner Instancespage in the Google Cloud console.
-
Select an instance from the list.
-
In the navigation menu, select Instance partitions.
-
In the list of instance partitions, under the Actionscolumn, click More Actionsand select Edit.
-
Under Choose a scaling mode, check the Manual allocationbox.
-
Click Save.
gcloud
Use the gcloud spanner instance-partitions update
command to update the instance partition.
Use the following command to change an instance partition from using the managed autoscaler to manual scaling:
gcloud spanner instance-partitions update INSTANCE_PARTITION_ID \ --instance= INSTANCE_ID \ --processing-units= PROCESSING_UNIT_COUNT
or
gcloud spanner instance-partitions update INSTANCE_PARTITION_ID \ --instance= INSTANCE_ID \ --nodes= NODE_COUNT
Replace the following:
- INSTANCE_PARTITION_ID : the permanent identifier for the instance partition.
- INSTANCE_ID : the permanent identifier for the instance.
- NODE_COUNT : the compute capacity of the instance, expressed as a number of nodes. Each node equals 1000 processing units.
- PROCESSING_UNIT_COUNT : the compute capacity of the instance, expressed as a number of processing units. The minimum processing units for an instance partition is 1000.
Delete an instance partition
You can't delete an instance partition while it's associated with any placements or data. You must first move any data that's in the instance partition or delete the placement tables that use the instance partition before you can delete the instance partition.
Console
-
In the Google Cloud console, open the Spannerpage.
-
Select an instance from the list.
-
In the navigation menu, select Instance partitions.
-
In the list of instance partitions, under the Actionscolumn, click More Actions, and select Delete.
-
Follow the instructions to confirm that you want to delete the Instance partition.
-
Click Delete.
gcloud
Use the gcloud spanner instance-partitions delete
command.
gcloud spanner instance-partitions delete INSTANCE_PARTITION_ID --instance= INSTANCE_ID
What's next
- Learn how to create and manage placement table and keys .

