Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need to set Min pool size in ConnectionString

For SQL connection pool, why do we need to set up a min pool size? As connections will be saved in the connection pool and reused, why do we need to keep live connections specified by the min pool size? Thanks.

like image 809
Helic Avatar asked Oct 07 '13 09:10

Helic


1 Answers

Opening and maintaining connections is expensive, so if you know that you need multiple connections (always) it's better to specify the MinPoolSize because then it's ensured that these connections are available.

Also, from MSDN:

If MinPoolSize is either not specified in the connection string or is specified as zero, the connections in the pool will be closed after a period of inactivity. However, if the specified MinPoolSize is greater than zero, the connection pool is not destroyed until the AppDomain is unloaded and the process ends. Maintenance of inactive or empty pools involves minimal system overhead.

like image 121
Tim Schmelter Avatar answered Oct 14 '22 09:10

Tim Schmelter