A web server has a finite capacity. That is, when a page is loaded it opens as many connections as it needs at the same time. Due to the single-threaded nature of these application (pages), a single connection is usually enough. Generally, the page opens the connection just in time and closes it as soon as it's no longer needed. This assumes that the connectionstring does not change for each page. Using this approach, the connection pool reuses the connection for each instance of the page as needed--it's rarely closed and released by the pooling mechanism.
If you're finding that the number of connections in the pool (and I assume you have a single pool--although there could be more than one), is growing over time, there is something wrong.
a.. You're doing more processing in the instance than the server can handle before another instance of the page is loaded with an additional request.
b.. You're not closing the connections so when your instance ends, the connection remains open in the pool and unavailable for other instances.
c.. You're not committing or rolling back the transaction used by the connection which has the same result--the pool overflows.
d.. You have TSQL debugging enabled. This is an issue that causes the pools to overflow.
The first two issues are fairly common. The first can be solved by tuning the application to be more efficient. This might mean fetching fewer rows, improving the performance of the stored procedures, adding or removing indexes, or simply beefing up the hardware and RAM. The second is typically caused by sloppy connection management--especially when you're using DataReaders. If you don't make sure the Connection associated with the DataReader is closed, you're pooched.
We've seen a lot of heavily used web sites use 20-50 connections with a powerful hardware system. This single system can handle several hundred users with ease if the code is written efficiently. Once you exceed the capacity of the hardware, things fall apart quite rapidly.
We've discussed this many times before and I've written several whitepapers over the years on this subject. See
www.betav.com for this content.
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________