This topic introduces the dedicated proxy feature provided by RDS MySQL. This feature offers advanced functions such as read/write splitting, short-lived connection optimization, and transaction splitting.

Prerequisites

Your RDS instance runs one of the following MySQL versions and RDS editions:

  • MySQL 8.0 Enterprise Edition (with a kernel version of 20191204 or later)
  • MySQL 8.0 High-availability Edition (with a kernel version of 20190915 or later)
  • MySQL 5.7 Enterprise Edition (with a kernel version of 20191128 or later)
  • MySQL 5.7 High-availability Edition (with a kernel version of 20190925 or later)
  • MySQL 5.6 High-availability Edition (with a kernel version of 20200229 or later)
Note
  • You can follow these steps to view the kernel version: Log on to the ApsaraDB for RDS console, find the target RDS instance, and navigate to the Basic Information page. Then, in the Configuration Information section, check whether the Upgrade Kernel Version button exists. If the button exists, click it to view the kernel version. If the button does not exist, you are already using the latest kernel version. For more information, see Upgrade the kernel minor version of an RDS MySQL instance.
  • If your database system spans more than one zone, you can only enable the dedicated proxy feature on the condition that you selected the preceding regions and zones when you created the primary instance.

Background information

A dedicated proxy uses dedicated computing resources. It has the following benefits:

  • A proxy endpoint is used to connect to your database system. This reduces maintenance costs by relieving you from updating the endpoints on your application. The proxy endpoint remains valid unless you release the proxy instances in the dedicated proxy. For example, you may enable read/write splitting during peak hours, but then release read-only instances and disable read/write splitting after peak hours. In such cases, you do not need to update the endpoints on your application because the proxy endpoint is still connected.
  • A dedicated proxy serves only your database system to ensure service stability. This way, you do not compete with other users for resources.
  • A dedicated proxy can be scaled by adding proxy instances to process more requests.

Billing

Starting from January 15, 2020, you are issued with one proxy instance free of charge. If you want to add more proxy instances, you must pay additional fees. The following table lists the prices.

Region Dedicated proxy
Name Code USD/hour
China (Hangzhou) cn-hangzhou 0.173
China (Shanghai) cn-shanghai 0.173
China (Qingdao) cn-qingdao 0.173
China (Beijing) cn-beijing 0.173
China (Zhangjiakou-Beijing Winter Olympics) cn-zhangjiakou 0.120
China (Hohhot) cn-huhehaote 0.173
China (Shenzhen) cn-shenzhen 0.173
China (Chengdu) cn-chengdu 0.173
China (Hong Kong) cn-hongkong 0.297
Japan (Tokyo) ap-northeast-1 0.288
India (Mumbai) ap-south-1 0.231
Singapore ap-southeast-1 0.271
Australia (Sydney) ap-southeast-2 0.273
Malaysia (Kuala Lumpur) ap-southeast-3 0.253
Indonesia (Jakarta) ap-southeast-5 0.271
Germany (Frankfurt) eu-central-1 0.243
UK (London) eu-west-1 0.280
UAE (Dubai) me-east-1 0.377
US (Virginia) us-east-1 0.237
US (Silicon Valley) us-west-1 0.284

Precautions

  • A brief disconnection may occur while you change the specifications of the primary instance or its read-only instances.
  • Dedicated proxies do not support SSL encryption.
  • Dedicated proxies do not support compression protocols.
  • After you connect your applications to your database system by using a proxy endpoint, all transaction requests are routed to the primary instance.
  • If a proxy endpoint is used for read/write splitting, the read consistency of non-transaction requests cannot be guaranteed. To ensure read consistency, encapsulate data in transactions.
  • If a proxy endpoint is used, the LAST_INSERT_ID() function cannot be used.
  • The SHOW PROCESSLIST statement returns a combination of results from the primary instance and its read-only instances.
  • If short-lived connection optimization is enabled, the SHOW PROCESSLIST statement may return idle connections.
  • If you execute multiple statements or stored procedures, read/write splitting is disabled and all subsequent requests sent over the current connection are routed to the primary instance. To enable read/write splitting again, you must terminate the current connection and establish a new one.
  • Hints /*FORCE_MASTER*/ and /*FORCE_SLAVE*/ are supported. However, requests that contain hints have higher route priorities. These requests are not constrained by consistency or transaction limits. Check whether these hints are suitable for your business before you use them. A hint must not contain statements that change environment variables such as /*FORCE_SLAVE*/ set names utf8; . Otherwise, an error may occur in the subsequent procedure.

