Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve Kromer 11 posts 121 karma points
    May 03, 2021 @ 19:58
    Steve Kromer
    0

    IIS database connection pooling

    Are there any best practices or documentation regarding connection pooling in the connection string between IIS and Microsoft SQL server? I'm often seeing max pool connections reached in the event log and am looking for advice on what to set this value at.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    May 04, 2021 @ 05:27
    Huw Reddick
    0

    I wouldn't normally expect to change this from its default of 100. Are you getting a high number of errors in the umbraco logs? Maxing out pooled connections is normally an indication that connections are not getting closed or queries taking a long time to run.

  • Steve Kromer 11 posts 121 karma points
    May 04, 2021 @ 11:44
    Steve Kromer
    0

    I normally have around 40 sleeping connections, but I'm frequently maxing out over 100 overnight on the weekends.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    May 04, 2021 @ 17:28
    Huw Reddick
    0

    Are there any errors in your umbraco log?

  • Steve Kromer 11 posts 121 karma points
    May 04, 2021 @ 18:13
    Steve Kromer
    0

    Yes, in umbraco.DataLayer.SqlHelper, an exception is being thrown: 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.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    May 04, 2021 @ 18:42
    Huw Reddick
    0

    and there are no errors prior to that ? Connections should normally get closed and reused unless they error and they are not getting closed properly or very long running queries which are keeping the connections open, it is unusual to have that many open connections in the pool.

    I have never had the need to increase the default max connections even on very busy websites.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    May 04, 2021 @ 18:59
    Huw Reddick
    0

    You can increase the number of connections by setting the 'Max Pool Size' on your connection string. I would advise trying to figure out why you are getting so many open connections though in case there is an issue somewhere.

    This is a good article on connection pooling

    https://flylib.com/books/en/3.404.1.120/1/

  • Steve Kromer 11 posts 121 karma points
    May 04, 2021 @ 19:39
    Steve Kromer
    0

    No, I can't find any other errors in the log.

  • Steve Kromer 11 posts 121 karma points
    May 04, 2021 @ 19:43
    Steve Kromer
    0

    How would I go about finding code that could be causing connections to not be reused? Monitoring of the database server hasn't revealed any long running queries or performance issues there.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    May 04, 2021 @ 19:49
    Huw Reddick
    0

    Do your IIS logs indicate a large volume of traffic when your connection pool maxes out? If it does, it would be worth checking what pages are being accessed to determine where to look, also analyse their IP's to determine if it is legitimate traffic or bot flooding

  • Steve Kromer 11 posts 121 karma points
    May 13, 2021 @ 18:27
    Steve Kromer
    100

    In my case, it ended up being a large volume of traffic attempting to access the autodiscover.xml file by Outlook clients. Since that file does not exist, IIS was responding with a 404. 404s were being redirected to a page in Umbraco. I added a rule in IIS to respond differently to this specific URL and that resolved the issue.

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    May 13, 2021 @ 18:46
    Huw Reddick
    0

    Glad you sorted it out, and thanks for sharing the solution.

Please Sign in or register to post replies

Write your reply to:

Draft