All Products
Search
Document Center

ApsaraDB RDS:Configure the connection settings for a database proxy endpoint

Last Updated:Jan 18, 2024

After you enable the database proxy feature for an ApsaraDB RDS for MySQL instance, you may need to modify the default connection settings for database proxy endpoints based on your business requirements. A database proxy endpoint is formerly named as a proxy terminal. This topic describes the parameters for the connection settings for a database proxy endpoint and how to configure the parameters.

Prerequisites

The database proxy feature is enabled. For more information, see Enable the database proxy feature.

Configure the connection settings for a database proxy endpoint

Note

You can connect to an RDS instance by using internal and public endpoints of different proxy endpoints based on your business requirements.

  1. 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.

  2. In the left-side navigation pane, click Database Proxy.

  3. In the Connection Information section, find the database proxy endpoint for which you want to configure connection settings in the Proxy Endpoint (Terminal) ID column and click Modify Configuration in the Actions column.

  4. In the dialog box that appears, modify the related connection settings for the database proxy endpoint based on your business requirements. The following table describes the parameters.

    Parameter

    Description

    Connection Description

    The custom description of the database proxy endpoint. The description can be up to 30 characters in length.

    Read/Write Attribute

    The read and write attributes of the database proxy endpoint.

    • Read/Write (Read/Write Splitting): The database proxy endpoint connects to the primary RDS instance and its read-only RDS instances, and can receive write requests. This is the default value.

    • Read-only (Primary Instance Not Connected to Receive Write Requests): The database proxy endpoint connects only to read-only RDS instances and cannot receive write requests.

    Note

    Connection Pooling

    The types of connection pools for the database proxy endpoint.

    • Transaction-level Connection Pooling: This option is recommended.

      • In most cases, short-lived connections are required in workloads.

      • Connections are frequently established.

      • The number of connections is greater than the maximum number of connections supported by an RDS instance.

      In the preceding scenarios, if the limits on the transaction-level connection pooling feature do not affect your workloads, we recommend that you select this option. For more information, see Limits of transaction connection pools.

    • Session-level Connection Pooling

      • In most cases, short-lived connections are required in workloads.

      • Connections are frequently established.

      In the preceding scenarios, if the limits on the transaction-level connection pooling feature affect your workloads, you can select this option instead. For more information, see Limits of transaction connection pools.

    • Disable Connection Pooling: This option is selected by default.

      • In most cases, persistent connections are required in workloads.

      • The number of connections is small.

      • Connection pools such as Druid, DBCP, c3p0, and HikariCP, are used in your applications.

      In the preceding scenarios, you do not need to use a connection pool.

    Note

    This parameter appears only when you set the Read/Write Attribute parameter to Read/Write (Read/Write Splitting). For more information, see Configure the connection pooling feature.

    Latency Threshold

    The maximum latency that is allowed for data replication from the primary RDS instance to its read-only RDS instances. Valid values: 0 to 3600. Unit: seconds.

    The read-only RDS instances may replicate data from the primary RDS instance at a specific latency. The latency varies based on the status of the SQL statements that are executed. We recommend that you set this parameter to a value that is 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).

    • If the latency of data replication to a read-only RDS instance exceeds the value of this parameter, the system no longer forwards read requests to the read-only RDS instance regardless of the read weight of the read-only RDS instance.

    Transaction Splitting

    The transaction splitting capability. The value is fixed as Enabled. After transaction splitting is enabled, the system forwards the read requests prior to write operations in transactions to the read-only RDS instances. This way, the loads on the primary RDS instance are reduced.

    Note

    This parameter appears only when you set the Read/Write Attribute parameter to Read/Write (Read/Write Splitting). For more information, see Use the transaction splitting feature.

    Read Weight Allocation

    The method that is used to assign read weights.

    • Automatic: The system automatically assigns a read weight to each RDS instance in your database system based on the specifications of the RDS instance. After you create a read-only RDS instance, the system automatically assigns a read weight to the read-only RDS instance and adds the read-only RDS instance to the read/write splitting link. You do not need to manually specify a read weight for the read-only RDS instance. For more information, see Default read weights.

    • Custom: You must specify the read weight of each read-only RDS instance. Valid values: 0 to 10000. After you create a read-only RDS instance, the system sets the read weight of the read-only RDS instance to 0. You must modify the read weight of the new read-only RDS instance.

    Note
    • A higher read weight indicates more read requests that need to be processed. For example, if the primary RDS instance has 3 read-only RDS instances whose read weights are 100, 200, and 200 and the read weight of the primary RDS instance is 0, the primary RDS instance processes only write requests and its read-only RDS instances process read requests at a ratio of 1:2:2.

    • You cannot specify weights for read-only RDS instances whose data replication latencies are specified. For more information, see Set the data replication latency of a read-only ApsaraDB RDS for MySQL instance Configure a data replication latency for a read-only ApsaraDB RDS for MySQL instance

    • After you modify this parameter, the new read weights immediately take effect. The modification does not cause service unavailability. The existing connections also remain valid. Only the requests that are sent over new connections are forwarded based on the new weights.

    • If you use RDS Cluster Edition, the read weights that you specify indicate the read weights of the primary and secondary nodes in the RDS cluster.

    • If you use RDS High-availability Edition, you must create at least one read-only RDS instance before you can specify read weights.

    • For more information about how to configure read and write attributes, see Configure the read and write attributes and the read weight of the database proxy.

  5. Click OK.

Note

You can configure persistent connection settings for a database proxy based on your business requirements. If you configure the settings such as enabling or disabling persistent connections, the setting takes effect on all database proxy endpoints of the RDS instance. The persistent connections keep the connections between the application and the database proxy of the RDS instance when an instance switchover occurs. Therefore, if your application connects to the database system over a database proxy endpoint, no disconnection errors occur during an instance switchover. For more information, see Configure persistent connection settings.

Create a database proxy endpoint (formerly proxy terminal)

Note
  • After you enable the database proxy feature, you can create database proxy endpoints to implement different read and write settings in different scenarios.

  • A single RDS instance supports up to seven database proxy endpoints.

  1. 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 instance ID.

  2. In the left-side navigation pane, click Database Proxy.

  3. In the Connection Information section, click Create Proxy Endpoint.

  4. In the dialog box that appears, configure the connection settings and click OK. For more information about the connection settings, see the preceding table.

References

Related operations

Operation

Description

DescribeDBProxy

Queries the details of the database proxy of an instance.

DescribeDBProxyEndpoint

Queries the connection settings for a database proxy endpoint that is connected to an instance.

ModifyDBProxyEndpoint

Modifies the settings of a database proxy endpoint that is connected to an instance.