How to get the number of connections in the current connection pool in ASP.NET

xiaoxiao2021-03-06  40

zz

5. How do I get the number of connections in the current connection pool in ASP.NET?

A: How to configure SQL Server .NET data provider link pool

A set of name-value pairs can be used to configure a link pool in the form of a link string. For example, you can configure whether the pool is valid (default is valid), the pool's maximum, minimum capacity, the time to open the linked queue request being blocked. The following example string configures the maximum and minimum capacity of the pool.

"Server = (local); integrated security = sspi; data = northwind;

Max pool size = 75; min pool size = 5 "

Select pool capacity

It is very important to establish a largest limit for a large system that manages thousands of users simultaneously issued a request. You need to monitor the performance of link pools and applications to determine the best pool capacity of the system. The optimal capacity is also dependent on the hardware running SQL Server.

During development, you may need to reduce the default maximum pool capacity (currently 100) to help find link leaks.

If the minimum pool capacity is set, it will result in some performance loss when the pool is initially filled to reach the value, although several customers who initially link will benefit from it. Note that the process of creating a new link is serialized, which means that when the pool is initially filled, the server cannot handle the simultaneous request.

For more information on monitoring link pools, see the text monitoring link pool section. Complete list of keywords on link pool link string keywords, see

http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconnectionpoolingforsqlservernetDataProvider.asp.

More information

When using the SQL Server .NET data provider link pool, you must clearly:

• The link is poolized by a method that accurately matches the link string. The poolization mechanism is sensitive to spaces between name-value. For example, the following two link strings will generate a separate pool because the second string contains an additional empty character.

SqlConnection conn = new SQLCONNECTION

"Integrated Security = SSPI; Database = Northwind");

Conn (); // pool a is created

SqlConMection conn = new SqlConnection

"Integrated Security = SSPI; Database = Northwind");

Conn (); // Pool B Is Created (EXTRA SPACES in String)

转载请注明原文地址:https://www.9cbs.com/read-63889.html

New Post(0)