Re: [mp2] Memory not being shared

[prev] [thread] [next] [Date index for 2005/02/11]

From: Kurt Hansen
Subject: Re: [mp2] Memory not being shared
Date: 17:54 on 11 Feb 2005
Stas Bekman wrote:

> Kurt Hansen wrote:
>
>> I'm having problems getting modules loaded at Apache start to be 
>> shared across the children. Here's the output I get from 
>> Apache::VMonitor (I've editted down to just 2 children):
>>
>> Size Share VSize RSS M Elapsed LastReq Srvd
>> ----- ----- ----- ---- -- ------ ------ ----
>> 12: 89.5M 4.2M 89.5M 70.9M _ 0.000s 0.000s 0
>> 8: 89.5M 4.2M 89.5M 70.9M _ 0.000s 0.000s 0
>>
>> Total: 1501392K (1432M) size, 1435471K (1369M) approx real size 
>> (-shared)
>>
>> Both the totals and the individual numbers imply very little memory 
>> is being shared. As I understand the output from VMonitor, only 4.2M 
>> out of 89.5M are being shared. (Yes, Apache is awfully big, that's my 
>> next step in optimization.)
>>
>> I'm loading the vast majority of my modules in a startup.pl file, so 
>> I don't understand why they aren't being shared. Obviously, I am 
>> missing something. Any pointers on where I should look next would be 
>> very helpful. Here is the information about my system:
>>
>> Fedora Core 2
>> perl 5.8.5 (threaded)
>> Apache 2.0.52 (pre-fork -- config params below)
>> mp2 2.0.0-RC4 (DSO -- config params below)
>> apreq2 (2/10/05 version)
>>
>> Relevant parts of httpd.conf (CWApache::Apache2Handler is use'd in 
>> startup.pl):
>>
>> LoadModule perl_module modules/mod_perl.so
>> LoadModule apreq_module modules/mod_apreq.so
>> ...
>> PerlRequire /usr/local/apache2/mp/conf/startup.pl
>
>
> what's in that file? If you don't preload all your modules that 
> explains why you don't have the sharing.

Thanks for the help. I do preload almost all the modules in the 
startup.pl file. Here it is (I didn't include it at first because I 
thought it might be a bit long...):

use Apache2 ();

use lib qw(/www/comp/lib/perl5);

# enable if the mod_perl 1.0 compatibility is needed
use Apache::compat ();

# preload all mp2 modules
use ModPerl::MethodLookup;
ModPerl::MethodLookup::preload_all_modules();

use ModPerl::Util (); #for CORE::GLOBAL::exit

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();

use Apache::ServerRec ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();

use APR::Table ();

use ModPerl::Registry ();

use Apache::Const -compile => qw(:common :http);
use APR::Const -compile => ':common';

use Apache::DBI (); #Added on 11/21/04 KH
$Apache::DBI::DEBUG = 1;

use Apache::AuthDBI ();
use Apache::Request ();
use Apache::Cookie ();
use Apache::Upload ();


use Apache::URI;
use Apache::Session;
use Apache::Session::File ();
use Crypt::HCE_MD5 ();
use HTTP::Request::Common ();
use LWP::UserAgent ();
use Crypt::RSA ();
use Crypt::RSA::Key ();
use PDF::API2;
use PDF::API2::CoreFont;
use Email::Valid ();
use Tie::IxHash ();

use Net::SSLeay qw(get_https post_https sslcat make_headers make_form);

use lib "/www/comp/lib/perl5";
use Stats::ResponseStats ();
use Page::FormField ();
use Convert::Cwebutils ();
use Email::Base ();
use Monitor::TransCheck ();
use Session::CW();
use Transaction::Process ();
use Request::CW ();
use Request::CWCookie ();

# New database and modules
use lib "/www/comp/lib/perl5/donor_modules";
use Transaction ();
use Database ();

# Added 2/10/05 -- KH
use Apache::Scoreboard ();
use Apache::VMonitor();
$Apache::VMonitor::Config{refresh} = 0;
$Apache::VMonitor::Config{verbose} = 0;
$Apache::VMonitor::Config{system} = 1;
$Apache::VMonitor::Config{apache} = 1;
$Apache::VMonitor::Config{procs} = 1;
$Apache::VMonitor::Config{mount} = 1;
$Apache::VMonitor::Config{fs_usage} = 1;
$Apache::VMonitor::Config{apache_sort_by} = 'size';

$Apache::VMonitor::PROC_REGEX = join "\|", qw(httpd mysql squid);

use CWApache::Apache2Handler ();

1;

>
>> <Location / >
>> SetHandler perl-script
>> PerlResponseHandler CWApache::Apache2Handler
>> </Location>
>>
>> Config params for apache and mod_perl:
>>
>> ./configure --prefix=/usr/local/apache2/mp --with-mpm=prefork 
>> --disable-cgi --disable-userdir --enable-auth-dbm --enable-speling
>>
>> perl Makefile.PL MP_APXS=/usr/local/apache2/mp/bin/apxs 
>> MP_INST_APACHE2=1
>
>
> for the future, the bug report guidelines can be found here:
> http://perl.apache.org/bugs/


Oh, OK. I didn't perceive this to be a bug in mod_perl. More of a bug in 
the way I'm using mod_perl. :-) In any case, here is the bug report:

-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

I'm having problems getting modules loaded at Apache start to be shared 
across the children. Here's the output I get from Apache::VMonitor (I've 
editted down tojust 2 children):

