All Products
Search
Document Center

PolarDB:PolarProxy

更新時間:Oct 24, 2024

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

Architecture

1

A PolarDB cluster of Cluster Edition consists of a primary node and multiple read-only nodes. By default, a PolarDB cluster provides two types of endpoints: a primary endpoint and cluster endpoints. Cluster endpoints are provided by PolarProxy. You can use the cluster endpoints in read/write (automatic read/write splitting) mode 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 edition can share physical CPU resources. Its CPU resources are allocated independently of those of the cluster. By default, the CPU cores allocated to this edition are equivalent to one sixth of the total number of CPU cores of the nodes in the cluster.

  • Dedicated Enterprise Edition is used by Dedicated clusters. This edition uses dedicated CPU resources and provides better stability. Its CPU resources are allocated independently of those of the cluster. By default, the CPU cores allocated to this edition are equivalent to one fourth of the total number of CPU cores of the nodes in the cluster.

The following table describes the differences between the two editions.

Item

Standard Enterprise Edition

Dedicated Enterprise Edition

Billing method

Free.

Resource type

Shared physical CPU resources that provide smart elastic scalability within seconds based on business loads.

Exclusive use of physical resources that provide better performance stability.

Architecture

High-availability redundant architecture.

Cluster specifications

Minimum specifications: 2 cores.

Connections

No limits.

IOPS

Compared with previous editions, the maximum IOPS of cluster storage is increased by 50%. For 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 of the read-only nodes and the primary node are not necessarily the same. You can downgrade configurations based on business loads to reduce costs.

Number of read-only nodes

Up to 15 read-only nodes.

Endpoint

One primary endpoint and seven cluster endpoints.

Failover with hot standby

The connections and transactions are not interrupted and are temporarily blocked for 5 to 10 seconds.

Consistency

  • Eventual consistency.

  • Session consistency.

  • Global consistency.

Connection pool

Supported.

Transaction splitting

Supported.

Interruption protection (persistent connections)

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 resource availability.

Proxy throttling protection (available soon)

Supported.

Billing

You can use PolarProxy Enterprise Edition free of charge.

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

Edition

Purchase type

Edition switching policies

Cluster 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 support cluster endpoints and PolarProxy.

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 you connect to a cluster by using a cluster endpoint, 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.

  • No limit is imposed on the maximum number of connections to a PolarDB cluster endpoint. The maximum number of connections varies based on the specifications of the compute nodes in the cluster. If an application connects to a cluster by using a cluster endpoint that supports read/write splitting, the application establishes a connection to each compute node in the cluster. In this case, the maximum number of connections that an application can use is the maximum number of connections of a single compute node. If an application connects to the cluster by using a cluster endpoint in read-only mode, the application establishes a connection to only one compute node in the cluster. In this case, the maximum number of connections that the application can use is the sum of the maximum numbers of connections of all read-only nodes associated with the cluster endpoint. For an application that connects to the cluster by using 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 the application can use. For more information, 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 multiple statements, 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 access 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 the endpoint information of a PolarDB cluster.

ModifyDBClusterEndpoint

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

ModifyDBEndpointAddress

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

DeleteDBEndpointAddress

Deletes a cluster endpoint of a PolarDB cluster. You cannot perform this operation to delete private custom cluster endpoints.

DeleteDBClusterEndpoint

Deletes a custom cluster endpoint of a PolarDB cluster.