SQL connection performance

  • This is a performance-related design question. I maintain a network load-balanced web server farm containing 3 Win2K/IIS5 Web servers and 1 SQL 2000 Server. There are over 25 related websites, written in ASP, on the farm, each hitting a SINGLE SQL 2000 database on the database server.

    Each site contains ASP code using ADO to connect to the database. My question: Should we open and close a connection each time we make a call to the database, relying on IIS connection pooling? Or should we create a single connection for each user-session, then reuse for the duration of the session? (perhaps putting the connection in the Session_Onstart event in global.asa)

    What are the pros and cons of either approach?

  • I think opening/closing the connection as you and relying on connection pooling is the way to go. Definitely dont want to hold a connection for every user. If you have 10k concurrent users, that alone would use up a lot of resources on the server. Using stored procedures rather than code in the page will help too.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • quote:


    Or should we create a single connection for each user-session, then reuse for the duration of the session? (perhaps putting the connection in the Session_Onstart event in global.asa)


    You should definately use connection pooling. Open your connection JIT (Just in time) and close them ASAP (as soon as possible). Opening a connection and storing it in the session object is probably the absolute worst thing you can do.

    Chris Hedgate @ Apptus Technologies (http://www.apptus.se)

    http://www.sql.nu

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply