PolarProxy serves as a proxy in a PolarDB cluster. This topic describes the features of PolarProxy.
PolarDB architecture and PolarProxy overview
A standard PolarDB cluster consists of a primary node and one or more read-only nodes. By default, PolarDB provides two types of endpoints: primary endpoints and cluster endpoints. PolarDB PolarProxy supports the cluster endpoint feature. Cluster endpoints include read/write endpoints and read-only endpoints. Read/write endpoints support read/writing splitting. For more information, see Read/write splitting. Read-only endpoints enable PolarDB clusters to evenly distribute read requests to read-only nodes based on the number of connections.
PolarDB clusters provide read/write splitting. This feature enables PolarDB clusters to distribute read and write requests from applications by using cluster endpoints. The built-in proxy of a PolarDB cluster forwards write requests to the primary node, and forwards read requests to the primary node or read-only nodes based on the loads. The number of requests that are not processed on a node indicates the loads on the node. For more information, see Read/write splitting.
- Why am I unable to retrieve a record immediately after I insert the record?
This is because in a read/write splitting architecture, a replication delay may occur during data replication between the primary node and read-only nodes. However, PolarDB supports session consistency. This allows you to query the updates within a session. Therefore, you can retrieve the inserted record after the data replication is completed.
- Why do read-only nodes have no workloads?
By default, requests in transactions are routed to only the primary node. If you use sysbench for stress testing, you can add
--oltp-skip-trx=onfor sysbench 0.5 to your code or add
--skip-trx=onto your code for sysbench 1.0. This skips BEGIN and COMMIT statements. If a large number of transactions cause excessively low workloads on read-only nodes, you can submit a ticket to enable the transaction splitting feature.
- Why does a node receive more requests than other nodes?
Requests are distributed to each node based on workloads. The node that has low workloads receives more requests.
- Does PolarDB support zero-latency data access?
No, PolarDB does not support zero-latency data access. If the primary node and read-only nodes of a PolarDB cluster process normal workloads, a replication delay is in milliseconds when data is replicated between the primary node and read-only nodes. If the read/write mode of a cluster endpoint is Read and Write (Automatic Read-write Splitting), PolarDB does not support zero-latency data access. If you require zero-latency data access, you can connect your applications to the primary endpoint so that all the read and write requests can be sent to the primary node of the PolarDB cluster.
- Are new read-only nodes automatically available to receive read requests?
Yes, a read/write splitting connection that is created after a read-only node is added forwards requests to the read-only node. Assume that the read/write splitting connection is created before a read-only node is added. If you need the connection to forward requests to the new read-only node, you must restart the application or perform other operations to close the connection and reestablish a connection.
Related API operations
|CreateDBEndpointAddress||Creates a public endpoint for a specified PolarDB cluster.|
|CreateDBClusterEndpoint||Creates a custom cluster endpoint for a specified PolarDB cluster.|
|DescribeDBClusterEndpoints||Queries the endpoint information about a specified PolarDB cluster.|
|ModifyDBClusterEndpoint||Modifies the configurations of a cluster endpoint for a specified PolarDB cluster.|
|ModifyDBEndpointAddress||Changes the endpoints of a specified PolarDB cluster, such as a custom cluster endpoint.|
|DeleteDBEndpointAddress||Releases the public-facing endpoint of the primary endpoint, the default cluster endpoint, or a custom cluster endpoint for a specified PolarDB cluster.|
|DeleteDBClusterEndpoint||Deletes a custom cluster endpoint for a specified PolarDB cluster.|