On Wed, Sep 30, 2009 at 10:47 AM, Clinton Gormley <cl...@traveljury.com> wrote: >> Do either of these bear any relation to mod_perl's shared memory which >> you can use by preloading modules at startup? > > Yes - as I understand it (somebody please correct me if I'm wrong), all > of the C libraries (eg XS modules) that you preload will remain shared > between your processes. Also, your heap (Perl code and vars) will start > off as shared in a new process. As each page in the heap becomes dirty, > the heap will become less shared.
The short answer is that absolutely everything starts off shared whenever you fork any program, because of copy-on-write. Over time, as pages get written to, they are no longer shared. > But given that forking a new process is cheap with copy-on-write, just > make sure that your children exit on a regular basis, eg after 1000 > requests. I'd start with something really low and work up, like 10 requests, or use Apache::SizeLimit. - Perrin