This document describes considerations for the TDSQL-C for MySQL database proxy.
When the proxy connection address is used, if transaction split is not enabled, transaction requests will be routed to the primary instance.
Database proxy configuration supports cross-AZ. The number of selectable AZs is related to the number of available AZs in the current region, with a maximum of four AZs selectable. When the number of available AZs is one, it indicates that there is only one available AZ in the current region.
Multiple database proxy access addresses can be set, and the number of such addresses is the same as the number of database proxy nodes. That is, you can set as many database proxy access addresses as there are nodes.
When the proxy connection address is used for read-write separation, consistency for non-transactional reads is not guaranteed. If business operations require read consistency, it can be achieved by encapsulating reads within transactions or by using Hint syntax.
When the proxy connection address is used, show processlist will merge the results from all nodes and return them.
For prepare statements, the database proxy first sends the prepare to all nodes. When a subsequent execute request arrives, it determines the routing of the execute request based on the statement type in prepare. For example, if a write statement is prepared, the execute will be sent to the primary instance. While if a read statement outside a transaction is prepared, it will be sent to a read-only instance.
After business connections reach the database proxy, the proxy connects to the read-write instance and all configured read-only instances. The database proxy itself has no restriction on the maximum number of connections. The connection limit is primarily determined by the maximum number of connections of the backend database instances (the minimum value of the maximum connections for read-write and read-only instances will affect business performance).
After the database proxy is enabled, when a new read-only instance is added or a read-only instance is restarted, only new connection requests will be routed to the new or restarted read-only instance. You can view the performance metrics of each proxy node via the overview or performance monitoring. If an imbalance in the number of connections across proxy nodes is detected, you can rebalance the load to distribute the connections. The database proxy feature can only be enabled in Serverless services when the automatic start-stop capability is disabled.
The read-only analysis engine is added to the database proxy with a default weight of 0, which cannot be modified. SQL can only be forwarded to the read-only analysis engine using the syntax /*to server instance ID*/.
When the database proxy is connected to using the JDBC driver version mysql-connector-j-8.0.32.jar, the connection may hang when using prepare. Therefore, we recommend that you do not use the JDBC driver version mysql-connector-j-8.0.32.jar to connect to the database proxy. Instead, we recommend using the mysql-connector-j-8.0.33.jar version. This issue relates to an official MySQL Bug, as documented in Bug#109864.