mysql database configuration wait_timeout and interactive_timeout summary

(1) interactive_timeout:
Definition: The number of seconds to wait for the server closes the interactive connection before the event. Interactive client is defined as the use CLIENT_INTERACTIVE option () in mysql_real_connect client.
Parameter Default: 28800 seconds (8 hours)

(2) the wait_timeout:
Definition: The number of seconds to wait until the server closes the active non-interconnecting.
When the thread starts, according to the global value wait_timeout interactive_timeout or global session initialization value wait_timeout value, depending on the type of client (connection option CLIENT_INTERACTIVE mysql_real_connect defined by () in).

Parameter Default: 28800 seconds (8 hours)

Question 1: Why here and set interactive_timeout, wait_timeout set to take effect?
A: Do not set interactive_timeout, wait_timeout will take effect.
And wait_timeout different interactive value if set, why Interactive_timeout will cover wait_timeout: Question 2?
A: In interactive mode (CLIENT_INTERACTIVE), interactive_timeout to take effect, non-interactive mode, does not take effect.

Question 3: During MySQL optimization, as is the length of time interactive connection, and the length of time determined by non-interactive wait_timeout connected interactive_timeout decision. If mysql_real_connect () The last parameter is not set to client_flag CLIENT_INTERACTIVE during connection configuration, the value is not interactive_timeout not cover wait_timeout?
A: You can try to do the experiment.

In order to reduce the number of larger long connections when setting optimization is not possible to set the value interactive_timeout, and set the value of smaller wait_timeout: Question 4? But the problem seemed to describe 2 does not allow this. . .

A: As the 2, in interactive mode, interactive_timeout seconds substituted wait_timeout. In this way, if any, the client is interactive mode connect mysql server. Then the client's timeout subject interactive_timeout. If some clients are non-interactive mode, long connection mysql server. Then the client's timeout subject wait_timeout. (Whether it is connected to the interactive mode, determined by the client)

 

Transfer: https://blog.csdn.net/qq0824/article/details/96831106

Guess you like

Origin www.cnblogs.com/railgunman/p/12121598.html