Configure connection settings for a database proxy endpoint to control how read and write traffic is routed across your primary and read-only instances. Each endpoint can be tuned independently for scenarios such as read/write splitting and high-concurrency read workloads.
Prerequisites
Before you begin, ensure that you have:
Enabled the database proxy feature. For more information, see Enable the database proxy feature.
At least one read-only instance attached to your RDS instance. You can enable the database proxy without a read-only instance, but you cannot configure connection settings for an endpoint until one exists. For more information, see Create a read-only ApsaraDB RDS for PostgreSQL instance.
Configure connection settings
Go to the Instances page. In the top navigation bar, select the region where your RDS instance resides, then click the instance ID.
In the left-side navigation pane, click Database Proxy.
In the Connection Information section, find the endpoint you want to modify in the Proxy Endpoint (Terminal) ID column, then click Modify Configuration in the Actions column.
In the dialog box that appears, update the connection settings as needed.
Parameter Description Connection Description A custom description for the endpoint. Maximum 30 characters. Read/Write Attributes Controls which instance types this endpoint can reach. See Choose read/write attributes for guidance. Latency Threshold The maximum latency (in seconds) allowed for data replication from the primary RDS instance to its read-only RDS instances before the proxy stops forwarding reads to a read-only instance. Valid values: 0–3600. Set to 30 or higher. Only available when Read/Write Attributes is set to Read/Write (Read/Write Splitting). Transaction Splitting Fixed as Enabled. Forwards read requests that occur before write operations in a transaction to read-only instances, reducing load on the primary instance. Cannot be disabled. Read Weight Allocation Determines how read traffic is distributed. See Configure read weight allocation for details. Click OK.
Choose read/write attributes
Use this table to select the right mode for your workload:
| Scenario | Recommended option | Reason |
|---|---|---|
| General application traffic, OLTP, ETL jobs | Read/Write (Read/Write Splitting) | The endpoint connects to the primary instance and all read-only instances, and accepts both read and write requests. This is the default value. |
| Reporting queries, analytics, read-intensive workloads | Read-only (Primary Instance Not Connected to Receive Write Requests) | The endpoint connects only to read-only instances and rejects write requests, isolating analytics load from your primary instance. |
Changes to Read/Write Attributes apply only to new connections. Existing connections are not affected.
Configure read weight allocation
Automatic — The proxy assigns read weights based on instance specifications. New read-only instances are added to the read/write splitting link automatically with no manual configuration required. For default weight values, see Default read weights.
Custom — Specify a read weight for each read-only instance. Valid values: 0–10000. New read-only instances default to a weight of 0 and must be updated manually.
A higher weight means more read requests are sent to that instance. For example, if the primary instance has a read weight of 0 and three read-only instances have weights of 100, 200, and 200, the primary instance handles only write requests and read requests are distributed at a ratio of 1:2:2.
To force a specific request to a particular instance type regardless of the configured weights, add a SQL hint:
Route to the primary instance:
/*FORCE_MASTER*/ SELECT * FROM table_name;Route to a read-only instance:
/*FORCE_SLAVE*/ SELECT * FROM table_name;
When changes take effect
| Parameter | New connections | Existing connections |
|---|---|---|
| Read/Write Attributes | Takes effect immediately | Not affected; existing connections retain the previous setting |
| Read Weight Allocation | Takes effect immediately; no transient connection drops | Continue using previous weights until reconnected |
After read-only RDS instances are released, the read weights automatically become invalid.
If your RDS instance fails or the data replication latency exceeds the specified threshold, the read weights automatically become invalid. After your RDS instance runs as expected, the read weights become valid again.
What's next
API reference
| Operation | Description |
|---|---|
| DescribeDBProxy | Queries the details of a database proxy. |
| DescribeDBProxyEndpoint | Queries the endpoint of a database proxy. |
| ModifyDBProxyEndpoint | Modifies the connection settings for a database proxy endpoint. |