ASP Best Practices

Previous Topic Next Topic

ODBC Connection Pooling

One of the potential bottlenecks in ASP application performance is connection management. If not managed properly, the opening and closing of connections can occur so frequently that reduced server performance will result. Microsoft® Windows® 2000 Server features built-in support for connection pooling; this reuses existing connections optimally in order to achieve faster application performance and graceful timeout management with less coding effort.

IIS 5.0 automatically manages connection pooling for you.

To use ODBC or OLE DB connection pooling

  1. Configure the driver for the database to which you are establishing a connection.
  2. In the Windows 2000 Server registry, check the CPTimeout property to verify that connection pooling is on; let connection pooling handle the connection logic.
  3. If connection pooling is off, use RegEdit32 to turn it on in the Windows 2000 Server registry.

    Caution   Do not use a registry editor to edit the registry directly unless you have no alternative. The registry editors bypass the standard safeguards provided by administrative tools. These safeguards prevent you from entering conflicting settings or settings that are likely to degrade performance or damage your system. Editing the registry directly can have serious, unexpected consequences that can prevent the system from starting and require that you reinstall Windows 2000. To configure or customize Windows 2000, use the programs in Control Panel or Microsoft® Management Console (MMC) whenever possible.

  4. Open individual connections—in your ADO code—just before you need data access on each individual page.
  5. Close connections as soon as data access activities are complete.
  6. Disconnect stored recordsets by setting ActiveConnection property to Nothing before storing in Session state.

© 1997-1999 Microsoft Corporation. All rights reserved.