none
Azure managed instance - SQL Server Max Concurrent connections RRS feed

  • Question

  • What is the limit max concurrent connections on azure SQL MI ?  

    I have a webjob which is multi-thread (max of 15 ) and I see below error all the time. the same app runs without any issues on-perm SQL server. can you someone suggest ? 

    System.InvalidOperationException: 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

    Tuesday, May 7, 2019 3:52 PM

All replies

  • Hi,

    This sounds like an application error rather than SQL.  I have seen similar for .NET apps where they needed to specify the connection pool size in the connection string settings, rather than SQL (default for the app level is 100).  The connection string will have a set pool size and so I dont think this is an SQL issue.

    Depending on the connection string, try something like the below:

      "server=localhost;database=mydb;uid=user;pwd=mypw;Max Pool Size=200;";

    And see if that helps...or increase it more if needed.

    Thanks,

    Matt

    Tuesday, May 7, 2019 4:01 PM
  •  "server=localhost;database=mydb;uid=user;pwd=mypw;Max Pool Size=512;"; this what we have as connection string and all the SQL connection is properly disposed
    Tuesday, May 7, 2019 4:54 PM
  • What is the limit max concurrent connections on azure SQL MI ?  

    I have a webjob which is multi-thread (max of 15 ) and I see below error all the time. the same app runs without any issues on-perm SQL server. can you someone suggest ? 

    System.InvalidOperationException: 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

    Nothing which you can reach, I am not aware about connection limit. This seems like something from application side, did you checked that ?

    Cheers,

    Shashank

    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it

    My TechNet Wiki Articles

    MVP

    Thursday, May 9, 2019 6:30 AM
  • Do you know what version of .NET you're using here and can you confirm that you're closing off connections after they're done with in the code?  This can also happen with connections not being closed off by the app.

    Thanks,

    Matt

    Thursday, May 9, 2019 8:32 AM
  • Hi,

    As others mentioned this is usually an issue of "connection leaks", which mean you do not close the connections correctly. The connections remain blocked until the .NET garbage collector closes them for you by calling their Finalize() method.

    * Having the value "Max Pool Size=512" implies the=at your developers already tried to workaround their poor code instead of fixing the issue. This is very high number which is very rarely needed.

    Check this link for demonstrating the issue:
    https://blogs.msdn.microsoft.com/spike/2008/08/25/timeout-expired-the-timeout-period-elapsed-prior-to-obtaining-a-connection-from-the-pool/


    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]

    Saturday, May 25, 2019 10:28 AM
    Moderator