SqlClient connection pooling defect:

  • Thread starter Thread starter Koova
  • Start date Start date
K

Koova

When connection pooling is enabled with maximum 5 and
minimum 0 connections, the first time I make a
connection, 2 connections are created in the pool instead
of a single connection. This looks like a defect to me.

New connection should only be created when required. Is
there a way I can limit it to a single connection when
the pool is created.

Thanks,
Koova
 
If it is by design, is there any way I can limit the
number of connections initially created?
 
Hello Koova,

Thanks for your post. When you open a first connection, it seems that
another unused connection is created. As you know, the opening is done in a
background thread, so the performance will not be impacted too much,
instead when you will open your subsequent connection, it will be faster.

Based on my experience, the "Min Pool Size" also specifies the number of
connections will be keep alive when scanning the pool for unused
connections. I suggest you to set "Connection Lifetime" greater than 0,
close all the connections, wait for the lifetime time-out, and then check
the counter "SqlClient: Current # pooled connections".

I look forward to your response.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Number of connections become important when the clients
have limited user licenses on their database server. Our
client hate holding more connection than required.

I can set the connection lifetime other than 0 to close
the connections after its use but this will degrade the
performance. And my other problem is that I donot know
how many connection I need to start with since our
application allows adding and removing snapins (business
units that will share the connection string but make
their own connections) at run time.

Thanks,
Koova
 
The number of connections in the pool has nothing to do with
licensing. A single user with a single CAL can open multiple
connections without violating their license agreement.

You really only need to care about connection pooling in connection
with performance issues. It's more efficient to share a single
connection among many users than it is for each user to use a unique
connection.

-- Mary
MCW Technologies
http://www.mcwtech.com
 
Back
Top