title: Very slow opening MySQL connection using MySQL Connector for .net
body: <p>I am trying to solve the problem of very long response times from MySQL when opening a connection using the MySQL Connector for .net.</p>
  
  <p>I have installed MySQL 5.5 running on an Azure VM (Server 2008) with --skip-name-resolve, and the database user accounts' host restrictions are using IP addresses. I am using the latest MySQL Connector for .net in my WCF service running on Azure (in the same location US- East, I have been using a trial subscription, no affinity set). My connection string in the WCF service is using the internal IP address of the VM hosting MySQL as the server parameter value. I also have "pooling = true;Min Pool Size=2;" just in case (I have tried without these parameters too).</p>
  
  <p>When tracing the WCF the query response time once the service is running and processing requests are pretty good (even where each query result is unique and so not being cached) and I have no issues with the performance of MySQL providing it's getting hit frequently.</p>
  
  <p>But the huge problem I haven't been able to crack is <strong>the length time it takes to get the connection to MySQL Open after no calls to the database have been made for about 3 or 4 minutes</strong>. If <strong>no database calls are made for a few minutes it takes 8 or 9 seconds or more to open the connection again</strong>. I wrapped the actual "conn.open();" with trace statements before and after calling, and this is the behaviour I am seeing logged time and time again after a few minutes of inactivity.</p>
  
  <p>Incidentally, I have also tried (and still am using) the 'using' style of connection handling to ensure that the MySQL Connector is managing the connection pool.</p>
  
  <p>e.g.: 
  using (var conn = new MySqlConnection(Properties.Settings.Default.someConnectionString))  { ... statements ..}</p>
  
  <p>I feel like I have reached a dead end on this one so any suggestions would be greatly appreciated.</p>