The benefits of having connection pooling active in your database calls

Category ASP.Net Sub Category Database Interaction
Bookmark and Share
The most expensive and time consuming database operation is opening a connection. Therefore, ADO.Net employs connection pooling, which means that when you close a connection, it is not actually closed, but returned to the connection pool.
When you open a new connection that uses the same connection parameters (i.e.connection string), it fetches that connection, or the next available one from the Pool. ADO.Net manages the connection pool itself, and you don't even have to think about it.

When you bypass connection pooling, by keeping a connection opened, you break it. Since you keep the connection open, it cannot be returned to the pool and re-used by another thread.

As you should be able to see now, it doesn't make any sense not to reopen a Connection after each transaction. In a very real sense, it is already opened after the first use. In addition, if a Connection from the Pool is in use, the Pool will create another one.

As for optimization, you should probably look at client-side caching of data when you can.

Of course, to perform some sort of transaction that changes data, this requires another round-trip to the database.
Share the love
Bookmark and Share