[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-dcom
Subject:    Re: FreeThreading Rules
From:       Steve Swartz <stevesw () MICROSOFT ! COM>
Date:       2000-09-27 22:14:32
[Download RAW message or body]


-----Original Message-----
From: Venkat, Raghavan [mailto:Raghavan@COLLEGO.COM]

> When an object resides in an MTA I thought calls from multiple threads
> could be delivered into the object and hence concurrency control was
> required whenever an object was implemented as an MTA.

The point I was making is, where do you think all those multiple
calls from multiple threads come from? The only way your component
can be called multiple times is if you fiddle with the class factory,
or if you pass around interfaces to your component.

> If your MTA COM
> object is instantiated by an ASP page and several clients are using the
> same page, then there is the possibility that several threads are
> calling your methods all at once from the IIS process space.

Two things.

First, your ASP page runs in the STA. When you run MTA components
from an ASP page, you do a thread-swap and an apartment-swap.
That's suboptimal.

Second, when multiple clients are using the same page, they're
using their own copy of the page, and their own copy of your
component. So long as you don't pass that interface to other
components, that one ASP page is going to be the only one calling
your component. Your mistake is assuming that "using the same
page" means "sharing the same variables".

Now you can end up forcing an ASP page to share a component with
other ASP pages, by doing things like using the GIP table, or
by repeatedly unmarshaling an interface stored in shared state
somewhere. What I'm trying to say here is, those tricks might
seem like optimizations, but they lead to scaling bottlenecks.
So long as the lifetime of all the components used by your ASP
page is bounded on both sides by the lifetime of the ASP page,
and so long as your components don't use data shared by other
components, you don't have to worry about locking.

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic