Database Connection Question

From: Christian Cooper (christiancooper77_at_hotmail.com)
Date: 04/29/04


Date: 29 Apr 2004 05:20:10 -0700

I have a question for you, it involves IIS and database connections.

When I got hired, we were using an asp include file with database functions
and would open and close the database connection multiple times in 1 script.

Common sense dictated we should only open the connection once, get all
necessary information, and close it once per script load. We ran some of
your stress testing software and obviously saw performance increases.

Then I stumbled upon the ability to open a database connection when the user
first creates a session and logs into our authentication, and close it when
that session expires or the window is closed. This would mean each user
using the system would connect once and disconnect when they are done.
Otherwise, each user using the system would be making let's say 5 database
connections and disconnections per minute, each time they load an asp page.
So if each user uses the system for 1 hour, and there are 500 of them, there
are 150 000 open and closes.

My Question:

Wouldn't 500 open and closes be LESS stress on the system, by using a
persistent connection?

Also, then I can run queries on the system tables and tell how many users
are logged into the application....

I don't know, the persistent connection seems much better to me, easier to
use and less network traffic, but I've read the opposite, am I missing
something?



Relevant Pages

  • Re: Making a database connection global
    ... connection would be opened the same amount of time (which no-one yas yet ... Anyway, if he don't want to listen, a different angle will probably not ... to reference the database connection once. ... I created a class with a static database connection and the class opens ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: garbage collection
    ... it will get a reader back.. ... you can not reuse the connection on which it opened. ... > garbage collection issue, its a logical error. ... > on database connection is, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Database Connection question
    ... the other is a standalone app and is using ... >java.sql.DriverManager for Connection. ... Every time after obtaining a ... >My task is to write generic code for database connection to be used in both ...
    (comp.lang.java.programmer)
  • RE: Activated Event Vs. other Events
    ... your function to check the database connection ... > The form has to render itself completely first, then attempt a connection, ... > I placed all related code in the Load event, just to realize this code gets ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: simplifying repeating database connections in a class?
    ... I wrote my first PHP class today. ... >> repeat the database connection lines, ... That's why I'm calling the include twice, once in each function, ...
    (comp.lang.php)