All Products
Search
Document Center

ApsaraDB RDS:Configure database proxy endpoint settings

Last Updated:Oct 09, 2026

You can configure different connection settings for each database proxy endpoint to support use cases such as read/write splitting or handling high-concurrency read requests. This allows your applications to connect to an ApsaraDB RDS for PostgreSQL instance with settings tailored to your specific business needs.

Prerequisites

The database proxy feature is enabled. For more information, see Enable the database proxy.

Usage notes

Ensure that you have created a read-only instance. Without any read-only instances, you can still enable the database proxy but cannot configure connection settings for its endpoints. To create one, see Create a read-only ApsaraDB RDS for PostgreSQL instance.

Procedure

  1. 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.

  2. In the left-side navigation pane, click Database Proxy.

  3. In the Connection Information section, find the target Proxy Endpoint (Terminal) ID and click Modify Configuration in the Actions column.

  4. In the dialog box that appears, modify the connection settings for the database proxy endpoint based on your business requirements.

    Parameter

    Description

    Connection Description

    A custom description for the database proxy endpoint. The description can be up to 30 characters long.

    Read/Write Attributes

    Defines how read and write requests are routed.

    • Read/Write (Read/Write Splitting) (Default): Connects to both the primary instance and its read-only instances. This endpoint can receive write requests.

    • Read-only (Primary Instance Not Connected to Receive Write Requests): Connects only to read-only instances and does not receive write requests.

    Note

    Latency Threshold

    The maximum allowed replication latency when a read-only instance synchronizes data from the primary instance. Valid values: 0 to 3,600 seconds.

    Replication delay can occur on read-only instances depending on SQL execution performance. We recommend that you set this value to at least 30 seconds.

    Note
    • This parameter is available only when Read/Write Attributes is set to Read/Write (Read/Write Splitting).

    • If the replication delay of a read-only instance exceeds this threshold, the database proxy stops forwarding read requests to that instance, regardless of its assigned read weight.

    Transaction Splitting

    This feature is always Enabled. Transaction splitting forwards read requests within a transaction that occur before any write operations to read-only instances. This helps reduce the load on the primary instance.

    Note

    For a detailed explanation of this feature, see Transaction splitting.

    Read Weight Allocation

    Specifies how read weights are allocated to instances:

    • Automatic: The system automatically assigns a read weight to each instance based on its specifications. When you add a new read-only instance, it is automatically added to the read/write splitting pool with a system-assigned weight. No manual configuration is required. For more information, see Default read weight allocation rules.

    • Custom: Manually set the read weight for each instance. The value can range from 0 to 10,000. When you add a new read-only instance, its default read weight is 0. You must then change this weight manually.

    Note
    • The higher the read weight of an instance, the more read requests it handles. For example, assume a primary instance has three read-only instances. If the primary instance has a read weight of 0 and the read-only instances have weights of 100, 200, and 200, the primary instance processes no read requests. Write requests are still routed to it automatically. The three read-only instances handle read requests at a ratio of 1:2:2.

    • Changes to this parameter take effect immediately without causing any transient connections. Existing connections are unaffected and continue using the previous weight distribution.

    • When a read-only instance is released, its weight is automatically removed.

    • If an instance fails or its replication delay exceeds the threshold, its weight is automatically removed. The weight is automatically restored after the instance recovers.

    • Add the /*FORCE_MASTER*/ hint to your SQL statement:

      /*FORCE_MASTER*/ SELECT * FROM table_name;

      To explicitly route a read request to a read-only instance instead, use /*FORCE_SLAVE*/.

  5. Click OK.

Related topics

Related APIs

API

Description

DescribeDBProxy

Queries the details of a database proxy.

DescribeDBProxyEndpoint

Queries the details of a database proxy endpoint.

ModifyDBProxyEndpoint

Modifies the connection settings of a database proxy endpoint.