Mysql show processlist lists many processes sleep and info = null?

拜拜、爱过 提交于 2019-11-29 03:46:08

Those are idle connections being held by a client. You should make sure that whatever client library you are using (JDBC, ...) is configured to not keep unused connections open so long, or that your # clients * max # of connections isn't too big.

My guess is that you are using persistent connections, e.g. pconnect in php:

[..] when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection

and

[..] the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use

I had a similar situation, and was using Codeigniter with pconnect turned on. After turning it to off (see how) every connection was closed down properly after use, and my MySQL processlist was empty.

Performance: The above does not argue about performance, but simply tries to explain why you might see a lot of Sleeping connections in MySQL. It might not be negative, with regard to performance, to have the connections stay active. More info at: http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!