ApsaraDB RDS for MySQL provides the dedicated proxy feature that outperforms the shared proxy feature in terms of stability, scalability, and performance. You can upgrade an existing primary RDS instance from shared proxy to dedicated proxy.

Prerequisites

  • The primary RDS instance and its read-only RDS instances must run one of the following MySQL versions and RDS editions:
    Note
    • MySQL 5.6 on RDS Enterprise Edition does not support the upgrade from shared proxy to dedicated proxy.
    • If the error shown in the following figure is reported during the upgrade, you must upgrade the minor engine versions of the primary and read-only RDS instances. For more information, see Update the kernel version of an ApsaraDB RDS for MySQL instance.
    Error
  • The shared proxy feature is enabled for the primary RDS instance. You can log on to the ApsaraDB for RDS console and go to the Database Proxy page for the primary RDS instance to check whether the shared proxy feature is enabled.

Background information

The read/write splitting function of ApsaraDB RDS for MySQL is implemented based on proxies. For some existing RDS instances that run MySQL 5.6 or 5.7, the read/write splitting function is implemented based on shared proxies. However, if you share proxies, this can lead to potential stability risks. We recommend that you upgrade these RDS instances from shared proxy to dedicated proxy. Dedicated proxies have the following benefits over shared proxies:

  • Dedicated proxies provide better stability and isolation.
  • Dedicated proxies provide higher performance. Based on a test that was performed by using SysBench, each dedicated proxy can process up to 20,000 queries per second (QPS) in online transaction processing (OLTP) scenarios.
  • Dedicated proxies support scaling. You can add dedicated proxies based on your business requirements. This allows you to handle larger workloads.
  • Dedicated proxies support performance monitoring. You can adjust the number of dedicated proxies based on the monitoring data to meet your business requirements. Each adjustment takes effect immediately after it is applied.
  • A unified proxy endpoint is provided to connect to all of the dedicated proxies that are enabled on the primary RDS instance. This reduces maintenance costs by relieving you from updating the endpoints on your application. The proxy endpoint remains valid unless you release the dedicated proxy instance. For example, you may enable the read/write splitting function during peak hours, but then release the read-only RDS instances and disable the function after peak hours. In these cases, you do not need to update the endpoints on your application because the proxy endpoint remains connected.
  • A unified proxy endpoint is provided to implement functions such as read/write splitting, short-lived connection optimization, and transaction splitting.

For more information about the dedicated proxy feature, see Dedicated proxy.

This topic describes how to upgrade an existing primary RDS instance from shared proxy to dedicated proxy.

Billing

When you perform the upgrade, the system recommends a specific number of dedicated proxies based on the combined specifications of the primary and read-only RDS instances. Alibaba Cloud offers you a specific number of dedicated proxies free-of-charge. However, if you want to use more dedicated proxies, you must pay an hourly rate for these additional dedicated proxies. For more information, see Dedicated proxy.

  • If the primary RDS instance uses pay-as-you-go billing:

    You must pay for all of the dedicated proxies that you use.

    For example, if the system recommends six dedicated proxies, you must pay for six dedicated proxies.

  • If the primary RDS instance uses subscription billing:
    • Before the primary RDS instance expires, all of the dedicated proxies that are recommended by the system are free-of-charge. After the primary RDS instance expires, you must pay for these dedicated proxies.

      In this example, the primary RDS instance is expected to expire on April 30, 2021, and you upgrade it from shared proxy to dedicated proxy on April 1, 2021. If the system recommends six dedicated proxies, the six dedicated proxies are free-of-charge within the period starting from April 1, 2021 to April 30, 2021.

      Note The expiration date specified before the upgrade remains valid. This applies even if you renew the subscription of the primary RDS instance after the upgrade.
    • If you adjust the recommended number of dedicated proxies before the primary RDS instance expires, you only need to pay for the additional dedicated proxies that you use.

      In this example, the primary RDS instance is expected to expire on April 30, 2021, and you upgrade it from shared proxy to dedicated proxy on April 1, 2021. Assume that the system recommends six dedicated proxies. If you adjust the number of dedicated proxies to 5 and then from 5 to 6 before April 30, 2021, you do not need to pay additional fees. If you adjust the number of dedicated proxies to 8 before April 30, 2021, you need to pay for two additional dedicated proxies.

    • If you disable the dedicated proxy feature and then enable it again before the primary RDS instance expires, you must pay for all of the dedicated proxies that you use.

      In this example, the primary RDS instance is expected to expire on April 30, 2021, and you upgrade it from shared proxy to dedicated proxy on April 1, 2021. Assume that you disable the dedicated proxy feature on April 15, 2021 and then enable it again on April 20, 2021. In this case, the system recommends eight dedicated proxies, and you must pay for eight dedicated proxies starting from April 20, 2021.

Precautions

  • After you enable the dedicated proxy feature, each connection is replicated on the primary and read-only RDS instances in compliance with the 1:N connection model. We recommend that you specify the same connection specifications for these instances. If these instances have different connection specifications, the number of connections allowed is based on the lowest connection specifications among these instances.
  • If you create a read-only RDS instance after you enable the dedicated proxy feature, only the requests over new connections are routed to the new read-only RDS instance. This also applies if you restart a read-only RDS instance.
  • The max_prepared_stmt_count parameter must be set to the same value for the primary and read-only RDS instances.
  • For more information, see Dedicated proxy.

Impact

During the upgrade, the endpoints of the primary and read-only RDS instances will encounter a brief disconnection of about 30 seconds. In this case, the read/write splitting endpoint will be unavailable for about 30 seconds.

Procedure

  1. Log on to the ApsaraDB for RDS console.
  2. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where the target RDS instance resides.
    Select a region
  3. Find the target instance and click the instance ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. On the page that appears, click Upgrade to Dedicated Proxy.
    Note Wait until the upgrade is complete.