J
Jon Davis
OK I have a web app that I built that makes MANY calls to the DB in each
request. The app wasn't tuned for scalability so this wasn't a problem, but
time is too short to redesign how the database is accessed because the data
that's being stored is time relevant and the web app will be thrown out in a
few months. Since I try to separate the OleDb stuff from the business logic,
I just create new database connections and trust that those connections will
be closed and expunged when the response ends.
But I'm finding that between SQL Server and IIS the machine is quickly
running out of RAM, even when the session (where I'm caching data in a
custom user object) terminates. After 20 or so page hits (containing several
database hits per page hit) the server loses like 600MB or RAM. I wouldn't
care since the access load is trivial, except that this RAM is NEVER
re-gained. Resetting SQL Server returns about 200MB and then resetting IIS
returns about 400MB. Again, this is long after the sessions have terminated.
And I host nothing in the Application collection.
Am I wrong in my understanding that database connections automatically close
and are destroyed when the containing object destroys itself (when the web
page's response ends)?
I have tried forcing all new database connections to be kept in an ArrayList
in Global and then go through the ArrayList and close and remove all of the
connections when Global's EndRequest method executes, but this doesn't seem
to do anything for me memory-wise.
What is going on?!
Jon
request. The app wasn't tuned for scalability so this wasn't a problem, but
time is too short to redesign how the database is accessed because the data
that's being stored is time relevant and the web app will be thrown out in a
few months. Since I try to separate the OleDb stuff from the business logic,
I just create new database connections and trust that those connections will
be closed and expunged when the response ends.
But I'm finding that between SQL Server and IIS the machine is quickly
running out of RAM, even when the session (where I'm caching data in a
custom user object) terminates. After 20 or so page hits (containing several
database hits per page hit) the server loses like 600MB or RAM. I wouldn't
care since the access load is trivial, except that this RAM is NEVER
re-gained. Resetting SQL Server returns about 200MB and then resetting IIS
returns about 400MB. Again, this is long after the sessions have terminated.
And I host nothing in the Application collection.
Am I wrong in my understanding that database connections automatically close
and are destroyed when the containing object destroys itself (when the web
page's response ends)?
I have tried forcing all new database connections to be kept in an ArrayList
in Global and then go through the ArrayList and close and remove all of the
connections when Global's EndRequest method executes, but this doesn't seem
to do anything for me memory-wise.
What is going on?!
Jon