In-place Resizing for PostgreSQL
Nodes in a PostgreSQL cluster can be resized in-place via the Console, through our Provisioning API or by utilising the Instaclustr terraform provider. Moving to a new node size lets you scale the CPU core count, memory quotas as well as increase disk capacity to meet changing demands.
Preparation
Instaclustr recommends that you first test your applications against in-place resizing in a non-production setting to verify that the resize process doesn’t interrupt your applications.
During a cluster resize operation nodes that are being resized will be unavailable for a short period.
Resize Constraints
- Disks can be increased but not decreased.
- The nodes selected for resize must all be the same size.
- AWS:
- Current in place resizing is only supported on AWS Nodes which are EBS backed Graviton instances.
- Resizing where the disk is modified can only be done once every 6 hours due to EBS limitations.
- GCP:
- Current in place resizing is only supported on a GCP Node which has a Persistent disk. (Persistent disks are referred to as ‘Zonal PD SSD’ on our console, an abbreviation for ‘Zonal Persistent Disk SSD’.)
- AZURE_AZ:
- Current in place resizing is only supported on a AZURE_AZ Node which has a Premium SSD disk.
- AZURE:
- Not Supported.
Resizing Behaviour
The existing primary node will be resized last and will do a switchover operation in the case it is a multi-node data centre to an already resized node for highest availability possible. After all nodes are resized it may be required to do a rolling restart on all services to update configurations dependent on node size.
Resizing a data centre will have different levels of service disruptions in accordance to the number of nodes in the data centre being resized and replication options that were selected at creation time. All resizes will cause short periods of service interruptions during restarts and switchover operations where clients need to reconnect and resubmit transactions.
Node Count | Synchronous Replication | Synchronous Mode Strict | Impact |
1 | Enabled | Not Applicable | Resize cluster data centre is not supported |
1 | Disabled | Not Applicable | There will be read/write unavailability during restarts and while node is being resized |
2 | Enabled | Enabled | Writes will not be acknowledged while the replica is being resized. There will be brief service interruptions during node restarts and switchover operations. |
2 | Enabled / Disabled | Disabled | There will be brief service interruptions during node restarts and switchover operations. |
3 | Enabled / Disabled | Enabled / Disabled | There will be brief service interruptions during node restarts and switchover operations. |
Clients Settings
The clients must be configured to retry connections and be able to identify primaries and secondaries as required by the application. We suggest using a client that supports libpq connection strings with multiple IPs and target_session_attributes to handle switchovers.
Use the appropriate synchronous_commit level in accordance to your expected transaction durability as a best practice.
Resizing
To resize data centre nodes, navigate to the Resize page for your PostgreSQL cluster.
The Concurrent Resizes is a number that specifies how many nodes may be resized at the same time. PostgreSQL cluster data centres are only allowed to be resized one node at a time. Any resize requests with a concurrency factor greater than one will not be processed.
Please read through the warnings that are associated with the given resize and acknowledge the risks.
Once you have selected a new size, you will be shown a summary of the resize, which will include the new price for managing your cluster.
You can also select to notify your accounts’ designated support contacts via email once the resize is complete. You may opt-out of this notification by deselecting the Notify this account’s designated support contacts on resize completion checkbox.
Click on Resize Data Centre to begin the resize process.
While a resize is in progress, the Cluster Details page will display the progress of the resize. You will see individual nodes switch from Running to Pending → Provisioning/Provisioned and then back to Running once their size has been changed.
In some rare cases, it may be desirable to cancel a resize operation while it is in progress. This can be achieved via the API. This may leave the cluster in a non-uniform state with some nodes already resized. Please contact our support team to assist in this case, to ensure your cluster is correctly sized.
Resizing via Terraform
To resize via terraform all that is required is to change the node size of your data centre to the target size. After that applying those changes should show you an update as below which would generate the resize when accepted.