This topic provides answers to frequently asked questions (FAQ) about PolarProxy provided by PolarDB.
Read/write splitting
Why am I unable to retrieve a record immediately after I insert the record?
In a read/write splitting architecture, a delay occurs when data is being replicated among the primary node and read-only nodes. PolarDB supports session consistency to ensure that you can query updates within a session. You can retrieve the inserted record after the replication is complete. For more information, see the "Session consistency" section in Consistency levels.
Can data be read immediately after it is written into PolarDB?
No, data cannot be read immediately after the data is written into PolarDB. A delay of a few milliseconds occurs when you read data by using an endpoint for which read/write splitting is enabled, even if the loads on the primary node and read-only nodes of a PolarDB cluster are not heavy. To eliminate this delay, you can use the primary endpoint to connect to the PolarDB cluster. This way, read and write requests are sent to the primary node. For more information about how to view the primary endpoint, see View or apply for an endpoint.
Why do low loads exist on read-only nodes when the loads on the primary node are high?
By default, requests in transactions are routed only to the primary node. To balance loads across the primary and read-only nodes, you can use the following solutions:
When you perform stress tests by using Sysbench, specify
--oltp-skip-trx=on
in the code if the version of Sysbench is 0.5 or--skip-trx=on
if the version of Sysbench is 1.0. This way, you do not need to execute the BEGIN and COMMIT statements.If a large number of transactions cause heavy loads on the primary node, you can enable the transaction splitting feature to reduce the loads on the primary node. For more information, see Transaction splitting.
Why does a specific node receive more requests than other nodes?
Requests are distributed to each node based on loads. The nodes on which lighter loads exist receive more requests.
Does a new read-only node automatically receive read requests?
This depends on whether a session that supports read/write splitting is created after you add a read-only node. If yes, requests are automatically forwarded to the read-only node. If no, read requests are not forwarded to the read-only node. In this case, you can close a connection and then reconnect to your cluster. This way, read requests sent over the connection are forwarded to the read-only node. For example, you can restart your application to establish a new connection.
Cluster endpoints
If a single-node cluster endpoint is created for a read-only node, can the read-only node be used as the new primary node after a failover?
The read-only node for which a single-node cluster endpoint is created cannot be automatically used as the new primary node after a failover. However, you can manually promote the read-only node as the new primary node. For more information, see Automatic failover and manual failover.
Can I modify a cluster endpoint?
Yes, you can modify the default cluster endpoint and custom cluster endpoints. For more information, see Modify a custom cluster endpoint.
Can I delete a cluster endpoint?
Yes, you can delete only custom cluster endpoints. You cannot delete the default cluster endpoint. For more information, see Release a custom cluster endpoint.