简体   繁体   中英

Max Connection in ADO.net SQL server connection pool

在ADO.net SQL Server连接中,默认情况下在一个连接池中创建了多少个连接?

The number of connections that will be created in the connection pool is either 1 or the number specified as the MinPoolSize, if that number is bigger.
From Microsoft doc on SQL Server Connection Pooling

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.

The minimum number of connections has a default value of 0,
meaning that the connection pool will be closed after a period of inactivity:

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.

The maximum number of connections in the connection pool as a default value of 100.

Connections are added to the pool as needed, up to the maximum pool size specified (100 is the default). Connections are released back into the pool when they are closed or disposed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM