This topic answers frequently asked questions (FAQs) about the PolarDB database proxy.
Why can't I immediately read a statement right after inserting it?
In a read/write splitting architecture, replication between the primary node and read-only nodes introduces latency. However, PolarDB supports session consistency, which ensures that you can read your previous updates within the same session. For more information, see Session consistency.
Does PolarDB support 0-millisecond read latency?
Under a normal load, the replication latency between the primary node and read-only nodes in a PolarDB cluster is in the millisecond range. Read/write splitting endpoints do not support reads with zero latency immediately after a write. To achieve zero-latency reads, you can use the primary endpoint to send both read and write requests to the primary node. The primary endpoint dynamically points to the primary node of the PolarDB cluster. For instructions on how to view the primary endpoint, see View endpoints and ports.
Why is the CPU load on the primary node high?
A high CPU load on the primary node can be caused by several factors. You can perform the following steps to troubleshoot the issue:
Your application may be connecting directly to the primary endpoint. Check your application configuration to confirm.
The primary node may be under heavy pressure if your workload contains significantly more write requests than read requests.
If Primary Database Accepts Read Requests is set to Yes for the proxy endpoint, you can change Primary Database Accepts Read Requests to No to reduce the read load on the primary node.
Check if Transaction splitting is enabled for the proxy endpoint. Some ORMs wrap all requests in transactions by default, which routes all requests to the primary node. You can enable Transaction splitting to route read-before-write requests in transactions away from the primary node.
If you are running Sysbench stress tests, you can add the --oltp-skip-trx=on parameter for Sysbench 0.5 or the --skip-trx=on parameter for Sysbench 1.0 to disable transactions before you run a test. For more information about load balancing policies and transaction splitting, see Load balancing.
Why does one node receive more requests than others?
Requests are distributed based on node load. Nodes with a lower load receive more requests.
Are newly added read-only nodes automatically included in read/write splitting?
Yes.
Does setting the database consistency level to global consistency (strong) instead of eventual consistency (weak) or session consistency (medium) affect performance?
Global consistency (strong) causes some performance loss compared to eventual consistency (weak) and session consistency (medium). If your workload requires high concurrency, we recommend that you change the consistency level during off-peak hours.
What is the difference between Standard Enterprise Edition and Dedicated Enterprise Edition of PolarProxy Enterprise Edition?
Standard Enterprise Edition: This edition corresponds to the General-purpose instance type in a cluster. It shares physical CPU resources and provides intelligent, second-level elastic scaling based on workload.
Dedicated Enterprise Edition: This edition corresponds to the Dedicated instance type for clusters. It exclusively uses physical CPU resources and provides enhanced performance stability.
Does removing a selected read-only node from a cluster endpoint affect applications?
If you remove a read-only node from a cluster endpoint that is in read/write splitting mode, active connections to that endpoint are disconnected if the node has ongoing requests, transactions, or temporary tables. Otherwise, your applications are not affected.
If you remove a read-only node from a cluster endpoint that is in read-only mode, active connections to that endpoint are disconnected.
For more information about the impact of removing read-only nodes, see Take a read-only node offline.
What read/write modes does PolarDB support?
Currently, PolarDB cluster and custom endpoints support two read/write modes: read-only and read/write (automatic read/write splitting).
Read-only mode: All requests are routed exclusively to read-only (RO) nodes. The read/write (RW) node cannot be attached to a read-only endpoint. If an application attempts to perform a write operation using a read-only endpoint, an error is returned. This mode supports load balancing based on the number of connections and active requests.
Read/write mode: The system automatically enables read/write splitting and attaches the RW node by default. This mode supports load balancing based only on the number of active requests.
Changing the read/write mode affects only new connections. Existing connections are not affected. For more information about the configuration, see Configure database proxy.
Why does Binlog dump return the error "Connections-based load balancing policy does not support BINLOG_DUMP in non-block mode"?
Read-only endpoints that use a load balancing policy based on connection count do not support pulling binary log (binlog) files in non-block mode. To resolve this issue, you can go to the console and change the load balancing policy of the read-only endpoint to be based on the active request count.
How are database proxy versions 1.x.x and 2.x.x determined?
Currently, the PolarDB for MySQL database proxy includes two major versions: 1.x.x and 2.x.x. Their differences are as follows:
1.x.x
This version applies to clusters that were created before February 1, 2021. This version is a legacy version that receives only bug fixes. No new features are developed for this version.
2.x.x
This version applies to clusters that were created on or after February 1, 2021. This is the current mainstream version and receives all new features, such as persistent connections and data masking.
Can I upgrade the database proxy version from 1.x.x to 2.x.x by performing a minor version upgrade in the console?
No, you cannot. Database proxy version 1.x.x can be upgraded only to the latest version in the 1.x.x series. You cannot directly upgrade it to 2.x.x. If you want to perform this upgrade, see Upgrade database proxy version from 1.x.x to 2.x.x.
Can the database proxy version be upgraded from 1.x.x to 2.x.x?
Yes, it can, but your cluster must meet the following requirements:
If your cluster runs PolarDB for MySQL version 8.0.2, there is no kernel version requirement.
If your cluster runs PolarDB for MySQL version 8.0.1, the revision version must be 8.0.1.1.10 or later.
If your cluster runs PolarDB for MySQL version 5.7, the revision version must be 5.7.1.0.6 or later.
If your cluster runs PolarDB for MySQL version 5.6, the revision version must be 5.6.1.0.24 or later.
If your cluster meets these requirements, contact us for assistance.
When performing a major engine version upgrade in the console, is the database proxy version automatically upgraded to 2.x.x?
Yes, it is. During a major engine version upgrade, the database proxy version is automatically upgraded to 2.x.x. You cannot set the version to 1.x.x.
Why does setting a read-only node's weight to 0 in a cluster endpoint and then removing it cause connection errors?
Scenario: You want to remove a read-only node from a cluster endpoint. To prevent service disruptions, you first set the read/write splitting weight of the node to 0. You expect that new read requests are no longer sent to the node. However, your application still reports connection errors after you remove the node.
Cause: Cluster endpoints support two Load Balancing Policy: Active Request-based Load Balancing and Connections-based Load Balancing.
Active Request-based Load Balancing: After you set the weight of a read-only node to 0, new requests are no longer routed to the node.
Connections-based Load Balancing: Load balancing is performed only when a connection is established. If a connection is already established with a read-only node, all subsequent requests over that connection are still sent to that node.
Solution:
Change the Load Balancing Policy of the cluster endpoint to Active Request-based Load Balancing.
Set the read/write splitting weight of the read-only node that you want to remove to 0.
Remove the read-only node.