Updated on 2025-08-21 GMT+08:00

Enabling Transaction Splitting for a Proxy Instance

Scenarios

In most cases, a proxy instance sends all requests in transactions to the primary node 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 load on the primary node.

With transaction splitting enabled for a proxy instance, the proxy instance can route read requests prior to write operations in a transaction to read replicas, reducing the load on the primary node.

Transaction splitting is disabled by default. After transaction splitting is enabled and autocommit is set to 0, TaurusDB starts a transaction only for write requests. Before the transaction starts, read requests are distributed to read replicas based on routing rules.

Principles

  • Transaction splitting disabled

    When transaction splitting is disabled, all requests in a transaction are routed to the primary node to guarantee read/write consistency.

  • Transaction splitting enabled

    After transaction splitting is enabled, the proxy instance distributes read requests before the first write in a transaction to a read replica. This reduces the load on the primary node.

Constraints

  • The kernel versions of proxy instances must be 2.3.9.5 or later. For details about how to check the kernel version, see How Can I Check the Version of a TaurusDB Instance?
  • Transaction isolation levels of TaurusDB instances must be READ UNCOMMITTED or READ COMMITTED.
  • Proxy instances must be in the read/write mode.
  • After transaction splitting is enabled, the transaction isolation level can only be changed to READ UNCOMMITTED or READ COMMITTED. To change the isolation level to a higher level, disable transaction splitting first.
  • After transaction splitting is enabled, read requests of the transactions committed using BEGIN cannot be routed to read replicas.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner of the page and choose Databases > TaurusDB.
  4. On the Instances page, click the instance name.
  5. In the navigation pane, choose Database Proxy.
  6. Click the name of a proxy instance.
  7. On the Basic Information page, click under Transaction Splitting.
  8. In the displayed dialog box, click OK.

    • To disable transaction splitting, click .
    • Transaction splitting takes effect only for new connections established after this function is enabled or disabled.

  9. On the Basic Information page of the proxy instance, check that transaction splitting is enabled.