All Products
Search
Document Center

PolarDB:PolarProxy

Last Updated:Mar 14, 2024

PolarProxy serves as a proxy between a database and an application in a PolarDB cluster. It receives and routes all requests from the application. PolarProxy supports advanced features, such as automatic read/write splitting, load balancing, consistency level, connection pool, and overload protection. PolarProxy is easy to use and maintain, and provides high-availability and high-performance services. You can connect to PolarDB cluster endpoints to use the features of PolarProxy.

Architecture

1

A PolarDB cluster of Cluster Edition or X-Engine Edition consists of a primary node and multiple read-only nodes. By default, PolarDB provides two types of endpoints: the primary endpoint and cluster endpoints. The cluster endpoints are provided by PolarDB PolarProxy. The cluster endpoints can be in read/write (automatic read/write splitting) or read-only mode.

PolarProxy Enterprise Editions

The following PolarProxy Enterprise Editions are available: Standard Enterprise Edition and Dedicated Enterprise Edition.

  • Standard Enterprise Edition is used by General-purpose clusters. This PolarProxy edition uses shared CPU resources, which are one sixth of the total number of CPU cores among the nodes in a PolarDB for MySQL cluster.

  • Dedicated Enterprise Edition is used by Dedicated clusters. This PolarProxy edition uses dedicated CPU resources and provides better stability. The CPU cores used by this edition are one fourth of the total number of CPU cores among the nodes in a PolarDB for MySQL cluster.

The following table describes the differences between the two editions.

Item

Standard Enterprise Edition

Dedicated Enterprise Edition

Billing method

Free of charge

Resource type

Shared CPU physical resources with smart elastic scalability within seconds provided based on business loads.

Exclusive use of physical resources with better performance stability provided.

Architecture

High-availability redundant architecture

Cluster specifications

Minimum specifications: 2 cores.

Performance

Compared with previous editions, the maximum IOPS of cluster storage is increased by 50%. For more information about the maximum IOPS of different cluster specifications, see Compute node specifications of PolarDB for MySQL Enterprise Edition.

Read-only node specifications

The configurations are not necessarily consistent between the read-only nodes and the primary nodes. You can downgrade configurations based on business loads to save costs.

Number of read-only nodes

Up to 15 read-only nodes.

Network information

One primary endpoint and seven cluster endpoints.

Failover with hot standby

Connection and transaction not interrupted and brief block of 5 to 10 seconds.

Consistency

  • Eventual consistency.

  • Session consistency.

  • Global consistency.

Connection pool

Supported.

Transaction splitting

Supported.

Interruption protection (connection retention)

Supported.

Data masking (for security)

Supported.

Business stability during configuration change

Supported.

Multi-master Cluster (Database/Table)

Supported.

Compute node scale-out within seconds

Supported.

Exclusive use of resources to ensure sufficient resources.

Proxy throttling protection (available soon)

Supported.

Billing

PolarProxy Enterprise Edition is provided free of charge.

The following table describes the edition switchover policies for PolarProxy Enterprise Edition.

Edition

Purchase type

Edition switchover policies

Single Node Edition

PolarProxy Enterprise Edition is not supported.

Cluster Edition and X-Engine Edition

Newly purchased cluster

As of December 9, 2021, newly purchased clusters only support PolarProxy Enterprise Edition.

Existing pay-as-you-go cluster

For existing subscription clusters, PolarProxy is switched to PolarProxy Enterprise Edition automatically on December 9, 2021.

Existing subscription cluster

For existing subscription clusters, PolarProxy is switched to PolarProxy Enterprise Edition automatically on December 9, 2021.

Limits

Only clusters of PolarDB Cluster Edition and X-Engine Edition support cluster endpoints and PolarProxy. Clusters of PolarDB Single Node Edition use a single-node architecture, and do not support PolarProxy and cluster endpoints.

Usage notes

  • PolarProxy does not support compression protocols for the default and custom cluster endpoints.

  • If you do not enable the transaction splitting feature after cluster endpoints are used, all the requests in a transaction are forwarded to the primary node.

  • When you execute the SHOW PROCESSLIST statement after cluster endpoints are used, the system returns the results of all nodes.

  • If you execute multi-statement or call stored procedures, all subsequent requests for the current connection are forwarded to the primary node. To use the read/write splitting feature, you must close the current connection and reconnect to the cluster.

  • The maximum number of connections to a PolarDB cluster endpoint is not limited. The maximum number of connections depends on the specifications of compute nodes in backend databases. For a cluster endpoint that supports read/write splitting, an application establishes a connection to each compute node in the backend database. Therefore, the maximum number of connections that an application can use is the maximum number of connections of a single compute node. For a cluster endpoint in read-only mode, an application connection establishes a connection to only one compute node in the backend database. The maximum number of connections that an application can use is the sum of the maximum numbers of connections for all read-only nodes. For a cluster endpoint in read/write splitting mode, you can use the transaction-level connection pool feature to increase the maximum number of connections that an application can use. For more information about this feature, see the "Transaction-level connection pools" section of the Connection pools topic.

  • If a session that supports read/write splitting is created after you add or restart a read-only node, read requests are forwarded to the read-only node. If a session that supports read/write splitting is created before you add or restart 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.

  • Do not modify environment variables when you call stored procedures or execute multi-statement, such as set names utf8mb4;select * from t1;. Otherwise, the data read from the primary node and read-only nodes is inconsistent.

  • To prevent the application connection pool from being hung due to packet loss caused by network issues or other unexpected scenarios when you use the application connection pool feature to connect to a URL, we recommend that you add the connectTimeout and socketTimeout parameters to the URL. For more information about the parameters, see Parameters. Example:

    java url: jdbc:mysql://ip:port/db?connectTimeout=60000&socketTimeout=300000;

Upgrade the specifications of PolarProxy

The default specifications of PolarProxy Enterprise Edition are sufficient for most application scenarios. When you perform stress tests or the service throughput is high, the specifications of PolarProxy Enterprise Edition are automatically upgraded in real time based on the workloads of PolarProxy to meet your business requirements. You can also manually upgrade the specifications pf PolarProxy of previous versions.

Note
  • PolarProxy in a cluster does not use the CPU cores of the cluster. Therefore, the upgrade of PolarProxy specifications does not reduce the number of available CPU cores in the cluster.

  • PolarProxy Enterprise Edition is provided free of charge. Therefore, no costs are incurred during upgrades for PolarProxy specifications.

For more information about how to upgrade the specifications of PolarProxy, see Upgrade the specifications of PolarProxy.

Related API operations

Operation

Description

CreateDBEndpointAddress

Creates a public endpoint for a PolarDB cluster.

CreateDBClusterEndpoint

Creates a custom endpoint for a PolarDB cluster.

DescribeDBClusterEndpoints

Queries endpoint information about a PolarDB cluster.

ModifyDBClusterEndpoint

Modifies the configurations of a cluster endpoint for a PolarDB cluster.

ModifyDBEndpointAddress

Modifies the endpoints such as custom cluster endpoints of a PolarDB cluster.

DeleteDBEndpointAddress

Deletes a cluster endpoint of a PolarDB cluster. This operation cannot be used to release private custom cluster endpoints.

DeleteDBClusterEndpoint

Deletes a custom cluster endpoint for a PolarDB cluster.