Enable the dedicated proxy feature

  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target RDS instance resides.
    Select a region
  3. Find the target RDS instance and click its ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. Click Enable now.
    Enable the dedicated proxy feature

Overview of the Database Proxy page

After the dedicated proxy feature is enabled, you can use a proxy endpoint for read/write splitting, short-lived connection optimization, and transaction splitting.

Database Proxy page
Section Parameter Description
Proxy Endpoint Endpoint The proxy endpoint generated, to which read/write splitting is bound.
Port The port used by the proxy endpoint.
Endpoint Type Only the Internal (VPC) network type is supported.
Instance Name The name of the primary instance connected by using the proxy endpoint.
Instances Associated with Proxy The number of proxy instances associated with the proxy endpoint. You can add proxy instances to equip the dedicated proxy to process more requests. After the public preview phase ends, you must pay for the proxy instances you add.
Read/Write Splitting Specifies whether to enable read/write splitting for the proxy endpoint. For more information, see Introduction to read/write splitting.
Short-Lived Connection Optimization Specifies whether to enable short-lived connection optimization for the proxy endpoint. For more information, see Short-lived connection optimization.
Note You can click Enable or Disable to the right of Short-Lived Connection Optimization to enable or disable this function.
Transaction Splitting Specifies whether to enable transaction splitting for the proxy endpoint. For more information, see Transaction splitting.
Proxy Instance Proxy Type Only Dedicated Proxy is supported.
CPU and Memory The specifications of proxy instances. Only two CPU cores and 4 GB of memory (2 Cores, 4 GB) are supported.
Instances Associated The total number of proxy instances. Up to 60 proxy instances are supported.
Note We recommend that you enter an integer close to the total number of CPU cores for the primary and read-only instances divided by 8 (round up).

For example, if the primary instance has eight CPU cores and its read-only instances have four CPU cores, the recommended number of proxy instances is calculated as follows: (8 + 4)/8 = 2.

Adjust the number of proxy instances

Note A brief disconnection may occur while you adjust the number of proxy instances. Make sure that your application is configured to automatically reconnect to your database system after disconnection.
  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target RDS instance resides.
    Select a region
  3. Find the target RDS instance and click its ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. In the Proxy Instance section of the Proxy Service tab, change the number in the Instances Adjusted column and click Apply in the Adjustment Plan column.
    Adjust the number of proxy instances
  6. Set Applied At and click OK.
    Configure proxy resources

View monitoring data

  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target RDS instance resides.
    Select a region
  3. Find the target RDS instance and click its ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. Click the Monitoring Data tab.
  6. Select a time range and view the CPU Utilization (%) metric from that time range.
    Note The CPU Utilization (%) metric indicates the CPU utilization of the physical host where proxy instances reside.
    View monitoring data

Disable the dedicated proxy feature

  1. Log on to the ApsaraDB for RDS console.
  2. In the top navigation bar, select the region where the target RDS instance resides.
    Select a region
  3. Find the target RDS instance and click its ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. In the upper-right corner, click Disable Proxy Service.
    Disable the dedicated proxy feature
  6. In the message that appears, click OK.

FAQ

  • Why is the dedicated proxy feature still unavailable even though my RDS instance runs MySQL 5.7 and the latest kernel version?

    After you update the kernel version of your RDS instance that runs MySQL 5.7, you must disable the original read/write splitting function before you can use the dedicated proxy feature.

  • Which endpoint do I need to use for read/write splitting: the proxy endpoint or the read/write splitting endpoint?

    The proxy endpoint and the read/write splitting endpoint are the same. The backend uses the proxy endpoint to implement read/write splitting.

Related operations

Operation Description
ModifyDBProxyInstance Modifies the dedicated proxy settings of an ApsaraDB for RDS instance.
ModifyDBProxy Enables or disables the dedicated proxy feature of an ApsaraDB for RDS instance.
DescribeDBProxy Queries details about the dedicated proxy of an ApsaraDB for RDS instance.
DescribeDBProxyEndpoint Queries the proxy endpoint of the dedicated proxy for an ApsaraDB for RDS instance.
ModifyDBProxyEndpoint Modifies the proxy endpoint of the dedicated proxy for an ApsaraDB for RDS instance.
DescribeDBProxyPerformance Queries the performance of the dedicated proxy for an ApsaraDB for RDS instance.