This document describes the database proxy capability of TDSQL-C for MySQL. Compared to traditional databases with multiple RO groups, the key advantage of TDSQL-C MySQL is that it reduces the load on the source instance.
Support multiple independent database proxy connection addresses
In traditional databases, a maximum of two RO groups can be created for a database, which may not be enough to meet the demands of various business loads. However, in TDSQL-C or MySQL, the database proxy feature allows for the creation of as many proxy connection addresses as there are nodes. The current database version supports up to four nodes.
Support mounting with the read-write instance
In traditional databases, read-only instances can only be mounted within the RO group and cannot be mounted with the read-write instance. However, in TDSQL-C for MySQL, the read-only instances can be mounted with the read-write instance at each database proxy address. This allows for access balancing to both the read-write instance and the read-only instances through the proxy address.
Support transaction split
The TDSQL for MySQL database proxy provides the transaction split feature. This feature separates read and write operations in one transaction to different instances for execution and forwards read requests to read-only instances, thereby lowering the load of the source instance.
Support session-level connection pool
The TDSQL-C for MySQL database proxy supports the session-level connection pool feature. It can effectively solve the problem of excessively high database instance loads caused by frequent establishments of new non-persistent connections. If a client connection is closed, the system will determine whether the current connection is idle, and if so, the system will put it into the proxy connection pool and retain it for a short period of time, which is five seconds by default and can be customized. For more information, see Setting Session-Level Connection Pool. Support load rebalancing
After enabling the database proxy, you can view Connections in the proxy node list or view the performance monitoring data of each proxy node to check whether the numbers of connections on the nodes are unbalanced. If there are a large number of persistent connections in the business, adding more database proxy nodes may result in uneven node loads. If there is an imbalance in the connection count among the proxy nodes, you can redistribute the connections through load balancing to achieve a more balanced distribution.
Support setting consistency levels
When there are data updates on the read-write instance, the updates will be applied to the read-only instances. The delay in data sync depends on the write workload. To ensure the consistency requirements of accessing database data, TDSQL-C for MySQL provides three different consistency levels as follows.
Eventual consistency: Data can achieve eventual consistency, ensuring that read-only instances can read the updated data. All updated data can be obtained eventually, but immediate access is not guaranteed. Due to the delay in source-replica replication, the results obtained from different nodes may differ when querying the updated data.
Session consistency: This guarantees monotonic reads in the same session, and the data updated before the execution of a read request can be queried.
Global consistency: In the same session, the data updated before the execution of a read request can be queried. Besides, the query results are consistent for requests sent through different connections.
Support setting access mode
You can set an access mode to control the connection link between the application/client and the database proxy. There are two access modes for your choice: load balancing and nearby access. The load balancing mode achieves balanced distribution of traffic, eliminating the issue of a single node being overloaded. In nearby access mode, the application connects to the database proxy node that is in the same AZ or closest to it. If there are multiple proxy nodes in the same AZ, the application will still choose the one that is closest to it. This mode has the benefits of low latency and fast speed.
Was this page helpful?