> We are using AOL 4.5.1 (OpenACS) in production environment with many file 
> uploads (and downloads)
> and the memory usage increases continously. We begin with near 4 GB RAM and 
> the this increase to 
> near 11 GB of virtual memory and we have to restart the server. When the 
> server is over 6 GB of
>  memory, the execs (sendmail, unzipos, ...) can not be launched. Fork 
> problem. I will like find any
> solution to that mem increase.
> 
> We have developed a small ns library (using mkZiplib1.0) that we have named 
> nsunzip, to avoid the execs 
> of unzip. We plan add too zip action. If anybody are interested I can send it.

Agustin, there are a few things you should do which will solve your problem. 

First, I recommend having fewer threads running, as that will lower your bloat 
significantly.  I run with 10.

Then, switch to using temporary files (instead of memory), by changing your 
config to:
> ns_section "ns/server/$server1/module/nssock"
>     ns_param   maxinput        1024

and at the bottom:
> ns_limits set default -maxupload "2048000000"


that will get rid of the nsd process bloat while the file is uploading. You'll 
still have bloat when the file is unzipped, which you can solve by removing any 
mention of ns_queryget when you receive the upload, and replacing it with Tom's 
ns_getform (posted here a few days ago) and then reading the ns_set that 
process returns.

After these changes, my nsd process is stable at 16mb of RAM, despite receiving 
800mb zip uploads that I unzip inside aolserver.

Hope that helps!

-john




## ns_getform made saf(er)
# An improved version would return the open fp instead of the tmpfile,
# or better use a system call which returns an fp

rename ns_getform ns_getform_unsafe

#
# ns_getform --
#
#       Return the connection form, copying multipart form data
#       into temp files if necessary.
#

proc ns_getform {{charset ""}}  {

   global _ns_form _ns_formfiles

   #
   # If a charset has been specified, use ns_urlcharset to
   # alter the current conn's urlcharset.
   # This can cause cached formsets to get flushed.
   if {$charset != ""} {
        ns_urlcharset $charset
   }

   if {![info exists _ns_form]} {
        set _ns_form [ns_conn form]
        foreach {file} [ns_conn files] {
                set off [ns_conn fileoffset $file]
                set len [ns_conn filelength $file]
                set hdr [ns_conn fileheaders $file]
                set type [ns_set get $hdr content-type]
                set fp ""
                while {$fp == ""} {
                        set tmpfile [ns_tmpnam]
                        set fp [ns_openexcl $tmpfile]
                }
                fconfigure $fp -translation binary
                ns_conn copy $off $len $fp
                close $fp
                ns_atclose "ns_unlink -nocomplain $tmpfile"
                set _ns_formfiles($file) $tmpfile
                #ns_set put $_ns_form $file.content-type $type
                # NB: Insecure, access via ns_getformfile.
                #ns_set put $_ns_form $file.tmpfile $tmpfile
        }
   }
   return $_ns_form
}


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

To Remove yourself from this list, simply send an email to 
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to