JDBC MySQL抱怨连接过多 [英] JDBC MySQL complains Too Many Connections

查看:215
本文介绍了JDBC MySQL抱怨连接过多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发生这种情况时,我检查了我的数据库(请参阅下表),连接数未达到1000个的限制.这很奇怪……想知道是否有隐藏的硬限制被击中.

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   |
+----------------------+-------+

仅供参考,我的应用程序与数据库的平均连接数为300.有什么想法吗?谢谢.

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

我的设置:tomcat7,spring 3.1,tomcat7-dbcp,mysql5.5,java7

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

推荐答案

一种可能的解释是MySQL服务器达到了由主机操作系统施加的打开文件描述符数量的限制.

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

例如,此博客文章描述了Debian上的一个问题:

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

以下是关于同一问题的问答:

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

这篇关于JDBC MySQL抱怨连接过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