Setting the Maximum Number of Connections in TiDB Version v3.0.12

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB最大连接数设置 版本v3.0.12

| username: 超7成网友

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?

| username: tidb菜鸟一只 | Original post link

I haven’t used 3.0, but isn’t this a MySQL parameter? It should be valid.

| username: zhanggame1 | Original post link

Sorry, I can’t translate images. Please provide the text you need translated.

| username: linnana | Original post link

6.5 is indeed the parameter max_connections. For 3.0, post the parameters to check: show global variables like ‘%connections%’

| username: xingzhenxiang | Original post link

There are parameters, but no matter what value is set, it doesn’t take effect.

| username: linnana | Original post link

The image you uploaded is not visible. Please provide the text you need translated.

| username: Anna | Original post link

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.

| username: Anna | Original post link

| username: redgame | Original post link

max-allowed-connections = 5000