Hi Mike,
I've cc'd the mod_perl list for other Solaris users to consider.
At 10:49 AM 11/01/00 -0800, Michael Blakeley wrote:
>I saw a significant benefit from pre-loading modules. Let's take a
>test case where we share via startup.pl:
>
>Without preloading:
>
># tellshared.pl web
> count vsz rss kB %
> 8 146304 67784 78520 54
>
>With the "use" section above:
>
># tellshared.pl web
> count vsz rss kB %
> 8 132672 17032 115640 87
>
>'rss' is the resident set size - that is, the amount of actual RAM in
>use. The 'vsz' tells the size of the virtual address space - the swap
>in use. The kB column shows the difference (ie, the "saved RAM" via
>page sharing) and the % shows the %-shared.
I'm not clear you can measure the shared memory space that way. I don't
really understand the memory system much, but here's a paper that I found
interesting:
http://www.sun.com/solutions/third-party/global/SAS/pdf/vmsizing.pdf
"The virtual address size of a process often bares no resemblance to the
amount of memory a process is using because it contains all of the
unallocated memory, libraries, shared memory and sometimes hardware devices
(in the case of XSun).
"The RSS figure is a measure of the amount of physical memory mapped into a
process, but often there is more than one copy of the process running, and
a large proportion of a process is shared with another.
"MemTool provides a mechanism for getting a detailed look at a processes
memory utilization. MemTool can show how much memory is in-core, how much
of that is shared, and hence how much private memory a process has. The
pmem command (or /usr/proc/bin/pmap -x in Solaris 2.6) can be used to show
the memory utilization of a single process."
Now, with a simple "hello world" mod_perl handler that loaded a bunch of
modules I did see that pre-loading modules reduces memory usage -- both in
looking at ps output, and with the pmap program, even after a number of
requests. This is consistent with what you commented on above.
I'm repeating, but I found with a real-world application that sharing the
modules ended up using quite a bit more "private" memory. I don't know if
that's only an issue with my specific OS, or with how my specific
application is running.
Here's ps output with pre-loaded modules. On these tests I'm running
Apache 1.3.12 with mod_perl 1.24 static, but everything else is DSO. I've
got maxclients set to one so there's only the parent and one child.
I'm pre-loading modules in a <perl> section here:
S USER PID PPID %CPU %MEM VSZ RSS STIME TIME COMMAND
S lii 318 1 0.0 0.3 8376 5464 15:50:38 0:00 httpd.mo
S lii 319 318 0.8 1.1 24720 21288 15:50:38 0:05 httpd.mo
And now without pre-loaded modules:
S USER PID PPID %CPU %MEM VSZ RSS STIME TIME COMMAND
S lii 1260 1 0.0 0.2 4392 3552 15:56:25 0:00 httpd.mo
S lii 1261 1260 0.9 0.6 14592 12304 15:56:25 0:05 httpd.mo
And here's comparing the totals returned by the pmap program that should
detail shared and private memory (according to the paper cited above).
Address Kbytes Resident Shared Private
-------- ------ -------- ------ -------
total Kb 24720 22720 3288 19432 <<< pre-loaded modules
total Kb 14592 12976 3096 9880 <<< not pre-loaed modules.
Indeed there's a tiny bit more shared memory in the pre-loaded Apache, but
the amount of "private" memory is significantly higher, too. Ten megs a
child will add up. It doesn't really make sense to me, but that's what
pmap is showing.
Maybe this isn't that interesting. Anyway, I'll try a non DSO Apache and
see if it makes a difference, and also try with an Apache that forks off
more clients than just one, but I can't imagine that making a difference.
Later,
Bill Moseley
mailto:[EMAIL PROTECTED]