Review these usage notes before enabling the database proxy feature for ApsaraDB RDS for PostgreSQL.
Billing
General-purpose database proxies are free. Dedicated database proxies, read-only instances, and primary RDS instances are billed separately.
If the primary RDS instance is released, all associated database proxies are automatically released, and you are no longer charged for dedicated database proxies.
Connection model
The database proxy uses a 1:N connection model. When your application opens a connection, the proxy replicates it to the primary RDS instance and all read-only RDS instances.
Connection limits
The proxy itself has no maximum connection limit. The effective limit is determined by the specifications of the primary RDS instance and its read-only RDS instances.
To avoid unexpected connection rejections, configure the same maximum number of connections for the primary RDS instance and all read-only RDS instances. If the limits differ, the lowest limit among all instances applies to the proxy.
Without transaction-level connection pooling enabled, the proxy establishes a separate connection from each client to the primary RDS instance and each read-only RDS instance.
New and restarted read-only instances
If you create or restart a read-only RDS instance after enabling the proxy, only requests sent over new connections are routed to that instance. Requests over existing connections continue to go to their original instances.
Routing behavior
Read/write splitting
When read/write splitting is configured through a database proxy endpoint, read consistency across requests in the same session cannot be guaranteed.
Session variables
To view session variables on the primary RDS instance or read-only RDS instances through a database proxy endpoint, add both /*force_master*/ and /*force_slave*/ to your query.
Connection pinning: multi-statements and stored procedures
Executing multi-statements or calling stored procedures causes all subsequent requests on that connection to be routed to the primary RDS instance. This is because the proxy pins the connection to a single backend instance to preserve execution state.
To resume read/write splitting, close the current connection and open a new one.
Operational notes
Instance specification changes
Changing the specifications of the primary RDS instance or a read-only RDS instance may cause a transient connection interruption.
Primary instance locked
If the primary RDS instance is locked, its database proxies remain active but can process read requests only.
CIDR block configuration
When configuring a CIDR block for the host using the privileged account, use the 10.1.2.% format. The 10.1.2.0/24 format is not supported for this purpose.
IP address whitelist
The database proxy inherits the IP address whitelist of the primary RDS instance. Any update to the primary RDS instance's whitelist is automatically applied to the proxy.