AppDynamics for Databases

2.9.x Documentation

On this page:

"Too many connections" Error

A "Too many connections" error when trying to connect to the mysqld server means that all available connections are in use by database clients.

The number of connections allowed is controlled by the max_connections system variable. Its default value is 100. If you need to support more connections, you should set a larger value for this variable.

MySQL actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. The AppDynamics user should have SUPER privilege, which means that AppDynamics for Databases highlights the issue with the "Too many connections" error. For example:

According to MySQL, the maximum number of connections MySQL can support depends on the quality of the thread library on a given platform. Linux should be able to support 500-1000 simultaneous connections, depending on how much RAM you have and what your clients are doing. Static Linux binaries provided by MySQL AB can support up to 4000 connections.

You should also research the best approach to mysql connection handling supported by your language (such as PHP and Java ) or a 3rd party DB library (such as Pear.)  In MySQL it is relatively easy to create and destroy connections; therefore, connection pooling is not always the best option. It may be best to open a new connection for a client request and then explicitly close the connection at the end of the request.