Skip to content

Commit 428018f

Browse files
committed
Add connection lifetime limitation
1 parent 0dde37f commit 428018f

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

develop/dev-guide-connection-parameters.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,36 @@ It is a common practice that the connection pool size is well adjusted according
3434

3535
The application needs to return the connection after finishing using it. It is recommended that the application uses the corresponding connection pool monitoring (such as **metricRegistry**) to locate connection pool issues in time.
3636

37+
### Configure the lifetime of connections
38+
39+
When a TiDB server is shut down or restarted for maintenance or due to hardware failure, client connections may be reset, leading to application disruptions. It is recommended to close and reconnect long-running database connections at least once a day.
40+
41+
<SimpleTab>
42+
<div label="HikariCP">
43+
44+
- **maxLifetime**: The maximum lifetime of a connection in the pool.
45+
46+
</div>
47+
48+
<div label="tomcat-jdbc">
49+
50+
- **maxAge**: The maximum lifetime of a connection in the pool.
51+
52+
</div>
53+
54+
<div label="c3p0">
55+
56+
- **maxConnectionAge**: The maximum lifetime of a connection in the pool.
57+
58+
</div>
59+
60+
<div label="dbcp">
61+
62+
- **maxConnLifetimeMillis**: The maximum lifetime of a connection in the pool.
63+
64+
</div>
65+
</SimpleTab>
66+
3767
### Probe configuration
3868

3969
The connection pool maintains persistent connections from clients to TiDB as follows:
@@ -293,4 +323,4 @@ Ask the community on [Discord](https://discord.gg/DQZ2dy3cuc?utm_source=doc) or
293323

294324
Ask the community on [Discord](https://discord.gg/DQZ2dy3cuc?utm_source=doc) or [Slack](https://slack.tidb.io/invite?team=tidb-community&channel=everyone&ref=pingcap-docs), or [submit a support ticket](https://tidb.support.pingcap.com/).
295325

296-
</CustomContent>
326+
</CustomContent>

tidb-cloud/serverless-limitations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ We are constantly filling in the feature gaps between {{{ .starter }}}/Essential
2222

2323
- Only [Public Endpoint](/tidb-cloud/connect-via-standard-connection-serverless.md) and [Private Endpoint](/tidb-cloud/set-up-private-endpoint-connections-serverless.md) can be used. You cannot use [VPC Peering](/tidb-cloud/set-up-vpc-peering-connections.md) to connect to {{{ .starter }}} or {{{ .essential }}} clusters.
2424
- No [Firewall Rules](/tidb-cloud/configure-serverless-firewall-rules-for-public-endpoints.md) support for Private Endpoint.
25+
- Database client connections that remain open for more than 30 minutes may be terminated unexpectedly. When a server is shut down or restarted, client connections can be reset after this duration, resulting in application disruptions. It is recommended to start with a maximum connection lifetime of 15 minutes and extend it if you notice a negative impact on tail latency. Refer to the [recommended settings for connection pools](/develop/dev-guide-connection-parameters.md#connection-pools-and-connection-parameters) for additional information.
2526

2627
> **Note:**
2728
>

0 commit comments

Comments
 (0)