Updated on 2024-10-14 GMT+08:00

Configuring Transaction Splitting

Scenarios

In most cases, an RDS for MySQL proxy instance sends all requests in transactions to the primary DB instance to ensure transaction correctness. However, in some frameworks, all requests are encapsulated into transactions that are not automatically committed using set autocommit=0. This causes heavy loads on the primary DB instance.

Function

Database proxies support transaction splitting. With this feature enabled, RDS can route the read requests prior to write operations in a transaction to read replicas, reducing the pressure of the primary DB instance.

Transaction splitting is disabled by default. If it is enabled under the default READ COMMITTED transaction isolation, RDS only starts a transaction for write operations when automatic commit is disabled. Before the transaction starts, read requests are routed to read replicas through load balancers.

Precautions

  • Enabling transaction splitting affects global consistency of certain workloads. Before enabling this feature, evaluate its impact on your workloads.
  • All proxies of your DB instance must be in the Available state.
  • Before enabling transaction splitting, you need to upgrade the database proxy to the latest version because the transaction processing logic has been optimized in the latest version.
  • After transaction splitting is enabled, read requests of the transactions committed using BEGIN cannot be routed to read replicas.
  • After transaction splitting is enabled, read requests of transactions started using SET AUTOCOMMIT = 0 cannot be routed to read replicas.

Configuring Transaction Splitting

Contact customer service to disable or enable transaction splitting at any time if necessary.

Transaction splitting takes effect only for connections established after this feature is enabled or disabled.

  1. Log in to the management console.
  2. Click in the upper left corner and select a region.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the primary instance name.
  5. In the navigation pane on the left, click Database Proxy.
  6. On the displayed page, click next to Transaction Splitting.
  7. In the displayed dialog box, click OK.