Scale compute nodes
Scale your AnalyticDB for PostgreSQL instance by upgrading or downgrading node specifications, or by adding or removing compute nodes.
Scaling support varies by Instance resource type for AnalyticDB for PostgreSQL.
|
Operation |
Serverless mode |
Elastic storage mode |
|
Upgrade node specifications |
Not supported |
Supported |
|
Downgrade node specifications |
Not supported |
Supported |
|
Add compute nodes |
Supported |
Supported |
|
Remove compute nodes |
Supported |
Supported |
Usage notes
-
For elastic storage mode instances, removing compute nodes requires minor engine version V6.3.10.5 or later (V6.0) or V7.0.1.2 or later (V7.0). View the minor engine version of an instance.
-
Elastic storage mode instances with minor engine version V6.6.2.0 or later (V6.0) or V7.0.5.0 or later (V7.0) support read and write operations when adding compute nodes. Earlier versions support only reads. Removing compute nodes may affect write operations.
-
When removing compute nodes from an elastic storage mode instance, ensure the remaining capacity is sufficient for your data.
-
Scaling compute nodes on a serverless mode instance interrupts running SQL queries. Interrupted queries cannot be resumed.
Choose a scaling method
-
Scaling node specifications up or down changes the CPU, memory, and disk resources of existing nodes without changing the node count. No data migration is required.
-
Adding or removing compute nodes adjusts total resources by changing the node count. This requires data redistribution, which scales with data volume. Scaling time.
Use the following principles to choose a scaling method:
-
Check node monitoring data. If CPU and I/O utilization stays high during business hours, add compute nodes. If CPU or memory is insufficient but I/O is low, upgrade node specifications instead.
-
If disk usage is high but compute resources are sufficient, increase only node storage capacity when upgrading specifications. This avoids the cost of adding nodes.
-
If the specifications cannot be downgraded further, remove compute nodes.
Scaling time
Upgrading or downgrading node specifications takes about 10 minutes. Adding or removing compute nodes depends on the instance mode:
-
elastic storage mode
Scaling can take from 30 minutes to dozens of hours, depending on the number of tables, partitioned tables, indexes, compression settings, data volume, and node specifications. Estimation formula:
Scaling time (min) = Total data volume (GB) / 1.25 / Number of nodes after scaling + Reserved time.
The reserved time is a fixed 30 minutes for resource provisioning. Example: scaling an instance with 1 TB of data to 16 nodes takes approximately 1024 / 1.25 / 16 + 30 = 81 minutes.
NoteWhen you add compute nodes:
-
For instances with minor engine version earlier than V6.6.2.0 or V7.0.5.0, tables being redistributed may become temporarily unavailable. Retry later.
-
For instances with minor engine version V6.6.2.0 or later, or V7.0.5.0 or later, read and write operations are not interrupted when adding compute nodes.
-
-
serverless mode
Serverless mode supports online elastic scaling within minutes. No data migration is required, so speed depends on resource provisioning, not data size. Lab tests show:
-
Scaling for instances with up to 16 nodes takes no more than 60 seconds.
-
Scaling for instances with more than 16 nodes takes no more than 5 minutes.
-
Procedure
Add compute nodes
Online scaling keeps all tables available for read and write operations. Elastic storage mode instances with minor engine version V6.6.2.0 or later (V6.0) and V7.0.5.0 or later (V7.0) support online scaling when adding compute nodes. Key points:
-
Tables are redistributed one by one during scaling. Non-redistributing tables are unaffected. For tables being redistributed, queries and INSERT, COPY, DELETE, and UPDATE are supported. DDL and VACUUM are not supported. Running DDL on a redistributing table returns an error:
TRUNCATE t1;
ERROR: Unsupport 'TRUNCATE TABLE' command during online expansion on 't1'
Heavy writes and updates can prolong scaling. A write lock may be placed on frequently written tables, briefly affecting their operations. Monitor scaling progress in the console.
For earlier versions, online scaling is not supported when adding compute nodes. Read and write operations may be interrupted. Perform this operation during off-peak hours.
- Log on to the AnalyticDB for PostgreSQL console.
- In the upper-left corner of the console, select a region.
-
Find the target instance. In the Actions column, choose .
-
In the Info dialog box, select I am aware of the impact of this operation and agree to continue it. and click OK.
NoteThis step is required only for serverless mode instances.
-
On the Change Configurations page, select an appropriate value for Number of nodes (segment), select the terms of service, and click Buy Now.
Warning-
Elastic storage mode instances: Tables that are being redistributed become read-only. For newer versions, both read and write operations are supported. Redistribution time depends on table size. Plan accordingly.
-
Serverless mode instances: Running SQL queries are interrupted after the scaling task is submitted and cannot be resumed.
-
-
Return to the Instances page. Wait for the status of the target instance to change to Running.
-
Run the following SQL statement to pre-warm data for high-performance tables, which accelerates data access.
SELECT count(*) FROM <hot_table>;Note-
Data pre-warming is required only for serverless mode instances.
-
Scaling involves five steps: initializing resources, synchronizing metadata, acquiring locks to modify data distribution, releasing locks, and asynchronously recovering the local cache. The cache hit rate may be temporarily low after scaling. Pre-warming accelerates subsequent access.
-
Remove compute nodes
When removing compute nodes from an elastic storage mode instance, ensure the remaining capacity is sufficient for your data. Reduce write operations during the scale-in period.
- Log on to the AnalyticDB for PostgreSQL console.
- In the upper-left corner of the console, select a region.
-
Find the target instance. In the Actions column, choose .
-
In the Info dialog box, select I am aware of the impact of this operation and agree to continue it. and click OK.
-
On the Change Configurations page, select an appropriate value for Number of nodes (segment), select the terms of service, and click Buy Now.
Warning-
Elastic storage mode instances: Redistributing tables become read-only. Redistribution time depends on table size. Plan accordingly.
-
Serverless mode instances: Running SQL queries are interrupted after the scaling task is submitted and cannot be resumed.
-
-
Return to the Instances page. Wait for the status of the target instance to change to Running.
-
Run the following SQL statement to pre-warm data for high-performance tables, which accelerates data access.
SELECT count(*) FROM <hot_table>;Note-
Data pre-warming is required only for serverless mode instances.
-
Scaling involves five steps: initializing resources, synchronizing metadata, acquiring locks to modify data distribution, releasing locks, and asynchronously recovering the local cache. The cache hit rate may be temporarily low after scaling. Pre-warming accelerates subsequent access.
-
Upgrade node specifications
- Log on to the AnalyticDB for PostgreSQL console.
- In the upper-left corner of the console, select a region.
-
Find the target instance. In the Actions column, choose .
-
On the Change Configurations page, modify the following configurations.
Parameter
Description
Instance resource type
The current instance resource type. Cannot be changed.
Node specifications (segment)
Select the target node specifications.
Node storage capacity (segment)
Select the target storage capacity per compute node.
Warning-
The database is read-only during node specification scaling. Plan accordingly.
-
If you only change node storage capacity, read and write operations continue.
-
-
Select the terms of service, and click Buy Now.
-
Return to the Instances page. Wait for the status of the target instance to change to Running.
Downgrade node specifications
- Log on to the AnalyticDB for PostgreSQL console.
- In the upper-left corner of the console, select a region.
-
Find the target instance. In the Actions column, choose .
-
On the Change Configurations page, modify the following configurations.
Parameter
Description
Instance resource type
The current instance resource type. Cannot be changed.
Node specifications (segment)
Select the target node specifications.
Node storage capacity (segment)
Reducing the node storage capacity is not supported.
NoteNot available for Basic Edition instances in elastic storage mode.
Warning-
The database is read-only during node specification scaling. Plan accordingly.
-
If you only change node storage capacity, read and write operations continue.
-
-
Select the terms of service, and click Buy Now.
-
Return to the Instances page. Wait for the status of the target instance to change to Running.