New request, new thread not always ?

G

Gawel

Using Thread.CurrentThread.GetHashCode() and AppDomain.GetCurrentThreadId()
I observerd that a few requests are serverd by the same thread. Usually 3-5
requests.
Is it possible to force, that every request will be served by new thread ?


Gawel
 
A

Alvin Bruney

why do you need to change this behavior? Any particular reason?

Requests are serviced using a thread pool. The first available thread
services the request.
It may be a repeat thread depending on the state of the machine and thread
pool usage or it may not be. This behavior is pretty much out of the
programmers hands. A pool is used so that multiple concurrent requests can
be serviced without service degradation as would be experienced if you could
implement requests on a single thread.

Put another way, under load, a queue system (single thread) would bottleneck
and crawl to a halt. Then fall over dead from a coronary. Efforts to revive
said thread would be useless. Funeral arrangements would have to be made
quickly to dispose of the rotting thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top