This topic describes how to enable and disable the transaction splitting feature that is provided in the database proxy of a primary ApsaraDB RDS for MySQL instance. This feature allows ApsaraDB RDS to route the read requests prior to write operations in a transaction to the read-only RDS instances of your database system. This reduces the loads on the primary RDS instance.

Prerequisites

Background information

By default, the dedicated proxy sends all requests that are encapsulated in transactions to the primary RDS instance. This ensures the correctness of the transactions. However, in some frameworks, the autocommit mode is disabled by using the set autocommit=0; command. As a result, all requests are encapsulated in the transactions that are not automatically committed. This causes heavy loads on the primary RDS instance. In this case, you can enable the transaction splitting feature.

By default, the transaction splitting feature is enabled with the default isolation level READ COMMITTED. If the autocommit mode is disabled, ApsaraDB RDS starts a transaction only for write operations. In addition, before the transaction starts, ApsaraDB RDS routes all read requests to the read-only RDS instances by using a load balancer.

Note
  • Explicit transactions cannot be split. These explicit transactions include the transactions that are started by using BEGIN or START statements.
  • After you enable the transaction splitting feature, global consistency cannot be ensured. Before you enable this feature, we recommend that you evaluate whether this feature is suitable for your workloads.
Transaction splitting diagram

Procedure

You can enable or disable the transaction splitting feature based on your business requirements.

  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. On the Proxy Terminal (Original Read/Write Splitting) tab, click Enable or Disable to the right of Transaction Splitting.
    Note After you enable or disable the transaction splitting feature, the new setting is applied only to new connections.

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.