[quoted text, click to view] jamie.jamazon@googlemail.com wrote:
> I'm currently developing a small MVC framework using classic ASP
> (don't ask me why!) At it's core it calls the controller script which
> does the heavy logic and builds disconnected recordsets of the
> required data then transparently "includes" a page template asp script
> using a Server.Execute.
>
> Because of the limitations of Server.Execute and Server.Transfer the
> data generated by the controller needs to be persisted past the
> Server.Execute call by placing it into the Session Object. At the end
> of each request everything placed into the Session object is removed
> and the session is abandoned. Session.Timeout is also set to 1 at the
> start of each request. I don't want or require anything to persist
> past each request (contrary to the traditional role of session
> variables) so this isn't a problem. I have a more robust database
> session management system for this.
>
> My question is, am I going to run into any scalability issues while
> using the Session object in this way? I've heard whispers of thread
> locking and heap fragmentation linked to storing large amounts of data
> in Session, but I get the feeling this might only be so much of a
> problem if the data is being persisted for the default 20 mins or
> longer with each request.
>
> Please feel free to shoot me down in flames here... or suggest an
> alternative approach to persisting data through a Server.Execute/
> Transfer
The only reason you would run into threading issues is if you stored
single-threaded objects in Session or Application. ADO objects are, by
default, apartment-threaded, so they are not safe to store in Session or
Application. You mentioned disconnected recordsets ... are you putting the
recordsets themselves into Session? If so you do have a concern, since doing
so makes the Session object thread-bound, unless you make the registry
change to cause all ADO objects to be free-threaded. There's a batch file in
...\Program Files\Common Files\System\ADO called makfre15.bat that does this.
The problem with doing this is that you can no longer use a Jet backend
after you do it. So, if you are using Jet anywhere, you need to store the
data a different way. I usually create a free-threaded xml document
containing the data if I need to store it in session or application.
Immediately removing the objects from Session at the end of each request may
mitigate the problems, but i strongly feel you should rewrite things so you
store only scalar data or free-threaded objects in Session, which avoids the
problems in the first place.
I see no reason to abandon the session at the end of each request, or change
the timeout. Neither of these actions should have any effect on scalability.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"