ApsaraDB RDS for MySQL provides the dedicated database proxy feature that delivers higher stability, scalability, and performance than the shared database proxy feature. If the shared database proxy feature is enabled for your ApsaraDB RDS for MySQL instance, you can upgrade the database proxy of the RDS instance from a shared database proxy to a dedicated database proxy.
Starting April 1, 2021, Alibaba Cloud provides technical support only for the shared database proxy feature of ApsaraDB RDS for MySQL and no longer updates or maintains the shared database proxy feature. We recommend that you upgrade the database proxy of your RDS instance from a shared database proxy to a dedicated database proxy at the earliest opportunity. For more information, see [EOS/Discontinuation] End of updates and maintenance for the shared database proxy feature from April 01, 2021.
You cannot directly upgrade a shared database proxy to a general-purpose database proxy. You can upgrade the shared database proxy to a dedicated database proxy and then change the proxy type to a general-purpose database proxy. For more information, see Change the proxy type and number of proxies and General-purpose proxies and dedicated database proxies.
Upgrade promotions
You are provided a free trial for the dedicated database proxy feature within a period of time. During the trial period, you can use the default number of dedicated database proxies that are provided free of charge. If you enable additional dedicated database proxies, you are charged for the additional dedicated database proxies that you enable. The free trial period varies based on the billing method.
If your primary RDS instance uses the pay-as-you-go billing method, the free trial period is one year.
If your primary RDS instance uses the subscription billing method, the free trial period is at least one year and can vary based on the expiration time of the instance.
If you perform the upgrade more than one year before your primary RDS instance expires, the free trial period ends when your primary RDS instance expires.
NoteIf you renew your primary RDS instance, the free trial period remains unchanged and does not extend to the new expiration time.
If you perform the upgrade less than one year before your primary RDS instance expires, the free trial period is one year.
Take note of the following points:
The dedicated database proxy feature for your primary RDS instance provides a default number of dedicated database proxies. If you enable additional dedicated database proxies during the free trial period, you are charged for the additional dedicated database proxies that you enable. For example, if the dedicated database proxy feature for your primary RDS instance provides six default dedicated database proxies, you are not charged when the number of dedicated database proxies that you enable does not exceed 6. If you enable seven dedicated database proxies, you are charged for one dedicated database proxy.
If you disable the dedicated database proxy feature for your primary RDS instance during the free trial period, the free trial period ends. If you enable this feature again, you are charged for the dedicated database proxy feature.
Prerequisites
Your primary RDS instance and its read-only RDS instances run one of the following MySQL versions and RDS editions:
MySQL 5.7 with a minor engine version of 20190925 or later on RDS High-availability Edition
MySQL 5.6 with a minor engine version of 20200229 or later on RDS High-availability Edition
NoteIf the
current db not support db proxy
error message appears during the upgrade, you must update the minor engine version of your RDS instance. For more information, see Update the minor engine versionThe shared database proxy feature is enabled for your primary RDS instance. You can log on to the ApsaraDB RDS console and go to the Database Proxy page to check whether the shared database proxy feature is enabled for your primary RDS instance.
Billing rules
When you perform the upgrade, the system recommends a specific number of dedicated database proxies based on the overall specifications of your primary and read-only RDS instances. Fees for additional dedicated database proxies that you enable are deducted on an hourly basis. For more information, see Billing rules for the dedicated database proxy feature.
Background information
Read/write splitting of ApsaraDB RDS for MySQL is implemented based on the database proxy feature. For specific existing RDS instances that run MySQL 5.6 or MySQL 5.7, read/write splitting is implemented based on the shared database proxy feature. However, the shared database proxy feature cannot ensure service stability. We recommend that you upgrade the database proxies of the RDS instances from shared database proxies to dedicated database proxies. Compared with the shared database proxy feature, the dedicated database proxy feature has the following advantages:
The dedicated database proxy feature provides better stability and isolation.
The dedicated database proxy feature provides higher performance. If no bottleneck issues occur in the instance configuration, each dedicated database proxy can process up to 20,000 queries per second (QPS) in online transaction processing (OLTP) scenarios. This is verified by a test that is performed by using Sysbench.
The dedicated database proxy feature supports scaling. You can enable additional dedicated database proxies to process more workloads.
The dedicated database proxy feature supports performance monitoring. You can adjust the number of dedicated database proxies based on the monitoring data and your business plan. An adjustment immediately takes effect after it is applied.
A dedicated database proxy endpoint is provided. This eliminates the need to modify the endpoint information on your application and reduces maintenance costs. The dedicated database proxy endpoint remains valid until you release the dedicated database proxy. For example, you can enable read/write splitting during peak hours and then release read-only RDS instances and disable read/write splitting during off-peak hours. In these cases, the dedicated database proxy endpoint remains connected, and you do not need to update the endpoint information on your application.
A dedicated database proxy endpoint is used to support capabilities such as read/write splitting, short-lived connection optimization, and transaction splitting.
For more information about dedicated database proxies, see What are database proxies?
The following section describes how to upgrade the database proxy of your primary RDS instance from a shared database proxy to a dedicated database proxy.
Usage notes
After you enable the dedicated database proxy feature, each connection is replicated to your primary RDS instance and its read-only RDS instances based on the 1:N connection model. We recommend that you specify the same connection specifications for the instances. If the instances have different connection specifications, the number of connections that are allowed is limited by the lowest connection specifications among the instances.
If you create or restart a read-only RDS instance after you enable the dedicated proxy feature, only requests over new connections are forwarded to the read-only RDS instance.
The max_prepared_stmt_count parameter must be set to the same value for your primary RDS instance and read-only RDS instances.
After you upgrade the database proxy of your RDS instance, the endpoint of the RDS instance remains unchanged. However, the virtual IP address (VIP) of the RDS instance changes. We recommend that you connect your application to the RDS instance by using an endpoint instead of an IP address.
After the upgrade, we recommend that you immediately delete the cached DNS records from the database client. If the database client runs on a Java virtual machine (JVM), we recommend that you set the time-to-live (TTL) in the JVM configuration to 60 seconds or less. This way, if the VIP that is bound to the in-use endpoint of your RDS instance changes, your application can query the related DNS records again to obtain the new VIP. Then, your application can connect to the new VIP.
NoteFor more information about how to specify the TTL in the JVM configuration, see Class InetAddress.
By default, the multi-statement feature is enabled for the dedicated database proxy in the protocol layer. If this feature is not enabled in the application layer, an error occurs when you use the feature. Therefore, configure related connection parameters before you use this feature. For example, you can add
allowMultiQueries=true
in your JDBC settings.For more information, see Usage notes for the database proxy feature.
Impacts
During the upgrade, the endpoints of your primary RDS instance and its read-only RDS instances encounter a transient connection that lasts 30 seconds to 120 seconds. The read/write splitting routing endpoint also becomes unavailable for 30 seconds.
Procedure
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane, click Database Proxy.
On the page that appears, click Upgrade to Dedicated Proxy.
NoteWait until the upgrade is complete.