This topic introduces the transaction splitting function provided by ApsaraDB RDS for MySQL in its dedicated proxy feature. This function reduces the loads on the primary instance by identifying and distributing the read requests initiated prior to write requests within a transaction to read-only instances.

Prerequisites

For more information, see Dedicated proxy.

Background information

By default, the dedicated proxy sends all requests encapsulated in transactions to the primary instance to ensure the correctness of the transactions. If the framework used encapsulates all requests in transactions, the primary instance becomes heavily loaded. In such cases, you can enable the transaction splitting function.

In the default transaction isolation level READ COMMITTED, after ApsaraDB RDS MySQL turns off automatic transaction commit (set autocommit = 0), Read requests initiated before the transaction is started are distributed to read-only instances by using the SLB module.

Note
  • Explicit transactions (for example, begin or start transcation) do not support transaction splitting.
  • If you enable transaction splitting, global consistency cannot be ensured for some services. We recommend that you evaluate whether transaction splitting is suitable for your business before you enable it.
事务拆分

Procedure

  1. Log on to the ApsaraDB for RDS console.
  2. In the upper-left corner of the page, select the region where the target RDS instance resides.
    Select a region
  3. Find the target RDS instance and click its ID.
  4. In the left-side navigation pane, click Database Proxy.
  5. In the Proxy Endpoint section of the Proxy Service tab, click Enable to the right of Transaction Splitting.
    Note
    • When you no longer need transaction splitting, you can click Disable to the right of Transaction Splitting to disable it.
    • After you enable or disable transaction splitting, the setting only works for new connections.