Size Share VSize RSS M Elapsed LastReq Srvd
----- ----- ----- ---- -- ------- ------- ----
12: 89.5M 4.2M 89.5M 70.9M _ 0.000s 0.000s 0
8: 89.5M 4.2M 89.5M 70.9M _ 0.000s 0.000s 0

Total: 1501392K (1432M) size, 1435471K (1369M) approx real size (-shared)

Both the totals and the individual numbers imply very little memory is 
being shared. As I understand the output from VMonitor, only 4.2M out of 
89.5M are being shared. (Yes, Apache is awfully big, that's my next step 
in optimization.)

I'm loading the vast majority of my modules in a startup.pl file, so I 
don't understand why they aren't being shared.

2. Used Components and their Configuration:

*** mod_perl version 1.999021

*** using /usr/local/src/mod_perl-2.0.0-RC4/lib/Apache/BuildConfig.pm

*** Makefile.PL options:
MP_APR_LIB => aprext
MP_APXS => /usr/local/apache2/mp/bin/apxs
MP_COMPAT_1X => 1
MP_GENERATE_XS => 1
MP_INST_APACHE2 => 1
MP_LIBNAME => mod_perl
MP_USE_DSO => 1


*** /usr/local/apache2/mp/bin/httpd -V
Server version: Apache/2.0.52
Server built: Feb 10 2005 11:14:27
Server's Module Magic Number: 20020903:9
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/usr/local/apache2/mp"
-D SUEXEC_BIN="/usr/local/apache2/mp/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"


*** (apr|apu)-config linking info

-L/usr/local/apache2/mp/lib -lapr-0 -lrt -lm -lcrypt -lnsl -lpthread -ldl
-L/usr/local/apache2/mp/lib -laprutil-0 -lgdbm -ldb-4.2 -lexpat



*** /usr/local/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
Platform:
osname=linux, osvers=2.6.7-1.494.2.2smp, archname=i686-linux-thread-multi-ld
uname='linux pax.charityweb.net 2.6.7-1.494.2.2smp #1 smp tue aug 3 
09:59:49 edt 2004 i686 i686 i386 gnulinux '
config_args=''
hint=previous, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=define
usemymalloc=y, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-fno-strict-aliasing -pipe -I/usr/local/include -march=i686 -mcpu=i686 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-fno-strict-aliasing -pipe -I/usr/local/include -march=i686 -mcpu=i686 
-I/usr/include/gdbm -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-fno-strict-aliasing -pipe -I/usr/local/include -march=i686 -mcpu=i686 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm'
ccversion='', gccversion='3.3.3 20040412 (Red Hat Linux 3.3.3-7)', 
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='long double', nvsize=12, Off_t='off_t', 
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/lib /usr/lib /usr/local/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.3.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.3'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LONG_DOUBLE 
USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Aug 11 2004 12:15:15
%ENV:
PERL_LWP_USE_HTTP_10="1"
@INC:
/usr/local/lib/perl5/5.8.5/i686-linux-thread-multi-ld
/usr/local/lib/perl5/5.8.5
/usr/local/lib/perl5/site_perl/5.8.5/i686-linux-thread-multi-ld
/usr/local/lib/perl5/site_perl/5.8.5
/usr/local/lib/perl5/site_perl
.

*** Packages of interest status:

Apache::Request: 2.05
CGI : 3.05
LWP : 5.800
mod_perl : 1.999021


3. This is the core dump trace: (if you get a core dump):

Not applicable

This report was generated by t/REPORT on Fri Feb 11 17:34:42 2005 GMT.

-------------8<---------- End Bug Report --------------8<----------

(message missing)

[mp2] Memory not being shared
Kurt Hansen 15:57 on 11 Feb 2005

Re: [mp2] Memory not being shared
Stas Bekman 17:14 on 11 Feb 2005

Re: [mp2] Memory not being shared
Kurt Hansen 17:54 on 11 Feb 2005

Re: [mp2] Memory not being shared
Perrin Harkins 20:32 on 11 Feb 2005

Re: [mp2] Memory not being shared
Kurt Hansen 21:23 on 11 Feb 2005

Re: [mp2] Memory not being shared
Perrin Harkins 21:36 on 11 Feb 2005

Re: [mp2] Memory not being shared
Kurt Hansen 22:34 on 11 Feb 2005

Re: [mp2] Memory not being shared
Stas Bekman 04:04 on 12 Feb 2005

Re: [mp2] Memory not being shared
Richard F. Rebel 14:31 on 12 Feb 2005

Re: [mp2] Memory not being shared
Richard F. Rebel 14:22 on 12 Feb 2005

Re: [mp2] Memory not being shared
Kurt Hansen 17:58 on 12 Feb 2005

Generated at 17:31 on 15 Feb 2005 by mariachi v0.52