"Mohan Babu D" <Mo********@discussions.microsoft.comwrote in message
news:72**********************************@microsof t.com...
Joh,
Thanks for the reply. You are right. The event handler will be called in a
seperate thread. But i want to process the results in this eventhandler
and
to improve the performance. i wanted to have multiple threads or some
other
way in this Eventhandler.
Is there any way??
Certainly.
If I understand you, the issue is that, if you start more threads within the
event handler, the request will be over by the time the other threads
execute, and the state they are working on will disappear. There's an even
better question: will adding other threads improve performance at all?
The way to answer that question is to first get the code working with the
single thread within the event handler. Then measure the performance. If you
find that the performance is adequate, then stop thinking about extra
threads and proceed with the remainder of your application.
If the performance is inadequate, you need to determine whether adding
additional threads will improve the performance. Additional threads are good
for only two things: improving utilization of unused CPUs and initiating I/O
operations which can take advantage of unused I/O resources. If all of your
CPUs are nearly at 100% utilization, then adding more threads will make
things worse. If you have no disks waiting to have data written to them or
read from them, and if they're connected to IO busses which are not at
maximum utilization, then again, you don't want additional threads.
Only if you've gone through this sort of analysis (and in more detail than
I've outlined here) should you consider adding more threads.
--------------------------------------------------------------------------------
John Saunders | MVP – Windows Server System – Connected System Developer