Updated on 2025-03-28 GMT+08:00

Configuring Transaction Splitting

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 loads on the primary node.

Constraints

  • The kernel version of the proxy instances must be 2.3.9.5 or later.
  • Transaction splitting is only available for instances whose translation isolation level is READ UNCOMMITTED or READ COMMITTED. The default isolation level is REPEATABLE READ.
  • To enable transaction splitting, the proxy mode must be set to read/write.
  • After transaction splitting is enabled, read requests of the transactions submitted using BEGIN cannot be routed to read replicas.
  • After transaction splitting is enabled, read requests of the transactions started using SET AUTOCOMMIT = 0 cannot be routed to read replicas once the transactions are committed.

Function

Proxy instances support transaction splitting. With transaction splitting is enabled, GaussDB(for MySQL) can route the read requests prior to write operations in a transaction to read replicas, reducing the pressure on the primary node.

Transaction splitting is disabled by default.

After transaction splitting is enabled and autocommit is set to 0, GaussDB(for MySQL) starts a transaction only for write requests. Before the transaction starts, read requests are routed to read replicas through load balancers.

Precautions

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 the function.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page, choose Database > GaussDB(for MySQL).
  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 next to Transaction Splitting.

  8. In the displayed dialog box, click Yes.

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