Forum .LRN Q&A: memory usage

Posted by Christopher Jervis on
I have dotlrn installed in a pc with 1,5Gb of Memory.
The web server use a great amount of memory, increasing in the time until that the server come down.
I have that restart the web server every so often (once per week approximately).

Is normal this?, How can I manage the memory that used by the server?
I would like not to restart the web server.


2: Re: memory usage (response to 1)
Posted by Patrick Giagnocavo on
Check the number of threads you have configured. On a development site, you can get away with I think 5 or 7 for both a minthreads and maxthreads value.

Since each thread has a 1MB private stack, each thread you add will have a minimum 1MB RAM penalty.

3: Re: memory usage (response to 1)
Posted by Daniël Mantione on
TCL enables a fast, but wastefull memory allocator if you enable threads. Disable this, it ain't easy, you need to hack the makefiles to do this, and memory usage will drop a lot (on my server (after 24 hours of operation) from +/- 200 mb to +/- 80 mb). Depending on how much visitors your server must serve at the same time, this might or might not be a good idea.

I have also configured my AOLserver to automatically shutdown itself at 04:00 at night to reclaim some memory.

Another thing to consider is the threads. AOLserver tends to start threads when needed and kills them when they are idle. This is does a lot with the heap and should not happen too often, my server uses a fixed amount of 8 threads. If those threads are unneeded, so be it. If this is not enough so the users wait on each other, so be it.

4: Re: Re: memory usage (response to 3)
Posted by Malte Sussdorff on
How did you disable the memory allocator? What are the side effects?
5: Re: Re: Re: memory usage (response to 4)
Posted by Daniël Mantione on
The configure script sets a define to enable the thread memory allocator if you enable threads. I disabled it by hacking the configure script:

# USE_THREAD_ALLOC tells us to try the special thread-based
# allocator that significantly reduces lock contention

(There is now a # in front.)

If you do this TCL will use its normal memory manager, which is completely thread safe. I notice no performance difference, allthough my site has rather low traffic. It saves a lot of memory.