This is a discussion on Re: Reducing memory usage using fewer cgi programs - modperl ; --- On Fri, 10/17/08, Michael Peters wrote: > To think about how this works under mod_perl, pretend that > all of your scripts are put together into > 1 larger script and all those "use" statements > are repeated. Does ...
--- On Fri, 10/17/08, Michael Peters
> To think about how this works under mod_perl, pretend that
> all of your scripts are put together into
> 1 larger script and all those "use" statements
> are repeated. Does having multiple "use CGI"
> statements make your script use more memory? No. CGI.pm is
> only loaded once.
Thanks for clarifying that. I was never sure if the libraries would be shared or placed in their own namespace somehow.
> Preloading helps with speed (you don't get the the
> initial loading hit for a module the first time
> it's used in a specific process) but it can also help
> with memory on certain OSs. For instance,
> Linux has Copy-On-Write memory so that if you preload
> modules it saves on actual physical RAM used
> (even though the separate processes think they have their
> own separate memory spaces).
I'm using linux 2.6.23 with Apache 2.2.8
I did not know about the copy-on-write memory. I've probably heard the term many times, but always assumed it was in regards to a filesystem. That can definitely reduce the memory -- I must move more common libraries to startup.pl
> This is one of the reasons that most people put a vanilla
> Apache (or something else like squid, lighttpd, varnish,
> etc) in front as a Proxy. When you do that,
> even if you're running both the proxy and the mod_perl
> server on the same physical machine you need
> a lot less RAM then if you just ran a mod_perl server
> trying to do static and dynamic requests.
Hmmmm. I'm still serving mod_perl programs and static pages from one Apache server, with average load of about 1 hit per second. It's worth looking into some of these combinations a little more.
Thanks for your great answers!
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around