V
Vance Kessler
I have been reading about ADO.NET's connection pooling and have a
question.
Our situation:
In our system we have a LOT of different user databases. This is a
state less web application running on about 10 web servers accessing a
single SQL 2000 server instance. So, each web request could go to a
different web server. My first assumption is that the connection pool
is local to each web server. I have not found anything that would
contradict that and it makes sense. So, each time a user accesses
their database they could be creating connections on each of the 10
web servers for their particular database. As you can see this could
add up VERY quickly.
1. Would it be advisable to open the connection on a fixed database
(e.g., master) and then issue a changeDatabase() call to the
connection to switch to the actual database desired? This would allow
all the users on a web server to really share connections from the
pool since the connection strings would then match.
2. If I always issue the changeDatabase() call could I set
ConnectionReset to false?
3. What are the disadvantages of doing this? I know it will be a
little slower since I will have to issue the changeDatabase call, but
will be benefits of having truly shared connections be worth it?
4. Another option I just thought of would be to connect to the same
database all the time but instead of changing databases I could fully
qualify access to the tables in all queries by prefixing the database
name to the table names. Will this work with DataSets? Can
SqlCommandBuilder handle a fully qualified table name?
Thanks,
Vance
question.
Our situation:
In our system we have a LOT of different user databases. This is a
state less web application running on about 10 web servers accessing a
single SQL 2000 server instance. So, each web request could go to a
different web server. My first assumption is that the connection pool
is local to each web server. I have not found anything that would
contradict that and it makes sense. So, each time a user accesses
their database they could be creating connections on each of the 10
web servers for their particular database. As you can see this could
add up VERY quickly.
1. Would it be advisable to open the connection on a fixed database
(e.g., master) and then issue a changeDatabase() call to the
connection to switch to the actual database desired? This would allow
all the users on a web server to really share connections from the
pool since the connection strings would then match.
2. If I always issue the changeDatabase() call could I set
ConnectionReset to false?
3. What are the disadvantages of doing this? I know it will be a
little slower since I will have to issue the changeDatabase call, but
will be benefits of having truly shared connections be worth it?
4. Another option I just thought of would be to connect to the same
database all the time but instead of changing databases I could fully
qualify access to the tables in all queries by prefixing the database
name to the table names. Will this work with DataSets? Can
SqlCommandBuilder handle a fully qualified table name?
Thanks,
Vance