All Products
Search
Document Center

AnalyticDB:Change compute node configurations

Last Updated:Sep 02, 2024

As the data size and computing workload of AnalyticDB for PostgreSQL increase, the data processing speed may hit a bottleneck due to insufficient computing resources such as CPU, memory, disk storage, and compute nodes. In this case, you can change the compute node specifications and the number of compute nodes based on your business requirements.

The following table describes how configuration changes are supported for different resource types of AnalyticDB for PostgreSQL.

Operation

Serverless mode

Elastic storage mode

Upgrade node specifications

Unsupported

Supported

Downgrade node specifications

Unsupported

Supported

Add compute nodes

Supported

Supported

Remove compute nodes

Supported

Supported

Usage notes

  • To remove compute nodes from an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode, the minor version of the instance must be 6.3.10.5 or later. To remove compute nodes from an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode, the minor version of the instance must be V7.0.1.2 or later. For information about how to view the minor version of an instance, see View the minor version of an instance.

  • When you remove compute nodes from an AnalyticDB for PostgreSQL instance in elastic storage mode, data writes may be affected. When you add compute nodes to an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is 6.6.2.0 or later or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is 7.0.5.0 or later, data reads and writes are allowed. When you add compute nodes to instances of earlier versions, only data reads are allowed.

  • When you remove compute nodes from an instance in elastic storage mode, make sure that the instance capacity after scaling is sufficient to store the original instance data.

  • For instances in Serverless mode, the change to the number of compute nodes may cause the current SQL statements to be interrupted. These SQL statements cannot be resumed even after the change.

Configuration change methods

  • Upgrade or downgrade node specifications: Change the specifications of resources, such as CPU, memory, and disks, of existing nodes without changing the number of nodes. This method does not involve data migration and can quickly complete the configuration change.

  • Add or remove compute nodes: Add or remove compute nodes of the same specifications on top of the original instance. After you add or remove compute nodes, the total resources change accordingly and the data load is rebalanced. The required amount of time is proportional to the data volume because the process is complex. For information about the amount of time required to complete the configuration change by using the preceding methods, see Amount of time required to change configurations.

You can follow the following rules to select appropriate configuration change methods:

  • View node monitoring information. If the CPU utilization and I/O usage of compute nodes remain high for an extended period of time during business operation, we recommend that you add compute nodes. If CPU and memory resources are insufficient but the I/O usage is low, we recommend that you upgrade node specifications to quickly address the performance bottleneck.

  • If the disk usage is high and compute resources are sufficient, only increase the storage capacity of compute nodes when you upgrade node specifications. This eliminates the need to add compute nodes and saves costs.

  • To change the configurations of resources from high to low, we recommend that you downgrade node specifications. If the node specifications cannot be further lowered, remove compute nodes.

Amount of time required to change configurations

It takes about 10 minutes to upgrade or downgrade node specifications. The amount of time that is required to add or remove compute nodes varies based on the instance resource type.

  • Elastic storage mode

    The amount of time required to change the number of compute nodes is approximately 30 minutes to dozens of hours. The exact amount of time depends on a variety of factors such as the number of tables, the number of partitions, the number of indexes, compression status, total data size, and instance specifications. The estimated time required to change the number of compute nodes can be calculated by using the following formula:

    Estimated required time (min) = Total data size (GB)/1.25/Number of nodes after change + Reserved time.

    The reserved time includes the execution duration of steps such as resource application. The reserved time is fixed to 30 minutes. For example, the estimated time required to increase the number of compute nodes of an AnalyticDB for PostgreSQL instance whose data size is 1 TB to 16 can be calculated by using the following formula: 1024/1.25/16 + 30 = 81 minutes.

    Note

    When you add compute nodes to an instance in elastic storage mode, take note of the following items:

    • For an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is earlier than 6.6.2.0 or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is earlier than 7.0.5.0, tables that are in the redistributing state may fail to be written or temporarily fail to be read. You can try again later.

    • For an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is 6.6.2.0 or later or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is 7.0.5.0 or later, data reads and writes are uninterrupted.

  • Serverless mode

    You can scale AnalyticDB for PostgreSQL instances in Serverless mode by changing the number of compute nodes within minutes without the need to migrate data. The scaling speed varies based on the amount of time that is required to apply for resources and is not affected by the data size. The following scaling performance is provided for reference:

    • An instance that has 16 or fewer compute nodes can be scaled within 60 seconds.

    • An instance that has more than 16 compute nodes can be scaled within 5 minutes.

Change compute node configurations

Add compute nodes

