MySQL: Are sleep connections an issue?

junho 23, 2023 | por dbsnoop

Sleep Connections right? Also called idle connections. One used to call the annoying connections.

First of all the max_connections variables. That’s the limit of manageable connections that your server will do. If you set the max_connections to 100 for example, no 101 connections will be allowed. If the server are maintaining open connections never being taken again that’s an issue to be addressed. Tons of connections to database, normally, tells me that the application is faulty or the application wasn’t well designed. Very specific applications really needs to open several connections. Come on! Use pools of connections for god sake.

Keep in mind that each idle connection has a minimum consumption of resources such as memory for example. The minimum memory connection is about 192kb to 256kb. But it depends what happening when the connection was broken.

What can lead to a sleep connection?

  • Bad handshaking
  • Network failure
  • Application failure
  • Connection manager failure
  • Programming misconception

If you see a lot of connections sleeping at your MySQL Server you must spend sometime investigating it. The dbsnOOP provide means to track it down and helpful tools to fight idle connections.


Leia mais