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
- Log in to the management console.
- Click
in the upper left corner and select a region and project.
- Click
in the upper left corner of the page and choose Databases > TaurusDB.
- On the Instances page, click the instance name.
- In the navigation pane, choose Database Proxy.
- Click the name of a proxy instance.
- On the Basic Information page, click
under Transaction Splitting.
- 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.
- To disable transaction splitting, click
- On the Basic Information page of the proxy instance, check that transaction splitting is enabled.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot