perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Gormley <cl...@traveljury.com>
Subject Re: huge httpd processes
Date Wed, 30 Sep 2009 14:47:31 GMT

> i. The total VIRT size of the process before was 119 Mb
> ii. Before - the process shared 94 Mb with other processes
> iii. After - shared has gone down and private dirty up - does this
> mean that this process now 'owns' this memory and it can't be used by
> other processes?

Correct
> 
> The other thing which confuses me is that this seems to be completely
> different from TOP.

> In particular TOP'S concept of SHR seems to be completely different
> from Smap's.

Correct - top does not report shared memory correctly.
> 
> 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.

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.  That makes it unlikely that they will grow too much before
being replaced by a fresh new maximally shared process.

And, as has been discuss in other emails, don't consume lots of extra
memory in your parent process when you don't need to.

For reference, here's the smem.pl output from my live site:

PARENT:
-------
VMSIZE:     160212 kb
RSS:         66516 kb total
             62716 kb shared
               784 kb private clean
              3016 kb private dirty

CHILD:
------
VMSIZE:     156856 kb
RSS:         63992 kb total
             45512 kb shared
                 0 kb private clean
             18480 kb private dirty

> 
clint


Mime
View raw message