Understanding sql connections

by sunil ravulapalli /11. May 2011 21:43 /.net /Comments (0)
When you do conn.open() IIS opens a physical connection to the DB.
When you do conn.close() IIS moves the connection to the connection pool.
If some request is made using the same connection string IIS will re-use the connection from the pool.
Now, lets say in an App you do this:
//Do stuff
and then you do this:
//Do stuff
In this case, IIS uses the same physical connection.
But lets say if you do this:
IIS will open two physical connections.
You can return the 2 connections to pool
However, if u do not close the connections conn1 and conn2 will remain open for a long time(10 second is still a long time) and won't return to connection pool.
So if there are new connections like conn3 and conn4, IIS will have a total 4 physical connections
If your website hits traffic on black friday, there will be hundreds of such connections and your site will crash :)
blog comments powered by Disqus