This topic describes how to enable the proxy terminal feature for an ApsaraDB RDS for MySQL instance. After you configure a proxy terminal, ApsaraDB RDS can route read and write requests to the primary and read-only RDS instances in your database system based on the read weights of these instances. This feature is implemented by using an endpoint of the proxy terminal, which is the counterpart of the original read/write splitting endpoint.

Prerequisites

Procedure

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Database Proxy.
  3. Click the Proxy Terminal (Original Read/Write Splitting) tab. Then, click Configure Proxy Terminal.
  4. In the Configure Proxy Terminal dialog box, configure the following parameters and click OK.
    Configure Proxy Terminal dialog box
    Parameter Description
    Custom Proxy Terminal The name of the proxy terminal. The name can be up to 30 characters in length.
    Read/Write Attribute The read and write attributes of the proxy terminal. Valid values:
    • Read/Write: The proxy terminal connects to both your RDS instance and its read-only RDS instances. It can receive write requests. This is the default attribute.
    • Read-only: The proxy terminal connects to only the read-only RDS instances that are attached to your RDS instance. It cannot receive write requests.

    For more information, see Use the dedicated proxy endpoints of an ApsaraDB RDS for MySQL instance to implement read/write splitting.

    Connection Pool The type of connection pool that you want to enable for the proxy terminal. Valid values:
    • Transaction Connection Pool: If 10,000 or more connections are established, select this value. This is the default value.
    • Session Connection Pool: If only short-lived connections over PHP are established, select this value.
    • Disable Connection Pool: 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.

    Note This parameter appears only when you set the Read/Write Attribute parameter to Read/Write (Read/Write Splitting).
    Latency Threshold The maximum latency that is allowed for data replication from your RDS instance to its read-only RDS instances. If the latency of data replication to a read-only RDS instance exceeds the specified threshold, ApsaraDB RDS stops routing read requests to the instance. This applies even if the instance has a high read weight.

    Valid values: 0 to 7200. Unit: seconds. In most cases, a read-only RDS instance replicates data at a specific latency due to long or abnormal SQL statement executions. We recommend that you set this parameter to a value greater than or equal to 30.

    Note This parameter appears only when you set the Read/Write Attribute parameter to Read/Write (Read/Write Splitting).
    Transaction Splitting Specifies whether to enable the transaction splitting feature. The transaction splitting feature allows ApsaraDB RDS to route the read requests prior to write operations in a transaction to the read-only RDS instances that are attached to your RDS instance. This reduces the loads on your RDS instance. This feature is enabled by default.
    Note This parameter appears only when you set the Read/Write Attribute parameter to Read/Write (Read/Write Splitting).
    Read Weight Distribution The method that is used to assign read weights. A higher read weight indicates more read requests to process. For example, your RDS instance is attached with three read-only RDS instances, and the read weights of these instances are 0, 100, 200, and 200. In this case, your RDS instance processes only write requests, and the three read-only RDS instances process all the read requests based on the 1:2:2 ratio.
    • Automatic: ApsaraDB RDS assigns a read weight to each RDS instance based on the specifications of the instance. After you create a read-only RDS instance, ApsaraDB RDS assigns a read weight to the instance and adds the instance to the read/write splitting link. This relieves you from manual operations. For more information, see Rules of weight allocation by the system.
    • Custom: You must manually specify a read weight for each RDS instance. Valid values: 0 to 10000. When you create a read-only RDS instance, the read weight of the instance defaults to 0. You must manually specify a new read weight for the instance.
    Note If you have specified a data replication latency for a read-only RDS instance, you cannot specify a read weight for the instance. For more information, see Set the data replication latency of a read-only ApsaraDB RDS for MySQL instance.

After you configure the proxy terminal feature, you must add the endpoint of the proxy terminal to your application. This endpoint is also known as a proxy endpoint. Then, ApsaraDB RDS can route write requests to your RDS instance and read requests to its read-only RDS instances based on the read weights of these instances.

Introduction to the Proxy Terminal (Original Read/Write Splitting) tab

After you enable the dedicated proxy, you can configure the following parameters on the Proxy Terminal (Original Read/Write Splitting) tab.

Section Parameter Description
Basic information SSL Certificate Information The switch that is used to enable or disable SSL encryption for the dedicated proxy. SSL encryption helps ensure the security of data transmission. For more information, see Configure SSL encryption for a proxy endpoint on an ApsaraDB RDS for MySQL instance.
Protected Endpoint The endpoint that is protected by using the SSL certificate. You can change the endpoint based on your business requirements. For more information, see Change the protected proxy endpoint.
SSL Certificate Expiration Time The time when the SSL certificate expires.
SSL Certificate Validity The status on whether the SSL certificate is valid.
Read Weight Distribution The method that is used to assign read weights. Valid values:
  • Automatic: ApsaraDB RDS assigns a read weight to each RDS instance based on the specifications of the instance. After you create a read-only RDS instance, ApsaraDB RDS assigns a read weight to the instance and adds the instance to the read/write splitting link. This relieves you from manual operations. For more information, see Rules of weight allocation by the system.
  • Custom: You must manually specify a read weight for each RDS instance. Valid values: 0 to 10000. When you create a read-only RDS instance, the read weight of the instance defaults to 0. You must manually specify a new read weight for the instance.
Latency Threshold The maximum latency that is allowed for data replication from your RDS instance to its read-only RDS instances. If the latency of data replication to a read-only RDS instance exceeds the specified threshold, ApsaraDB RDS stops routing read requests to the instance. This applies even if the instance has a high read weight.
Involved Instances The total number of primary and read-only RDS instances that are involved in read/write splitting in your database system.
Read/Write Attribute The read and write attributes of the proxy terminal.
Connection Pool The type of connection pool that is enabled for the proxy terminal. For more information, see Set the connection pool type of an ApsaraDB RDS for MySQL instance.
Transaction Splitting The status on whether the transaction splitting feature is enabled for the proxy terminal. The transaction splitting feature allows ApsaraDB RDS to route the read requests prior to write operations in a transaction to the read-only RDS instances that are attached to your RDS instance. This reduces the loads on your RDS instance. For more information, see Use the transaction splitting feature on an ApsaraDB RDS for MySQL instance.
Note You can click Enable or Disable to the right of the Transaction Splitting parameter to enable or disable the transaction splitting feature.
Primary Instance The ID of your RDS instance. The Weight of Primary Instance parameter on the right shows the read weight of your RDS instance.
Read-only Instance The ID of a read-only RDS instance. The Weight of Read-only Instance parameter on the right shows the read weight of the read-only RDS instance.
Diagram None The architecture and statuses of your RDS instance and its read-only RDS instances.

Related operations

Operation Description
DescribeDBProxy Queries details about the dedicated proxy of an RDS instance.
DescribeDBProxyEndpoint Queries the proxy endpoints that are used to connect to the dedicated proxy of an RDS instance.
ModifyDBProxyEndpoint Modifies a proxy endpoint that is used to connect to the dedicated proxy of an RDS instance.