[thelist] ASP: Threading and apartment model

Marcus Andersson marcan at home.se
Thu Jan 8 07:56:41 CST 2004


> Regardless of whether or not the classes are thread safe, 
> does using a global instance of a class force serialization 
> of concurrent usages from various threads?  If not, is the 
> system having to make copies of all objects for each child 
> thread it spins off?  If the copying does happen, that would 
> seem to be a worse penalty than creating the objects only as 
> necessary since even unused objects would have to be copied.

Don't know if the objects get copied/serialized between threads. Thought
that you worked on the same instances. Mostly done Java Servlet/JSP
development recently (last 3 years) and the "global" objects certainly
don't get copied there so I just ran along thinking the same would apply
in ASP (my ASP knowledge is very rusty since I haven't done anything
with it for about 3 years). If the copying does happen I really don't
want to do it this way. Another bad thing I've found out is that if I do
manage to create objects (with another threading model, don't remember
it's name) and put them in application scope it will lock access to the
Application object for all other threads while accessing one of those
objects. That can also have some heavy impact on performance.

> 
> I've heard numerous "bad things" about using shared object of 
> ASP classes in the session and application scopes.  What has 
> your experience been?

Yup, me too. Especially to put it in session scope if there are a lot of
users. 

Conclusion: I'll have to rethink and put it in request scope instead.
Thanx for the input. Didn't really solve my problems but it made me
think again ;)

/Marcus



More information about the thelist mailing list