|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Charles Gamble (Charles.Gamble
SINGULARITY.CO.UK)Date: Tue Oct 02 2001 - 05:23:12 CDT
Thanks again, this is making a lot more sense now.
Our objects have transactional settings which means that they need
synchronisation on. However, if we could remove the transactional settings
and turn synchronisation off, would this mean that we have to perform our
own thread safety mechamisms? We do not have mulithreaded clients and we
don't share object instances between clients/other objects, so would this be
necessary? Will COM+ internally share object instances in some way if
synchronisation is off, so we are forced to do our own thread safety?
Also, we are having a performance degradation in Windows2000 not just a
lower number of in-call requests in progress. Our system is running 2.5
times slower in Windows2000 than NT. We had an email trail with Tim Ewald on
our performance degradation and he thought it was to do with the context
changes in COM+. See snippet below from Tim, on our slower performance:
"This doesn't really surprise me. The cost of creating contexts is higher in
COM+, as is the cost of calling between them (even when you do not pass
arguments). Each time you call object 2, it has to create objects 3 and 4
and their contexts and this is expensive. It was cheaper under MTS because
they left more details to you (SafeRef) and they didn't really implement all
the services (for instance, activities relied on STA locking instead of real
causality locking). The solution is to reduce the number of contexts. "
We have proved that it is the transactional settings etc. that slow things
down:
"I've done some tests under windows 2000 and NT, I have 4 objects marked as
ThreadingModel 'Both', written in C++ living in MTS/Com+; the first object
does not support TX's the second requires a tx, and the third and forth
support Tx's so the
hierarchy is something like this. Calls are routed from each object to the
next to simulate our product archetecture.
(NoTX) (Req's TX) (supports) (supports)
Object 1 Object2 Object3 Object 4
| | | |
|--foo()-->|---foo()-->|---foo()-->|
| | *1000 | |
| | | |
Object 2 creates an instance of object 3 and calls a method on it which in
turn creates an instance of object 4 and calls a method which
does nothing.
Object 1 creates an instance of object 2 and calls foo() on it 1000 times
which then causes other objects/methods to be created and called etc.
Results with a Celeron 466mhz Processor
---------------------------------------
Under Windows 2000 it takes 28 seconds, whereas on ther exact same spec
machine under NT the entire process takes around 3 seconds. The
setup is the
same on both, tx attributes etc, no interface ptrs are being marshalled
between the calls, however the speed decrease is drastic."
Thanks for the help again,
Charles.
-----Original Message-----
From: Richard Blewett [mailto:richard.blewett
VIRGIN.NET]
Sent: 02 October 2001 10:22
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: Re: COM+ and free threading
OK, now I see where your assumtion came from - that is what happens in MTS
as MTS components all run in the STA thread pool.
Your numbers "in-call" for COM+ may well be smaller as each call gets
serviced faster. Assuming we are taling about a server app you have 2 thread
switches for MTA to MTA, 6 for STA to STA and 4 for STA to MTA. So there is
less work for a start. You also lose the MTS context wrapper as this is
handled in the standard marshalling channel in COM+, so you have less layers
to go through. Finally, for a properly configured server, Win2K is simply
faster than NT.
Are you seeing a performance degradation when you switch to COM+ or simply a
lower number of in-call requests in progress.
To answer to your other questions, there is no limit on the MTA thread pool.
If no thread is available to service a call a new thread is spawned.
You can check out which apartment you are in by using CoInitializeEx:
CoInitEx(NULL, MULTITHREADED); returns S_OK if no apartment, S_FALSE if MTA
and and RPC_E_CHANGED_MODE if TNA or STA.
CoInitEx(NULL, APARTMENT); returns S_OK if no apartment, S_FALSE if STA and
and error if TNA or MTA.
just remember to balance the success calls (S_OK and S_FALSE) with
CoUninitialize();
Richard
http://staff.develop.com/richardb
-----Original Message-----
From: Distributed COM-Based Code [mailto:DCOM
DISCUSS.MICROSOFT.COM]On
Behalf Of Charles Gamble
Sent: 02 October 2001 09:33
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: Re: COM+ and free threading
Thanks for the help Richard,
I am running tests where there is a lot of operations happening concurrently
on MTS/COM+ components. I have about 64 concurrent threads calling many
components. All the components are set as ThreadingModel "Both". In MTS on
NT, when I look at the no of "In Call" for all my components in total, it
will jump to 60 - 70 and back down again quite often.
However, when I run the same test in COM+, the "In Call" total will stay
below 10. Very rarely, the total in call will jump up to between 20 - 50,
but this may not be an accurate stat and only happened once or twice in a
hour long test.
This makes me think that the maximum number of threads is being reached in
COM+.
If a component uses an MTA, is it still restricted to the number of
concurrent threads that can run?
Also, is there some way to see which apartment you are running in?
Thanks a lot,
Charles.
-----Original Message-----
From: Richard Blewett [mailto:richard.blewett
VIRGIN.NET]
Sent: 01 October 2001 18:05
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: Re: COM+ and free threading
Sorry - your assumtions are not correct.
TM=Both for a library app means that the objects enter the apartment of
their creator. For a Server app they enter the MTA.
TM=Free will force the object to always enter the MTA whether library or
server.
In the MTA you have to provide all synchronization yourself - unless you
turn on COM+ synchronization - in which case only one causality (logical
call chain) will access the object at any one time. You will still need to
protect shared state like statics and globals.
Richard
http://staff.develop.com/richardb
-----Original Message-----
From: Distributed COM-Based Code [mailto:DCOM
DISCUSS.MICROSOFT.COM]On
Behalf Of Charles Gamble
Sent: 01 October 2001 17:04
To: DCOM
DISCUSS.MICROSOFT.COM
Subject: COM+ and free threading
Hi all,
I realise that when you setup a COM+ component to be threading model "Both",
it uses the STA thread pool provided by COM+ which is restricted to use 8 -
10 concurrent threads on a single CPU thread. My question is, if I have a
component setup to be threading model "Free", will this use the STA
threadpool? If not, will it be restricted in the number of concurrent
threads that can access it?
Also, will the component have to be thread safe, protect instance data,
etc.? Or will this be provided by COM+?
Any help is appreciated.
Charles Gamble.
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]