MySql 数据库连接池

最近发布的一个项目总是无缘无故的断线,在IIS机器上直接浏览也不会出现黄页面,就是一直加载,最后断线。

重启IIS后恢复正常。

 

经过几次后,查看了IIS日志和WINDOWS日志,在WINDOWS日志中发现错误信息如下:

 <Data>error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.</Data>  
 
大概百度了一下是数据库连接池的问题,解决方式如下:
 

show variables like 'max_connections'  //显示最大的数据库连接数

set GLOBAL max_connections = 200;  //修改最大数据库连接数

<add key="data" value="server=IP; Port=3306; uid=root; pwd=root;database=data;pooling=true;min pool size=5;max pool size=512;connect timeout = 20; "/> 

不知是否已经根治,但目前还未出现问题。

posted on 2016-10-18 11:09  Zane.zhang  阅读(369)  评论(0编辑  收藏  举报

导航