Data access

Accessing the database is the most expensive part of the processing for most pages. Here you'll see a number of ways to reduce that expense.

Connection pooling

Opening a connection to the database is expensive. Because of this, ASP.NET maintains a pool of open connections. There is a pool per connection string, by Windows identity when integrated security is used, and by whether they are enlisted in a transaction.

When you open a connection, you actually receive a connection from the pool. When you close that connection, it stays open and goes back to the pool, ready for use by another thread.

To make this work efficiently, always use exactly the same connection string for each database you access. If you access one database, have one ...

Get ASP.NET Site Performance Secrets now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.