The elastic scaling feature ensures that your business runs normally and data reads and writes are uninterrupted on all tables in the database when you change compute node configurations. When you add compute nodes to an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is 6.6.2.0 or later or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is 7.0.5.0 or later, the elastic scaling feature is supported. Take note of the following items:

  • When you change compute node configurations, data redistribution is performed on all tables in sequence. Tables not in the redistributing state are not affected. Tables in the redistributing state support all query operations and the INSERT, COPY, DELETE, and UPDATE statements, but do not support DDL statements and VACUUM statements. When you execute a DDL statement such as TRUNCATE TABLE, an error is returned, as shown in the following code:

  • TRUNCATE t1;
    ERROR:  Unsupport 'TRUNCATE TABLE' command during online expansion on 't1'
  • If a large amount of data is written or updated, an extended period of time is required to change compute node configurations. If data is frequently written to specific tables, a write lock is added to the tables to speed up the change of compute node configurations. When you add compute nodes to an AnalyticDB for PostgreSQL instance in elastic storage mode that supports the elastic scaling feature, you can view the scaling progress in the AnalyticDB for PostgreSQL console.

Note

When you add compute nodes to instances of earlier versions, the elastic scaling feature is not supported. This may interrupt the reads and writes of tables. We recommend that you perform this operation during off-peak hours.

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and choose Change Compute Node Configurations > Add Compute Node in the Actions column.

  4. In the Info dialog box, select I am aware of the impact of this operation and agree to continue it. and click OK.

    Note

    This step is available only for instances in Serverless mode.

  5. On the Upgrade/Downgrade page, select a value for the Compute Nodes parameter based on your business requirements, read and select the Terms of Service, and then click Buy Now.

    Warning
    • For an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is earlier than 6.6.2.0 or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is earlier than 7.0.5.0, tables that are in the redistributing state can only be read when you change the number of compute nodes. For an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is 6.6.2.0 or later or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is 7.0.5.0 or later, tables that are in the redistributing state can be both read and written when you change the number of compute nodes. The amount of time that is required to redistribute data varies based on the table size. Perform this operation during an appropriate period of time.

    • For instances in Serverless mode, after you submit a request to change the number of compute nodes, the current SQL statements are interrupted. These SQL statements cannot be resumed even after the change.

  6. Return to the Instances page and wait for the instance to enter the Running state.

  7. You can execute the following SQL statement to prefetch data from tables that have high performance requirements to accelerate data access.

    SELECT count(*) FROM <hot_table>;
    Note
    • Data prefetching is required only for instances in Serverless mode.

    • When you change the number of compute nodes, the following steps are performed: The resources are initialized, the metadata about system tables is synchronized, the resources are locked to modify the data distribution information, the resources are unlocked and cleared, and the local cache is asynchronously restored. The hit ratio of the local cache remains low for a short period of time because the local cache is asynchronously restored. You can prefetch data to accelerate data access.

Remove compute nodes

Warning

When you remove compute nodes from an instance in elastic storage mode, make sure that the instance capacity after scaling is sufficient to store the original instance data. During the scaling period, we recommend that you do not perform update or write operations on the instance.

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and choose Change Compute Node Configurations > Remove Compute Node in the Actions column.

  4. In the Info dialog box, select I am aware of the impact of this operation and agree to continue it. and click OK.

  5. On the Upgrade/Downgrade page, select a value for the Compute Nodes parameter based on your business requirements, read and select the Terms of Service, and then click Buy Now.

    Warning
    • For instances in elastic storage mode, tables that are in the redistributing state can only be read when you change the number of compute nodes. The amount of time that is required to redistribute data varies based on the table size. Perform this operation during an appropriate period of time.

    • For instances in Serverless mode, after you submit a request to change the number of compute nodes, the current SQL statements are interrupted. These SQL statements cannot be resumed even after the change.

  6. Return to the Instances page and wait for the instance to enter the Running state.

  7. You can execute the following SQL statement to prefetch data from tables that have high performance requirements to accelerate data access.

Upgrade node specifications

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and choose Change Compute Node Configurations > Upgrade Node Specifications in the Actions column.

  4. On the Upgrade/Downgrade page, configure the parameters that are described in the following table.

    Parameter

    Description

    Instance Resource Type

    The resource type of the current instance, which cannot be changed.

    Compute Node Specifications

    Select node specifications based on your business requirements.

    Single-node Storage Capacity

    Select a storage capacity per node based on your business requirements.

    Warning
    • Data can only be read when you change the node specifications. Perform this operation during an appropriate period of time.

    • Data reads and writes are not affected when you change the storage capacity.

  5. Read and select the Terms of Service, and then click Buy Now.

  6. Return to the Instances page and wait for the instance to enter the Running state.

Downgrade node specifications

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and choose Change Compute Node Configurations > Downgrade Node Specifications in the Actions column.

  4. On the Downgrade page, configure the parameters that are described in the following table.

    Parameter

    Description

    Instance Resource Type

    The resource type of the current instance, which cannot be changed.

    Compute Node Specifications

    Select node specifications based on your business requirements.

    Single-node Storage Capacity

    The storage capacity per node cannot be downgraded.

    Note

    This parameter is unavailable for Basic Edition instances in elastic storage mode.

    Warning
    • Data can only be read when you change the node specifications. Perform this operation during an appropriate period of time.

    • Data reads and writes are not affected when you change the storage capacity.

  5. Read and select the Terms of Service, and then click Buy Now.

  6. Return to the Instances page and wait for the instance to enter the Running state.

References

Instance specifications