TiDB 5.3.0 Recently Reports Connection Failure

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

Original topic: TiDB5.3.0最近报错连接失败

| username: TiDBer_XsS0xKSu

Recently, there have been frequent errors and connection failures. I checked the resources, and the CPU and IO are normal.

| username: TiDBer_XsS0xKSu | Original post link

Have any of you encountered this problem? How did you solve it?

| username: songxuecheng | Original post link

This looks like a network issue.

| username: ti-tiger | Original post link

The connection between the TiDB server and your application timed out or was interrupted. This could be due to network issues or server configuration problems. Check the transaction isolation level. If it is REPEATABLE-READ, you can try changing it to READ-COMMITTED, which might avoid the connection timeout issue.

| username: Miracle | Original post link

Communication link failure is really a troublesome issue, very difficult to troubleshoot…
It could be caused by the database layer, network layer, or application layer…

| username: 像风一样的男子 | Original post link

What load balancer are you using?

| username: 大飞哥online | Original post link

Ping a large packet, run it overnight, and see if there is any packet loss.

| username: TiDBer_XsS0xKSu | Original post link

Default

| username: 像风一样的男子 | Original post link

Directly connecting to TiDB without load balancing?

| username: TiDBer_XsS0xKSu | Original post link

Did not implement load balancing.

| username: 像风一样的男子 | Original post link

Check the load and latency of the data during that time period on the dashboard.

| username: TiDBer_XsS0xKSu | Original post link

Is it to modify the system configuration file?

| username: TiDBer_XsS0xKSu | Original post link

The operations team looked at it and said it’s not high. Would adding load balancing help?

| username: 像风一样的男子 | Original post link

How many TiDB nodes do you have? Usually, you need to add a load balancer, otherwise, all connections directly connecting to a single TiDB node is very wasteful.

| username: TiDBer_XsS0xKSu | Original post link

Let’s try load balancing.

| username: ti-tiger | Original post link

Just like MySQL, it also uses SET TRANSACTION https://docs.pingcap.com/zh/tidb/stable/sql-statement-set-transaction#set-transaction

| username: TiDBer_XsS0xKSu | Original post link

There is load balancing :rofl:

| username: TiDBer_XsS0xKSu | Original post link

Okay, I’ll take a look, thank you.

| username: 像风一样的男子 | Original post link

Are you using HAProxy? Try adjusting the timeout client and timeout server settings.

| username: Soysauce520 | Original post link

Does JDBC have a keep-alive configuration?