Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spanner): add autoscaling config to the instance proto #1935

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,66 @@ message InstanceConfig {
State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Autoscaling config for an instance.
message AutoscalingConfig {
// The autoscaling limits for the instance. Users can define the minimum and
// maximum compute capacity allocated to the instance, and the autoscaler will
// only scale within that range. Users can either use nodes or processing
// units to specify the limits, but should use the same unit to set both the
// min_limit and max_limit.
message AutoscalingLimits {
// The minimum compute capacity for the instance.
oneof min_limit {
// Minimum number of nodes allocated to the instance. If set, this number
// should be greater than or equal to 1.
int32 min_nodes = 1;

// Minimum number of processing units allocated to the instance. If set,
// this number should be multiples of 1000.
int32 min_processing_units = 2;
}

// The maximum compute capacity for the instance. The maximum compute
// capacity should be less than or equal to 10X the minimum compute
// capacity.
oneof max_limit {
// Maximum number of nodes allocated to the instance. If set, this number
// should be greater than or equal to min_nodes.
int32 max_nodes = 3;

// Maximum number of processing units allocated to the instance. If set,
// this number should be multiples of 1000 and be greater than or equal to
// min_processing_units.
int32 max_processing_units = 4;
}
}

// The autoscaling targets for an instance.
message AutoscalingTargets {
// Required. The target high priority cpu utilization percentage that the
// autoscaler should be trying to achieve for the instance. This number is
// on a scale from 0 (no utilization) to 100 (full utilization). The valid
// range is [10, 90] inclusive.
int32 high_priority_cpu_utilization_percent = 1
[(google.api.field_behavior) = REQUIRED];

// Required. The target storage utilization percentage that the autoscaler
// should be trying to achieve for the instance. This number is on a scale
// from 0 (no utilization) to 100 (full utilization). The valid range is
// [10, 100] inclusive.
int32 storage_utilization_percent = 2
[(google.api.field_behavior) = REQUIRED];
}

// Required. Autoscaling limits for an instance.
AutoscalingLimits autoscaling_limits = 1
[(google.api.field_behavior) = REQUIRED];

// Required. The autoscaling targets for an instance.
AutoscalingTargets autoscaling_targets = 2
[(google.api.field_behavior) = REQUIRED];
}

// An isolated set of Cloud Spanner resources on which databases can be hosted.
message Instance {
option (google.api.resource) = {
Expand Down Expand Up @@ -606,8 +666,12 @@ message Instance {
string display_name = 3 [(google.api.field_behavior) = REQUIRED];

// The number of nodes allocated to this instance. At most one of either
// node_count or processing_units should be present in the message. This
// may be zero in API responses for instances that are not yet in state
// node_count or processing_units should be present in the message.
//
// Users can set the node_count field to specify the target number of nodes
// allocated to the instance.
//
// This may be zero in API responses for instances that are not yet in state
// `READY`.
//
// See [the
Expand All @@ -616,14 +680,26 @@ message Instance {
int32 node_count = 5;

// The number of processing units allocated to this instance. At most one of
// processing_units or node_count should be present in the message. This may
// be zero in API responses for instances that are not yet in state `READY`.
// processing_units or node_count should be present in the message.
//
// Users can set the processing_units field to specify the target number of
// processing units allocated to the instance.
//
// This may be zero in API responses for instances that are not yet in state
// `READY`.
//
// See [the
// documentation](https://cloud.google.com/spanner/docs/compute-capacity)
// for more information about nodes and processing units.
int32 processing_units = 9;

// Optional. The autoscaling configuration. Autoscaling is enabled if this
// field is set. When autoscaling is enabled, node_count and processing_units
// are treated as OUTPUT_ONLY fields and reflect the current compute capacity
// allocated to the instance.
AutoscalingConfig autoscaling_config = 17
[(google.api.field_behavior) = OPTIONAL];

// Output only. The current instance state. For
// [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance],
// the state must be either omitted or set to `CREATING`. For
Expand Down