Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: TiDB最大连接数设置 版本v3.0.12
As the topic suggests: How to control the number of client connections to TiDB?
I see that this version has max_connections, is this effective?
I haven’t used 3.0, but isn’t this a MySQL parameter? It should be valid.
Sorry, I can’t translate images. Please provide the text you need translated.
6.5 is indeed the parameter max_connections. For 3.0, post the parameters to check: show global variables like ‘%connections%’
There are parameters, but no matter what value is set, it doesn’t take effect.
The image you uploaded is not visible. Please provide the text you need translated.
It is common for applications to configure an appropriate connection pool size based on their own situation. Taking HikariCP as an example:
maximumPoolSize
: The maximum number of connections in the connection pool. If configured too large, TiDB will consume resources to maintain useless connections. If configured too small, the application will be slow to obtain connections. Therefore, it is necessary to configure an appropriate value based on the characteristics of the application. You can refer to this article.
minimumIdle
: The minimum number of idle connections in the connection pool. This is mainly used to retain some connections during application idle times to handle sudden requests. It also needs to be configured according to the business situation.
When using a connection pool, applications need to pay attention to returning the connection after use. It is recommended that applications use the corresponding connection pool-related monitoring (such as metricRegistry
). Through monitoring, connection pool issues can be located in a timely manner.
max-allowed-connections = 5000