2

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

Solid
  • 63
  • 7
  • 2
    Is it possible that some of your connections are not correctly closed? – Dragondraikk Aug 21 '14 at 08:16
  • oh, does that matter? I didn't look into that part yet, as it's not reaching the limit of the connections. – Solid Aug 21 '14 at 08:44
  • I am not entirely certain in your case, but I ran into a similar issue that was traced down to unclosed, orphaned connections. – Dragondraikk Aug 21 '14 at 08:59
  • mmmm well, i guess that's a good insight for me :) let me dig this out will update here again for any finding, thanks mate! – Solid Aug 21 '14 at 09:01
  • Just .close() your Java.sql.Connection. The Connection will get released automatically eventually but this way you will be sure to relase the ressource immeadiatly. – Benvorth Sep 24 '14 at 19:30
  • Btw: You can look at all connections to your database by query-ing SHOW PROCESSLIST; Certain Connections can get closed by KILL ; – Benvorth Sep 24 '14 at 19:30

1 Answers1

0

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:

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216