Connection pool timeout due to max pool size

Overview

When there is an increase in the number of requests made to the server, some connections get a timeout error and are not processed. The following error is shown in logs:

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.

 

 

Prerequisites

  • Access to the DNN file structure

 

Diagnosis

The maximum number of connections configured in the server is reached, causing a rejection to all new connections. This limit is usually reached due to a high number of intensive queries with long completion time. 

Note: The default number of connections configured on the server is 100.  

Confirm that you are having a connection pool timeout issue by searching for the error described in the Overview section in the following log file: 

SiteRoot/Portals/_default/logs/[DATE LOG]

 

Solution

  1. If the error was found, open the web.config file located in the website root folder. 
  2. Add the parameter Max Pool Size=XXX in the connection string, replacing XXX for your desired value. 

    Your connection string should look like this if XXX= 200. 
    <connectionStrings>
    <add name="SiteSqlServer" connectionString="Data Source=localhost;Initial Catalog=dbname;User ID=dbuser;Password=dbpassword;Max Pool Size=200" providerName="System.Data.SqlClient" />
    </connectionStrings>

Testing

To test that this change has alleviated the issue:

  • Monitor the system logs located in the SiteRoot/Portals/_default/logs folder mentioned in to confirm that the error is no longer appearing after the change. 

 

Comments

0 comments

Please sign in to leave a comment.