MySQL : interactive_timeout v/s wait_timeout
时间:2022-03-10 16:56
Most of the database intensive applications are worring about the default values of these variables obviously. Developers used to inform me that they need to extend the wait_timeout value in order to complete the query execution.
After some googling, it is found that default “wait_timeout” value is good enough. We may need to reduce it to boost the server performance which will helpful to minimize the “sleep” process loaded in memory. Increasing number of sleeping process will reduces the server performance gradually. So always keep the default value and make it reduce until the program/application does not create any sleeping process which would helpful to improve the performance noticeable. Slow_log_query is another possible reason to have many sleeping process.
interactive_timeout : interactive time out for mysql
shell sessions in seconds like mysqldump or mysql command line
tools.
wait_timeout” : the amount of seconds during
inactivity that MySQL will wait before it will close a connection on a
non-interactive connection in seconds.
How to change the these variables
a. changing values at run time
Log in to the mysql
console and set the variable.
On thread startup, the session wait_timeout
value is initialized from the
global wait_timeout
value or from the
global interactive_timeout
value, depending on
the type of client (as defined by the CLIENT_INTERACTIVE
connect option to mysql_real_connect()
).
参考:
http://www.serveridol.com/2012/04/13/mysql-interactive_timeout-vs-wait_timeout/
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_wait_timeout
MySQL : interactive_timeout v/s wait_timeout,布布扣,bubuko.com