This topic describes how to enable the dedicated proxy service for an ApsaraDB RDS for MySQL instance. This service provides advanced features, such as read/write splitting, connection pool, and transaction splitting.

Prerequisites

  • Your RDS instance is a primary instance and runs one of the following MySQL versions and RDS editions:
    • MySQL 8.0 on RDS Enterprise Edition (The minor engine version is 20191204 or later.)
    • MySQL 8.0 on RDS High-availability Edition (The minor engine version is 20190915 or later.)
    • MySQL 5.7 on RDS Enterprise Edition (The minor engine version is 20191128 or later.)
    • MySQL 5.7 on RDS High-availability Edition (The minor engine version is 20190925 or later.)
    • MySQL 5.6 on RDS High-availability Edition (The minor engine version is 20200229 or later.)
    Note If you want to view the minor engine version of your RDS instance, perform the following operations: Log on to the ApsaraDB RDS console, go to the Basic Information page, and in the Configuration Information section of the page check whether the Upgrade Minor Version button exists. If the button exists, you can click it to view and update the minor engine version. If the button does not exist, you are using the latest minor engine version. For more information, see Update the minor engine version of an ApsaraDB RDS for MySQL instance.
  • Your RDS instance does not reside in Zone D of the China (Hangzhou) region, Zone A of the China (Beijing) region, or Finance Zone B of the China (Shenzhen) region.
    Note If your RDS instance resides in the preceding zones, you can migrate the instance to other zones before you enable the dedicated proxy service. For more information, see Migrate an ApsaraDB RDS for MySQL instance across zones in the same region.

Limits

  • Dedicated proxies do not support compression protocols.
  • Dedicated proxies do not support vSwitch changes.

Procedure

This section describes how to enable the dedicated proxy service in the ApsaraDB RDS console. You can also enable this service when you create a read-only RDS instance. For more information, see Create a read-only ApsaraDB RDS for MySQL instance.

  1. Go to the Database Proxy page.
    1. Log on to the ApsaraDB for RDS console. In the left-side navigation pane, click Instances. In the top navigation bar, select the region where your RDS instance resides.
      选择地域
    2. Find your primary RDS instance and click its ID. In the left-side navigation pane, click Database Proxy.
  2. Click Enable. In the dialog box that appears, configure the Network Type and Proxy Instances parameters and click Enable.
    Note
    • The default network type varies based on the instance configuration. For more information, see Manage the dedicated proxy endpoints of an ApsaraDB RDS for MySQL instance.
    • We recommend that you specify the number of dedicated proxies as the rounded-up integer of the total number of CPU cores of your primary RDS instance and its read-only RDS instances divided by 8. A maximum of 60 dedicated proxies are supported.

      For example, if your primary RDS instance has eight CPU cores and its read-only RDS instances have four CPU cores, the recommended number of dedicated proxies is 2 based on the following calculation: (8 + 4)/8 = 1.5 (rounded up to 2).

    Enable Database Proxy dialog box

Overview of the Database Proxy page

The Database Proxy service provides the following tabs:

  • Proxy Service

    On the Proxy Service tab, you can perform operations such as upgrading the dedicated proxy version and creating a dedicated proxy endpoint.

    Proxy Service tab
    Section Parameter Description
    Proxy Endpoint Status The status of the enabled dedicated proxies.
    Instance ID The ID of your primary RDS instance.
    Instances Associated with Proxy The number of enabled dedicated proxies. You can process more requests by enabling more dedicated proxies.
    Read/Write Splitting Specifies whether to enable the read/write splitting feature. For more information, see Enable the read/write splitting feature for an ApsaraDB RDS for MySQL instance.
    Connection Pool Specifies whether to enable the connection pool feature. If you enable this feature, this parameter also specifies the type of connection pool to enable. Valid values:
    • Enable Transaction Connection Pool: This is the default value. If 10,000 or more connections are established, select this value.
    • Enable Session Connection Pool: If only short-lived connections over PHP are established, select this value.
    • Disable: If you want to disable the connection pool feature, select this value.

    For more information, see Set the connection pool type of an ApsaraDB RDS for MySQL instance.

    Endpoint Endpoint The dedicated proxy endpoint that is being used to connect to the enabled dedicated proxies. The read/write splitting feature is bound to this endpoint. After the dedicated proxy service is enabled, a default dedicated proxy endpoint is generated. You can create, modify, or delete a dedicated proxy endpoint. For more information, see Manage the dedicated proxy endpoints of an ApsaraDB RDS for MySQL instance.
    Port The port that is bound to the dedicated proxy endpoint that is being used.
    Note To change the port, you can click Change Port to the right of the displayed port number. The port number must be within the range of 1000 to 5999.
    Endpoint Type The network type of the dedicated proxy endpoint that is being used. You cannot change the network type of a dedicated proxy endpoint.
    Proxy Instance Proxy Type The type of dedicated proxy that is enabled. Only the Dedicated Proxy type is supported.
    CPU and Memory The specifications that are provided per dedicated proxy. Only two CPU cores and four GB of memory are supported.
    Instances Associated The number of enabled dedicated proxies. You can enable more than one dedicated proxy. ApsaraDB RDS balances loads among the enabled dedicated proxies. A maximum of 60 dedicated proxies are supported.
    Note We recommend that you specify the number of dedicated proxies as the rounded-up integer of the total number of CPU cores of your primary RDS instance and its read-only RDS instances divided by 8.

    For example, if your primary RDS instance has eight CPU cores and its read-only RDS instances have four CPU cores, the recommended number of dedicated proxies is 2 based on the following calculation: (8 + 4)/8 = 1.5 (rounded up to 2).

  • Read/Write Splitting

    The read/write splitting feature is bound to the dedicated proxy endpoint that is being used. All requests are sent to this endpoint. Then, this endpoint routes read and write requests to your primary RDS instance and its read-only RDS instances based on the read weights of these instances. For more information, see Enable the read/write splitting feature for an ApsaraDB RDS for MySQL instance.

  • Monitoring Data

    On the Monitoring Data tab, you can view the CPU utilization and load of the enabled dedicated proxies at any time. The monitoring data provides a reference for you to adjust the number of enabled dedicated proxies in a timely manner. For more information, see View the monitoring data of dedicated proxies on an ApsaraDB RDS for MySQL instance.

Related operations

Operation Description
ModifyDBProxy Enables or disables the dedicated proxy service for an ApsaraDB RDS instance.
DescribeDBProxy Queries details about the dedicated proxies of an ApsaraDB RDS instance.