Afficher un message
Vieux 14/03/2005, 16h49   #4
John Murtari
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Apache and memory issues

George Adams <g_adams27@hotmail.SPAMBGONE.com> writes:

> John, thanks for your reply. I neglected to mention my swap space,
> but yes, in addition to the 1gig RAM I also have 1Gig swap.
>
>
> I hadn't thought about it, but I guess I do actually have a script
> involved in my MP3-serving process (among other reasons, this is so I
> can deliver a file to the user that may not necessarily be within the
> Apache DocumentRoot). So the process goes something like this:
>
>
> 1) User clicks on http://example.com/download.cgi?file=2005-03-10-AM.rm
>
> 2) My Perl script (after performing security checks on the filename,
> naturally) logs the hit and begins delivering the file, as shown in
> this snippet:
>
>
> my $filesize = (stat("$sermon_dir/$pathinfo"))[7];
> print "Content-Disposition: inline;filename=$pathinfo\n";
> print "Content-Length: $filesize\n";
> print "Content-Type: application/octet-stream\n\n";
> open(SERMONFILE, "<$sermon_dir/$pathinfo");
> binmode(SERMONFILE);
> binmode(STDOUT);
> my $chunk;
> while (read(SERMONFILE,$chunk,1024)) {
> print $chunk;
> }
> close SERMONFILE;
>
> So here's the question: does this require the Apache child processes
> to grow to the size of the entire MP3 file as it delivers it? If
> that's true, I could understand how a few simultaneous downloads could
> cause the server to run low on memory.



From what you have there. It should not be a problem at all.
I would recommend you run 'top' and have it refresh at 1 sec intervals
and try a few downloads just to watch the actual memory usage of the
Apache processes. If this is something that just happens at random
time you are probably going to need a cron job running 1/minute to check
swap free and if it falls below a threshhold then have it run a ps command
to print memory usage by process: ps -elfm Os m (that is an 'oh' not a zero)

You may also want to add something like this to your apache config
file to limit memory usage on each child process

RLimitMEM 30000000

You are going to have to pick a value that 'fits' you. Monitor
the error log, you will get killed process messages there.

Hope this s.


--
John
__________________________________________________ _________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
  Réponse avec citation
 
Page generated in 0,06376 seconds with 9 queries