New request, new thread not always ?

  • Thread starter Thread starter Gawel
  • Start date Start date
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
 
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.
 
Back
Top