PolarDB supports transaction splitting. This feature ensures data consistency in a session and allows PolarDB to send read requests to read-only nodes to reduce the loads on the primary node.
If you use a PolarDB cluster endpoint in read/write mode, the proxy forwards read and write requests to the primary node and read-only nodes. To ensure data consistency of transactions in a session, the proxy sends all requests in transactions of the session to the primary node. For example, database client drivers, such as the Java Database Connectivity (JDBC), encapsulate requests in a transaction. In this case, all requests from applications are sent to the primary node. This results in heavy loads on the primary node. However, no request is sent to read-only nodes, as shown in the following figure.
To fix this issue, PolarDB supports the transaction splitting feature. This feature ensures data consistency in a session and allows PolarDB to send read requests to read-only nodes to reduce the loads on the primary node.
This feature allows you to reduce the read loads on the primary node without the need to modify the code or configurations of your applications. This improves the stability of the primary node.
- Only transactions that use the Read Committed isolation level can be split.
- If you enable basic transaction splitting and the consistency level is not set to eventual consistency, the proxy sends the read requests that are received before the first write request in a transaction to read-only nodes only after read-only nodes synchronize all data from the primary node. Otherwise, the proxy still sends read requests to the primary node. For more information about consistency levels, see Consistency levels.