This topic describes the dedicated database proxy service of ApsaraDB for RDS. This service provides functions including read/write splitting and shot-lived connection optimization.

Prerequisites

  • The DB engine version and edition are MySQL 8.0 High-availability Edition (with local SSDs).
  • The kernel minor version is 20190915 or later.
    Note You can navigate to the Basic Information page on the RDS console and then in the Configuration Information section check for the Upgrade Kernel Version button. If this button is displayed, you can click it to view the kernel minor version. If this button is not displayed, the latest kernel minor version is used. For more information, see Upgrade the kernel minor version of an RDS for MySQL instance.
    Upgrade Kernel Version
  • The RDS instance belongs to the following regions and zones:
    • China (Hangzhou): Zones E, F, H, and I
    • China (Shanghai): Zones A, B, D, and F
    • China (Beijing): Zones A, B, C, D, and H
    • China (Zhangjiakou): Zones A and B
    • China (Hohhot): Zones A and B
    • China (Shenzhen): Zones A, B, C, D, and E
    • Singapore: Zones A and C
    • India (Mumbai): Zones A and B
    • Germany (Frankfurt): Zone A
    • Japan (Tokyo): Zones A and B
    • Australia (Sydney): Zones A and B
    • UK (London): Zones A and B
    Note If you want to enable this service for an RDS instance that does not belong to the preceding regions and zones, you must open a ticket.

Background information

This service uses dedicated proxy compute resources to establish a dedicated database proxy for your RDS instance. It has the following benefits:

  • A proxy endpoint is used and remains valid unless you release the proxy instance. Therefore, you do not need to frequently change the endpoint information in your application. For example, you do not need to do so if you enable read/write splitting but later you release the read-only instances attached to the RDS instance and disable read/write splitting. This reduces maintenance costs.
  • Dedicated database proxy guarantees service stability. If users share the same database proxy, they may compete for resources, resulting in service instability.
  • Resources can be scaled to process more traffic.

Billing

In the beta test phase, this service is free of charge. After the beta test phase ends, you will be notified of when you must pay for this service.

Precautions

  • A transient disconnection may occur when you change the configuration of the master instance or its read-only instance.
  • The database proxy service does not support SSL encryption.
  • The database proxy service does not support compression protocols.
  • When the proxy endpoint is used, all transaction requests are routed to the master instance.
  • When the proxy endpoint is used for read/write splitting, the read consistency of non-transaction requests cannot be guaranteed. If you require read consistency, then you can encapsulate data in transactions.
  • When the proxy endpoint is used, the /*FORCE_MASTER*/ class cannot be used to comment SQL statements to query the master instance.
  • When the proxy endpoint is used, the LAST_INSERT_ID() function cannot be used.
  • When the proxy endpoint is used, the show processlist command returns a combination of results from the master instance and all its read-only instances.
  • If short-lived connection optimization is enabled, the show processlist command may return idle connections.
  • If you run multiple statements or stored procedures, all subsequent requests over the current connection are routed to the master instance. To restore read/write splitting, you must disconnect the current connection and then reestablish a connection.

Enable database proxy

  1. Log on to the RDS console.
  2. In the upper-left corner, select the region where the target RDS instance is located.
    Select a region
  3. Find the target RDS instance and click the instance ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. In the main workspace, click Enable now.
    Enable database proxy

Overview of the Database Proxy page

After database proxy is enabled, you can use the proxy endpoint to enable read/write splitting and short-lived connection optimization.

Database Proxy page
Category Parameter Description
Proxy Endpoint Endpoint The proxy endpoint provided by the dedicated database proxy. The read/write splitting function is bound to the proxy endpoint.
Port The port used by the proxy endpoint.
Endpoint Type Only the Internal (VPC) network type is supported.
Instance Name The RDS instance connected through the proxy endpoint.
Instances Associated with Proxy The number of proxy instances associated with the proxy endpoint. You can add proxy instances to increase the request-processing capability of the dedicated database proxy. After the beta test phase ends, you must pay for the proxy instances you add.
Read/Write Splitting Whether read/write splitting is enabled for the proxy endpoint.
Short-Lived Connection Optimization Whether short-lived connection optimization is enabled for the proxy endpoint.
Note You can click Enable or Disable to the right of Short-Lived Connection Optimization to enable or disable this function.
Proxy Instance Proxy Type Only the Dedicated Proxy service is supported.
CPU and Memory The specification of the proxy instance. Only the 2 Cores, 4 GB specification is supported.
Instances Associated The number of proxy instances associated with the proxy endpoint.

Change the number of proxy instances

Note Changing the number of proxy instances causes a transient disconnection. You must make sure that your application can automatically reconnect to the RDS instance.
  1. Log on to the RDS console.
  2. In the upper-left corner, select the region where the target RDS instance is located.
    Select a region
  3. Find the target RDS instance and click the instance ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. On the Proxy Service tab, find the Proxy Instance section. Then change the number in the Instances Adjusted column and click Apply in the Adjustment Plan column.
    Change the number of proxy instances
  6. Set Applied At and click OK.
    Configure Proxy Resources

View monitoring data

  1. Log on to the RDS console.
  2. In the upper-left corner, select the region where the target RDS instance is located.
    Select a region
  3. Find the target RDS instance and click the instance ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. Select the Monitoring Data tab.
  6. Specify a time range and view the CPU Utilization (%) metric.
    Note The CPU Utilization (%) metric indicates the CPU usage of the physical host where the proxy instance is located.
    Monitoring Data

Disable database proxy

  1. Log on to the RDS console.
  2. In the upper-left corner, select the region where the target RDS instance is located.
    Select a region
  3. Find the target RDS instance and click the instance ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. In the upper-right corner, click Disable Proxy Service.
    Disable Proxy Service
  6. In the displayed dialog box, click OK.

APIs

API Description
ModifyDBProxyInstance Used to modify the settings of the dedicated database proxy service for an RDS instance.
ModifyDBProxy Used to enable or disable the dedicated database proxy service for an RDS instance.
DescribeDBProxy Used to query details about the dedicated database proxy service for an RDS instance.
DescribeDBProxyEndpoint Used to query the proxy endpoint of an RDS instance.
ModifyDBProxyEndpoint Used to modify the proxy endpoint of an RDS instance.
DescribeDBProxyPerformance Used to query the performance data of the dedicated database proxy for an RDS instance.