On 2004.01.10, Jim Wilcoxson <[EMAIL PROTECTED]> wrote:
> It seems that one way to address this memory/heap problem is to force
> threads to exit after a certain amount of time idle, freeing their
> entire heap area.  There is code in AS to do that, but I've never
> gotten it to work successfully because AS tends to "round-robin" the
> workload to all threads.  So they never idle.

Interesting -- you're saying the request dispatcher puts threads into a
queue and tasks things LIFO?  Sounds right, but I'd have to look at the
source again ...

> If threads went to the top of a work queue when they were fininshed
> instead of the bottom, and threads were always removed from the top,
> the idle thread exit code would stand a chance of working.  Also, a
> system over-configured for 30 threads would automatically adjust
> itself to use only 5-6 threads, or whatever the actual load required;
> 5-6 fragmented heaps is better than 30.

The trade-off is that LIFO scheduling, while it doesn't produce idle
threads ... is that it doesn't produce idle threads.  Also, selecting
which thread to hand a request off to is an O(1) operation, as well as
returning the thread to the pool is also O(1).  Pushing threads back on
top of the queue (so that threads at the end of the queue eventually
will exceed an idle threshhold) may not necessarily have the same
performance characteristics.

Heap fragmentation IS annoying.  Perhaps if there was an ns_* API that
let you mark a thread for termination and cleanup, you could couple that
with [ns_info threads] to periodically flush "old" threads and have them
replaced with fresh new ones.

Similar to the Apache config. setting of "MaxClients" - after handilng X
number of requests, the child dies and the parent forks a new one to
continue handling requests.

-- Dossy

--
Dossy Shiobara                       mail: [EMAIL PROTECTED]
Panoptic Computer Network             web: http://www.panoptic.com/
  "He realized the fastest way to change is to laugh at your own
    folly -- then you can let go and quickly move on." (p. 70)


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to