Here's a script to dump out the memory pool info:

  set text ""
  set elname "blocksize nfree nget nput nrequest nlock nwait"
  foreach pel [ns_info pools] {
    append text "\nPoolname: [lindex $pel 0]\n"
    set i 0
    foreach el [lindex $pel 1] {
      append text "  [lindex $elname $i]: $el\n"
      incr i
    }
  }
  ns_return 200 text/plain $text
  return

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.

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.

Jim

> In a message dated 1/10/04 12:03:58 AM, [EMAIL PROTECTED] writes:
>
>
> > A dynamic content server tends to grow in our
> > experience, and I've always assumed that's because of heap
> > fragmentation problems - not necessarily leaks.=A0 Just restart your
> > server once a day/week.
> >=20
>
>
> Yes -- memory fragementation is a problem in AOLserver which does lead to=20
> "large" processes.   Actually, it's more accurate to say we accept fragmenta=
> tion=20
> as a side effect of Tcl's threaded memory allocator which is a per-thread,=20
> power-of-2 alloctor.   This allocator essentially eliminates deadly lock=20
> contention problems of most normal allocators but requires high overhead and=
>  leads to=20
> fragmentation.   You can peak into the current state of the allocator with t=
> he=20
> "ns_info pools" command.
>
> It's possible to compile Tcl without the threaded allocator by editing Tcl's=
> =20
> Makefile to remove the -DUSE_THREAD_ALLOC=3D1.   Then you could try alternat=
> e=20
> malloc packages which may provide better behavior for you app., i.e.:
>
> normal config:
>    ns_malloc -> Tcl_Alloc -> Tcl threaded allocator -- malloc/Tcl_Alloc not=20
> compatible
>
> disabled config:
>    ns_malloc -> Tcl_Alloc -> malloc -- you can pre-load some other malloc=20
> shared library
>
>
> HORD is often cited as a good alternatiive:  =20
> http://www.cs.umass.edu/~emery/hoard/.   =20
>
> -Jim
>
>
> --
> 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.


--
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