12 月 152011
原文(source): Mysql參數解釋—wait_timeout、interactive_timeout – 行動,Action – ITPUB個人空間 – powered by X-Space
官方解釋:
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 | |
被直接斷開 | |