Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I set max pool size in database connection string? What happens if I don't?

This is my database connection string. I did not set max pool size until now.

public static string srConnectionString =                         "server=localhost;database=mydb;uid=sa;pwd=mypw;"; 

So currently how many connections does my application support? What is the correct syntax for increasing the connection pool size?

The application is written in C# 4.0.

like image 632
MonsterMMORPG Avatar asked Oct 16 '11 11:10

MonsterMMORPG


People also ask

What is max pool size in connection string?

A connection pool is created for each unique connection string. When a pool is created, multiple connection objects are created and added to the pool so that the minimum pool size requirement is satisfied. Connections are added to the pool as needed, up to the maximum pool size specified (100 is the default).

What happens when max pool size is reached?

This may have occurred because all pooled connections were in use and max pool size was reached. When you receive this message, it means that your website is using all of its available SQL Database connections (the default limit is 15 connections per DotNetNuke install).

Is connection pooling necessary?

Using connection pools helps to both alleviate connection management overhead and decrease development tasks for data access. Each time an application attempts to access a backend store (such as a database), it requires resources to create, maintain, and release a connection to that datastore.

What is max pool size in database?

To set the maximum pool size: n is the number of connections allowed per pool, from 1 to 2,147,483,647 (the default). The number of connections is limited by the number of connections supported by your database driver.


1 Answers

Currently your application support 100 connections in pool. Here is what conn string will look like if you want to increase it to 200:

public static string srConnectionString =                  "server=localhost;database=mydb;uid=sa;pwd=mypw;Max Pool Size=200;"; 

You can investigate how many connections with database your application use, by executing sp_who procedure in your database. In most cases default connection pool size will be enough.

like image 128
Zaphood Avatar answered Sep 21 '22 23:09

Zaphood