Updated on 2024-11-06 GMT+08:00

Enabling Transaction Splitting for a Proxy Instance

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, GaussDB(for MySQL) starts a transaction only for write requests. Before the transaction starts, read requests are routed to read replicas through load balancers.

Constraints

  • The kernel versions of proxy instances must be 2.3.9.5 or later.
  • Transaction isolation levels of GaussDB(for MySQL) instances must be READ UNCOMMITTED or READ COMMITTED. The default isolation level is REPEATABLE READ.
  • 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.

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, choose Databases > GaussDB(for MySQL).
  4. On the Instances page, click the instance name to go to the Basic Information page.
  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.

    Figure 1 Configuring transaction splitting

  8. In the displayed dialog box, click Yes.

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