MySql.Data.MySqlClient.MySqlConnection.Open() taking a long time

半腔热情 提交于 2019-12-12 18:50:02

问题


I have a mvc .net4 website, connecting to mysql, on page load i run a query (which cannot be avoided) for which MySql.Data.MySqlClient.MySqlConnection.Open() is very slow in worst case taking 15 seconds to open. This page is only slow if i use the website after long periods of time. Once I use the website its pretty fast until hours later I come back and use it. I am thinking its because of cold sessions on mysql host it kills all connections in pool when there is no one connecting for hours.

I have tried following so far with no success:

-For fast access to mysql host my website is not using dns to connect to mysql server rather just the ip

-I set the idle timeout minutes for web in iis settings to 0 in hope that it will keep session pool warm

来源:https://stackoverflow.com/questions/24706027/mysql-data-mysqlclient-mysqlconnection-open-taking-a-long-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!