You can create multiple proxy terminals for an ApsaraDB RDS for MySQL instance. This topic describes how to create a proxy terminal.

Prerequisites

Limits

A maximum of seven proxy terminals can be created for each RDS instance.

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. In the upper-right corner of the page, click Create Proxy Terminal.
  4. Configure the following parameters.
    Parameter Description
    Custom Proxy Terminal Enter the name of the proxy terminal. The name can be up to 30 characters in length.
    Read/Write Attribute Select the read and write attributes for 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.
    • 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. This is the default attribute.
    Connection Pool Select 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 Specify 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 Specify 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 Select the method 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.
  5. Click OK.

After the proxy terminal is created, 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.