This topic describes how to set the protection level of an ApsaraDB RDS for PostgreSQL instance based on your business requirements. A proper protection level increases the availability or performance of your RDS instance.

Prerequisites

Your RDS instance runs RDS High-availability Edition with standard SSDs or enhanced SSDs (ESSDs).

Background information

You can configure the following parameters to set the protection level of your RDS instance: synchronous_commit, rds_sync_replication_timeout, and synchronous_standby_names.

The following table describes the protection levels that are provided for ApsaraDB RDS for PostgreSQL instances:
Protection level Data replication mode Description Parameter configuration
Optimum performance Asynchronous mode This is the default protection level. This protection level delivers the highest response speed but medium data persistence. Set the synchronous_commit parameter to off.
Note If you set the synchronous_commit parameter to off, the rds_sync_replication_timeout parameter is invalid.
Optimum protection Synchronous mode This protection level delivers high data persistence but medium response speed.
  • Set the synchronous_commit parameter to remote_write.
  • Set the rds_sync_replication_timeout parameter to 0.
  • Set the synchronous_standby_names parameter to 'standby1'.
    Warning The default value of the synchronous_standby_names parameter is standby1. If you have a self-managed secondary RDS instance, we recommend that you do not name the self-managed secondary RDS instance as standby1. If you name the self-managed secondary RDS instance as standby1, your RDS instance may replicate data to the self-managed secondary RDS instance in synchronous or semi-synchronous mode. As a result, data loss may occur in the event of a primary/secondary switchover.
High availability Semi-synchronous mode This protection level balances data persistence and response speed.
  • Set the synchronous_commit parameter to remote_write.
  • Set the rds_sync_replication_timeout parameter to a value that is greater than 0.
    Note The rds_sync_replication_timeout parameter specifies the data synchronization timeout period in milliseconds. The value of this parameter ranges from 0 to 300000. We recommended that you set this parameter to 1000. If a synchronization times out, the high availability protection level is decreased to the optimum performance protection level, which makes your RDS instance run in asynchronous mode. After data is synchronized, the optimum performance protection level is increased to the high availability protection level, which makes your RDS instance run in semi-synchronous mode.
  • Set the synchronous_standby_names parameter to 'standby1'.
    Warning The default value of the synchronous_standby_names parameter is standby1. If you have a self-managed secondary RDS instance, we recommend that you do not name the self-managed secondary RDS instance as standby1. If you name the self-managed secondary RDS instance as standby1, your RDS instance may replicate data to the self-managed secondary RDS instance in synchronous or semi-synchronous mode. As a result, data loss may occur in the event of a primary/secondary switchover.

Procedure

  1. Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
  2. In the left-side navigation pane, click Parameters.
  3. On the Editable Parameters tab, find the synchronous_commit, rds_sync_replication_timeout, and synchronous_standby_names parameters.
  4. In the Running Parameter Value column for each parameter, click the icon next to the original value. In the dialog box that appears, enter the new value and click OK.
    Note For more information about how to configure the parameters, see the "Background information" section of this topic.
  5. In the upper-left corner of the page, click Apply Changes.
    Warning After you submit the change to the value of the rds_sync_replication_timeout parameter, the RDS instance restarts. The restarts causes your application to disconnect from the RDS instance. We recommend that you reconfigure this parameter during off-peak hours.
    Apply changes to the parameter values