interactive_timeout wait_timeout

时间:2023-03-08 18:08:12
官方解释:
    interactive_timeout

           The number of seconds the server waits for activity on an interactive                               connection before closing it.
          等待一个交互进程变成活动状态的最长时间
     wait_timeout
           The number of seconds the server waits for activity on a noninteractive                           connection before closing it. This timeout applies only
           to TCP/IP and Unix socket file connections, not to connections made using                  named pipes, or shared memory.
            等待一个未交互进程变成活动状态的最长时间
首先理解交互进程,它指的是这个进程正在等待该进程的提交、撤销操作;未交互进程指的是该进程的一个操作已经完成,正在sleep,等待下个操作进行。
实际操作看看这两个参数的效果:
SET GLOBAL interactive_timeout=20;
SET GLOBAL wait_timeout=50;
 s1  s2
start transaction
 update t set c1 = 1;
 等待20s不提交
 发现直接被断开
 update t set c1 = 1
 等待50s
 被直接断开

PS: wait_timeout  设置为大于数据池执行心跳探雷的时间