Re: seperate service thread

From: Steve C. Orr [MVP, MCSD] (Steve_at_Orr.net)
Date: 08/27/04


Date: Fri, 27 Aug 2004 15:41:29 -0700

Once a page has been rendered, any threads it created are eventually
orphaned and become potential targets for the .net garbage collector. How
often the garbage collector runs varies, depending on the load of your
server & such.

David is right that this won't likely be a problem if all the thread is
doing is sending a quick email to an exchange queue. Once the email has
been generated and is in the queue, it shouldn't matter if the thread that
created it gets recycled. However, if the code is only doing something
really quick like that then I'm not sure why you'd need a separate thread
for it anyway.

-- 
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"PJ" <pjwal@hotmail.com> wrote in message 
news:%23bJ78LIjEHA.3928@TK2MSFTNGP11.phx.gbl...
> I'm curious about this as well.  What exactly would time out?  I assume
> "time out" means certain object instances would be recycled?  If the page
> instance is recycled, how will it affect a worker thread if the thread is
> not referencing any of the page's members?  Will an object created in the
> page, i.e. an EmailObject, that's passed to the queue get recycyled if the
> page instance does?
>
> Thanks for the clarification?
>
>
> "David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
> message news:%23whL8LHjEHA.1776@TK2MSFTNGP15.phx.gbl...
>>
>> "Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
>> news:uLBHzYGjEHA.1348@tk2msftngp13.phx.gbl...
>> > This could work in some cases, but if the thread is especially long
>> running
>> > I'm afraid it could time out once the initiating thread (the ASP.NET
> page)
>> > is long gone.  A windows service should never time out, so it might be 
>> > a
>> bit
>> > more reliable.  A Queue could still be used to store up the list of
>> to-dos.
>> >
>>
>> You wouldn't want to run especially long running things this way.  Just
>> things that take too long to do while your user is waiting.  Sending an
>> email is a perfect use because it can take about a second to do all the
> SMTP
>> stuff, and you just don't need to add that to your user's wait time.  I
> also
>> use this mechanism to write to my log file.  Multiple threads can add log
>> entries very quickly and the worker thread writes them all out to disk.
>> Things you might be tempted to use the ThreadPool.QueueUserWorkItem for 
>> if
>> that weren't frowned upon in asp.net, and things that require access from
> a
>> single thread, like a file.
>>
>> A service will work, but for something like this I think it's not really
>> worth the hastle of administering and configuring the interprocess
>> communication.
>>
>> David
>>
>>
>
> 


Relevant Pages

  • Re:
    ... The final piece of the driver core name limit. ... Some patches may still be in your queue. ... David, David, James, Takashi, can you please ...
    (Linux-Kernel)
  • Re: pop/push, shift/unshift
    ... on which end of the queue you were operating on. ... Upcoming training by David A. Black/Ruby Power and Light, ... Advancing With Rails, Berlin, Germany, November 19-22 ...
    (comp.lang.ruby)
  • Re: [Patch v3] rwsem: fix rwsem_is_locked() bugs
    ... this may give some reader a wrong ->activity value, ... And the patch fixes this by updating ->activity prior to waking the ... Also, we have more problems, as pointed by David: ... but there's a waiter on the queue ). ...
    (Linux-Kernel)
  • Re: Any way to speed this process up?
    ... David W. Fenton wrote: ... check to see if there's some interface that would take queue the ... print jobs so Access wouldn't have to wait for each one to complete, ...
    (microsoft.public.access.modulesdaovba)

Loading