MySql Proccesslist filled with “Sleep” Entries leading to “Too many Connections”?

后端 未结 6 1404
礼貌的吻别
礼貌的吻别 2020-12-12 12:41

I\'d like to ask your help on a longstanding issue with php/mysql connections.

Every time I execute a \"SHOW PROCESSLIST\" command it shows me about 400 idle (Status

6条回答
  •  有刺的猬
    2020-12-12 13:26

    Increasing number of max-connections will not solve the problem.

    We were experiencing the same situation on our servers. This is what happens

    User open a page/view, that connect to the database, query the database, still query(queries) were not finished and user leave the page or move to some other page. So the connection that was open, will remains open, and keep increasing number of connections, if there are more users connecting with the db and doing something similar.

    You can set interactive_timeout MySQL, bydefault it is 28800 (8hours) to 1 hour

    SET interactive_timeout=3600
    

提交回复
热议问题