[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Nitin Patil

9/29/2003 2:03:00 PM

Hi
i am trying to develop multithreaded application in which
user send the request to the server and on server systems
creates 20 thread for that user and do different
processing and save the data in sql server. This happens
in real time and user gets status every minute about what
happening with each thread.

can anyone tell me is it worth using thread pool concept.
will it queue the request? i dont want to queue the
request but wants to start the new request as soon as
server receives it

thanks in advance

Nitin
6 Answers

rmorin

9/30/2003 3:43:00 AM

0

http://www.csharphelp.com/archives2/archi...
http://www.csharphelp.com/archives3/archi...
Hope these help,

Randy
http://www....

"Nitin Patil" <npatil@igentica.com> wrote in message news:<23e301c38692$5f4795e0$a301280a@phx.gbl>...
> Hi
> i am trying to develop multithreaded application in which
> user send the request to the server and on server systems
> creates 20 thread for that user and do different
> processing and save the data in sql server. This happens
> in real time and user gets status every minute about what
> happening with each thread.
>
> can anyone tell me is it worth using thread pool concept.
> will it queue the request? i dont want to queue the
> request but wants to start the new request as soon as
> server receives it
>
> thanks in advance
>
> Nitin

Kumar Gaurav Khanna

9/30/2003 5:01:00 AM

0

Hi!

Spawning a thread for each request isn't a desirable way to service
requests. You could overload the system. Imagine what would happen if 1000
requests would come in?

ThreadPools do queue requests, although they are optimized to dynamically
grow and shrink on a need-by-need basis. I suggest that you use them as they
will offer better thread management, and optimized use of system resources.
Have a look at this article which explains how thread pools work in .NET,
from the perspective of Rotor:

http://www.wintoo...showpage.aspx?url=http://www.wintoo...processor....

Regards,
--------------------------------------------------
Kumar Gaurav Khanna
Microsoft MVP - .NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoo...
OpSupport - Spelunking Rotor
http://opsupport....

"Nitin Patil" <npatil@igentica.com> wrote in message
news:23e301c38692$5f4795e0$a301280a@phx.gbl...
> Hi
> i am trying to develop multithreaded application in which
> user send the request to the server and on server systems
> creates 20 thread for that user and do different
> processing and save the data in sql server. This happens
> in real time and user gets status every minute about what
> happening with each thread.
>
> can anyone tell me is it worth using thread pool concept.
> will it queue the request? i dont want to queue the
> request but wants to start the new request as soon as
> server receives it
>
> thanks in advance
>
> Nitin


Nitin Patil

9/30/2003 12:15:00 PM

0

Hi!

thanks for your reply.
Let me tell you one thing that the application which i told is already
running but it was devloped using VC++6
i want to port the same application on .net but improving some
performance issues. As the system loads increases the system does
becomes slower and slower.

My basic intention of using Threadpool was that i dont want to create
and delete the threads every time but i want to use them as it is. is
there any way in thread pool to tell that creates max this number of
threads?

Currently whats happening is when user sends the request the request
creates say 10 worker threads. And to keep the eye on these thread we
create 10 monitor thread. So because of it the system does waste its
time in doing lots of expensive context switching. my aim to use .net
was to avoid that context switching. is there any better way for that.
can you give me some suggestions.

thanks
Nitin



*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!

Dino Chiesa [Microsoft]

9/30/2003 5:54:00 PM

0

Is this server written on ASP.NET?

ASP.NET includes a thread pool. If you are not using WS2003, you can
configure the size of it in the machine.config file. If WS2003/IIS6, you
have to use the IIS6 administrative UI to set these things.

If you are not using ASP.NET, then you can separately create and manage your
own thread pool (see the references you got previously).

I'd say that creating a thread just to monitor another thread is probably a
high-overhead design. I don't pretend to understand your design
considerations, but in general you don't need a distinct thread to monitor
each worker thread - where would you ever stop? Instead, you just need a
IAsyncResult . Which is what you get when you use BeginInvoke() on a
System.Delegate.

Check out this overview of asynch programming in .NET.
http://msdn.microsoft.com/library/en-us/cpguide/html/cpovrasynchronousprogrammingov...

-Dino
Microsoft



"Nitin Patil" <npatil@igentica.com> wrote in message
news:%23bfv7x0hDHA.1692@TK2MSFTNGP10.phx.gbl...
> Hi!
>
> thanks for your reply.
> Let me tell you one thing that the application which i told is already
> running but it was devloped using VC++6
> i want to port the same application on .net but improving some
> performance issues. As the system loads increases the system does
> becomes slower and slower.
>
> My basic intention of using Threadpool was that i dont want to create
> and delete the threads every time but i want to use them as it is. is
> there any way in thread pool to tell that creates max this number of
> threads?
>
> Currently whats happening is when user sends the request the request
> creates say 10 worker threads. And to keep the eye on these thread we
> create 10 monitor thread. So because of it the system does waste its
> time in doing lots of expensive context switching. my aim to use .net
> was to avoid that context switching. is there any better way for that.
> can you give me some suggestions.
>
> thanks
> Nitin
>
>
>
> *** Sent via Developersdex http://www.develop... ***
> Don't just participate in USENET...get rewarded for it!


Nitin Patil

10/1/2003 9:02:00 AM

0


Hi Dino
thanks for reply.

i want to ask you one more thing. In my current application where i am
using worker threads i use events also. using this event i inform
monitor thread about the progress of it.
if the monitor thread doesnt get any information from worker thread the
monitor thread assumes that worker thread got stuck somewhere and needs
killing and it does kills it.

if i used the async call can i use the event objects to get the
information about worker thread.

thanks
Nitin

*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!

Dino Chiesa [Microsoft]

10/2/2003 4:56:00 AM

0

> if i used the async call can i use the event objects to get the
> information about worker thread.

I don't quite understand how you are doing the eventing, but in general, yes
you can communicate between threads, if you are careful to lock the shared
data structures.

-D

"Nitin Patil" <npatil@igentica.com> wrote in message
news:Ot7weq$hDHA.1964@TK2MSFTNGP10.phx.gbl...
>
> Hi Dino
> thanks for reply.
>
> i want to ask you one more thing. In my current application where i am
> using worker threads i use events also. using this event i inform
> monitor thread about the progress of it.
> if the monitor thread doesnt get any information from worker thread the
> monitor thread assumes that worker thread got stuck somewhere and needs
> killing and it does kills it.
>
>
> thanks
> Nitin
>
> *** Sent via Developersdex http://www.develop... ***
> Don't just participate in USENET...get rewarded for it!