This topic provides answers to frequently asked questions (FAQ) about the PolarDB database proxy.

Read/write splitting

  • Why am I unable to retrieve a record immediately after I insert the record?

    In a read/write splitting architecture, a replication latency 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 replication is completed. For more information, see Session consistency.

  • Can I read data from PolarDB without latency?

    No, you cannot read data from PolarDB immediately after the data is written. A latency in milliseconds occurs when you read data by using an endpoint that has read/write splitting enabled, even if the loads on the primary node and read-only nodes of a PolarDB cluster are not heavy. To read data without latency, you can connect to the primary endpoint and send read and write requests to the primary node of the PolarDB cluster. For information about how to query the primary endpoint, see View the endpoint and port.

  • Why do read-only nodes have low loads when the loads on the primary node are high?
    By default, requests in transactions are forwarded to only the primary node. In this case, you can try the following solutions:
    • If you use Sysbench for stress testing, you can add --oltp-skip-trx=on to your code for Sysbench 0.5 or add --skip-trx=on to your code for Sysbench 1.0. This skips 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 node receive more requests than others?

    Requests are distributed to each node based on loads. The nodes with lower loads receive more requests.

  • Does a new read-only node automatically receive read requests?

    Yes, if a session that supports read/write splitting is created after you add a read-only node, read requests are automatically forwarded to the read-only node. However, if a session that supports read/write splitting is created before you add a read-only node, read requests are not forwarded to the read-only node. To forward these read requests to the read-only node, you must close the connection and reconnect to the cluster. For example, you can restart your application to establish a new connection.

Cluster endpoints

  • What is the maximum number of single-node cluster endpoints that I can create in a cluster?

    You can create up to three custom cluster endpoints, including single-node cluster endpoints. For more information about how to create cluster endpoints, see Create a custom cluster endpoint.

    Warning However, if you create a single-node cluster endpoint for a read-only node and the read-only node becomes faulty, the single-node endpoint may be unavailable for up to one hour. We recommend that you do not create single-node endpoints in your production environment.
  • If a single-node 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 that is configured with a single-node endpoint cannot be automatically used as the new primary node after a failover. However, you can manually specify the read-only node as the new primary node. For more information, see Switch over services between primary and read-only nodes.

  • What is the maximum number of cluster endpoints for a cluster?

    A cluster can have a maximum of four cluster endpoints. One is the default cluster endpoint and the others are custom cluster endpoints.

  • Can I modify a cluster endpoint?

    Yes, you can modify the default cluster endpoint and custom cluster endpoints. For more information, see Modify a cluster endpoint.

  • Can I delete a cluster endpoint?

    Yes, you can delete a cluster endpoint. However, you can delete only custom cluster endpoints. You cannot delete the default cluster endpoint. For more information, see Delete a custom cluster endpoint.