简体   繁体   中英

JDBC MySQL complains Too Many Connections

When this happens, i check in my db(refer to table below), the connections has not reach the limit of 1000. This is weird... wonder if there's a hidden hard limit being hit.

mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 1000  |
+-----------------+-------+

mysql> SHOW STATUS WHERE `variable_name` = 'Max_used_connections';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| Max_used_connections | 510   |
+----------------------+-------+

FYI, my application is having an average of 300 connections to the database. So any idea? Thanks.

My setup: tomcat7, spring 3.1, tomcat7-dbcp, mysql5.5, java7

One possible explanation is that the MySQL server is hitting a limit on the number of open file descriptors imposed by the host OS.

For example, this blog posting describes a problem on Debian:

Here is a Q&A that talks about the same thing:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM