Each database proxy endpoint has independent connection settings that control routing behavior, connection pooling, and read traffic distribution. After enabling the database proxy feature for an ApsaraDB RDS for MySQL instance, you can modify these settings on any proxy endpoint to match your workload requirements.
Prerequisites
Before you begin, ensure that you have:
-
The database proxy feature enabled on your ApsaraDB RDS for MySQL instance. For more information, see Enable the database proxy feature
Modify connection settings for a database proxy endpoint
Connect to an ApsaraDB RDS instance using the internal or public endpoint of any proxy endpoint.
-
Go to the Instances page. In the top navigation bar, select the region where your ApsaraDB RDS instance resides. Find the instance and click its ID.
-
In the left-side navigation pane, click Database Proxy.
-
In the Connection Information section, find the proxy endpoint in the Proxy Endpoint (Terminal) ID column and click Modify Configuration in the Actions column.
-
In the dialog box, configure the following settings.
Connection description A custom description for the database proxy endpoint. Maximum length: 30 characters.
Network and zone The zone and vSwitch for the database proxy.
Read/Write attribute Controls which ApsaraDB RDS instances the proxy endpoint connects to and whether it accepts write requests.
Option Description Read/Write (Read/Write Splitting) Connects to the primary instance and its read-only instances. Accepts both read and write requests. This is the default. Read-only (Primary Instance Not Connected to Receive Write Requests) Connects only to read-only instances. Does not accept write requests. NoteChanges to Read/Write attribute take effect only for new connections. Existing connections remain on their current configuration. If you use RDS Cluster Edition, the primary and secondary nodes in your cluster can handle read/write splitting. For details, see Configure the read and write attributes and the read weight of the database proxy and What is read/write splitting?.
Nearest access Enables nearest access to reduce access latency and improve performance. For more information, see Configure the nearest access feature.
Connection pooling Every database connection carries overhead: memory allocation, TLS handshaking, and authentication negotiation. Connection pooling reduces this overhead by reusing existing connections across requests instead of opening and closing connections for each one. Choose the type based on your connection pattern.
Option When to use Transaction-level Connection Pooling Short-lived connections, frequent connection establishment, or connection counts that exceed the maximum supported by your ApsaraDB RDS instance. Use this option unless its limits affect your workload. For details, see Limits of transaction connection pools. Session-level Connection Pooling Short-lived connections and frequent connection establishment, when transaction-level connection pooling limits affect your workload. For details, see Limits of transaction connection pools. Disable Connection Pooling Persistent connections, small connection counts, or when your application already manages a connection pool (for example, Druid, DBCP, c3p0, or HikariCP). This is the default. NoteIf the database proxy version is earlier than 2.9.1, this parameter is available only when Read/Write attribute is set to Read/Write (Read/Write Splitting). Version 2.9.1 and later have no restrictions. For more information, see Configure the connection pooling feature.
Latency threshold The maximum replication lag allowed before the proxy stops routing read requests to a read-only instance. Valid values: 0–3600 seconds. Set this value to 30 seconds or higher to avoid routing reads to instances with stale data.
-
When the replication lag on a read-only instance is below this threshold and its read weight is not 0, the proxy forwards read requests to that instance.
-
Set this parameter to Disable to route read requests to read-only instances regardless of replication lag.
-
Default: 30 seconds when Read/Write attribute is Read/Write (Read/Write Splitting); disabled when Read/Write attribute is Read-only (Primary Instance Not Connected to Receive Write Requests).
NoteIf the database proxy version is earlier than 2.9.1, this parameter is configurable only for endpoints set to Read/Write (Read/Write Splitting). Version 2.9.1 and later have no restrictions.
Transaction splitting Fixed as Enabled. Read requests that occur before a write operation within a transaction are forwarded to read-only instances, reducing the load on the primary instance. This parameter appears only when Read/Write attribute is set to Read/Write (Read/Write Splitting). For more information, see Use the transaction splitting feature.
Read weight allocation Determines how read traffic is distributed across read-only instances. Weight changes take effect immediately without causing service interruptions. Existing connections remain valid; only new connections use the updated weights.
Option Description Automatic Distribution The proxy assigns read weights based on each instance's specifications. New read-only instances receive weights automatically. 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. Note-
Nearest access controls routing from your application to the proxy. Read weight allocation controls routing from the proxy to backend instances. Configure both features together to minimize end-to-end latency.
-
A higher weight means more read requests are routed to that instance. For example, if three read-only instances have weights of 100, 200, and 200 and the primary instance has a weight of 0, read requests are distributed at a 1:2:2 ratio across the read-only instances.
-
Read weights cannot be set for read-only instances that have a configured data replication latency. For details, see Configure a data replication latency for a read-only ApsaraDB RDS for MySQL instance.
-
If you use RDS Cluster Edition, weights apply to the primary and secondary nodes in the cluster.
-
If you use RDS High-availability Edition, create at least one read-only instance before specifying custom weights.
-
For details on configuring read and write attributes, see Configure the read and write attributes and the read weight of the database proxy.
-
-
Click OK.
Persistent connection settings apply to all proxy endpoints of an ApsaraDB RDS instance. When enabled, the proxy retains connections during an instance switchover or failure, so applications connected through a proxy endpoint do not experience disconnection errors. For more information, see Configure persistent connection settings.
API reference
| Operation | Description |
|---|---|
| DescribeDBProxy | Queries the details about the database proxy of an instance. |
| DescribeDBProxyEndpoint | Queries the connection settings for a database proxy endpoint that is connected to an instance. |
| ModifyDBProxyEndpoint | Modifies the settings of a database proxy endpoint that is connected to an instance. |