All Products
Search
Document Center

ApsaraDB RDS:How do I reduce the network latency between an ECS instance and an ApsaraDB RDS for PostgreSQL instance?

Last Updated:Dec 20, 2023

If your application runs on an Elastic Compute Service (ECS) instance and the network latency between the ECS instance and the connected ApsaraDB RDS for PostgreSQL instance over an internal network is abnormally high, you can reduce the network latency by following the operations provided in this topic.

Check network latency

  1. Log on to the ECS console and access the Instances page. In the top navigation bar, select the region in which the ECS instance resides. Then, find the ECS instance and click the instance ID.

  2. In the Network Information section on the Instance Details page, check the Primary Private IP Address parameter of the ECS instance.

  3. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  4. In the left-side navigation pane, click Whitelist and SecGroup. On the Whitelist Settings tab of the page that appears, add the value of the Primary Private IP Address parameter of the ECS instance to an IP address whitelist of the RDS instance. For more information, see Configure an IP address whitelist.

  5. In the left-side navigation pane, click Database Connection. On the page that appears, check the Internal Endpoint parameter of the RDS instance.

  6. Connect to the ECS instance. Then, run the following command on the ECS instance to ping the RDS instance. For more information, see Connection methods.

    ping pgm-***.pg.rds.aliyuncs.com
    Note

    In the preceding command, pgm-***.pg.rds.aliyuncs.com is an example value. Replace the value with the value of the Internal Endpoint parameter that you obtained in Step 5.

  7. Check the response time of the RDS instance. If the response time is longer than 0.2 milliseconds, a network latency occurs between the ECS instance and the RDS instance.

Troubleshoot network latency

Check the configurations of the ECS instance and RDS instance. Then, modify the configuration of the ECS instance or RDS instance based on the check results. For more information, see the following table.

Check item

ECS instance

RDS instance

Troubleshooting

VPC

On the Instance Details page of the ECS instance, check the VPC parameter in the Network Information section.

On the Database Connection page of the RDS instance, check the Network Type parameter.

If the RDS instance resides in the classic network or resides in a different VPC than the ECS instance, change the network type or vSwitch of the ECS or RDS instance. Make sure that these instances reside in the same VPC and are connected by the same vSwitch. For more information, see the following topics:

vSwitch

On the Instance Details page of the ECS instance, check the VSwitch parameter in the Network Information section.

On the Database Connection page of the RDS instance, check the Network Type parameter.

Zone

On the Instance Details page, check the Zone parameter in the Basic Information section.

On the Basic Information page of the RDS instance, check the Zone parameter.

If the zone of the ECS instance is different from that of the RDS instance, migrate the RDS instance to the zone of the ECS instance. For more information, see Migrate an ApsaraDB RDS for PostgreSQL instance across zones in the same region.