You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tom Christiansen <tc...@chthon.perl.com> on 2000/04/01 01:01:59 UTC
Re: what's the apache mod_perl speedup factor?
>tom, my direct reply to you bounced, but this should probably be on the
>list anyhow...
> ----- Transcript of session follows -----
>... while talking to mail.perl.com.:
>>>> MAIL From:<do...@covalent.net>
><<< 550 Your site is blacklisted as a spam haven.
>554 <tc...@chthon.perl.com>... Service unavailable
Hm... you must be using an open relay. I don't have covalent listed
here. I see a uunet bounce, which is not unlikely. They're terrible,
because they sell to everyone, and then don't enforce any AUP on
their downstream resellers.
I don't tend to trust timing under a second. The quantum fluctuations
in the universe are too hard to predict. :-)
I would like to console people against using the fancy IO
modules, or at least, not to do so without knowing what they're
getting into. Look at where we are now:
% wc `perl -MIO -e 'print join("\n", sort values %INC, "")'`
124 696 4166 /usr/local/lib/perl5/5.6.0/Carp.pm
580 2465 17661 /usr/local/lib/perl5/5.6.0/Class/Struct.pm
400 1495 10455 /usr/local/lib/perl5/5.6.0/Cwd.pm
313 1589 10377 /usr/local/lib/perl5/5.6.0/Exporter.pm
225 784 5651 /usr/local/lib/perl5/5.6.0/Exporter/Heavy.pm
92 339 2813 /usr/local/lib/perl5/5.6.0/File/Spec.pm
442 1574 10276 /usr/local/lib/perl5/5.6.0/File/Spec/Unix.pm
115 398 2806 /usr/local/lib/perl5/5.6.0/File/stat.pm
406 1350 10265 /usr/local/lib/perl5/5.6.0/IO/Socket/INET.pm
143 429 3075 /usr/local/lib/perl5/5.6.0/IO/Socket/UNIX.pm
7168 24137 178650 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/Config.pm
230 1052 5995 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/Errno.pm
222 725 5216 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/Fcntl.pm
47 101 669 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/IO.pm
239 769 5005 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/IO/Dir.pm
169 549 3956 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/IO/File.pm
594 2180 14772 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/IO/Handle.pm
252 755 5375 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/IO/Pipe.pm
77 235 1709 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/IO/Seekable.p
m
428 1419 10219 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/IO/Socket.pm
452 1401 10554 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/Socket.pm
127 473 3554 /usr/local/lib/perl5/5.6.0/OpenBSD.i386-openbsd/XSLoader.pm
52 161 1050 /usr/local/lib/perl5/5.6.0/SelectSaver.pm
139 541 3754 /usr/local/lib/perl5/5.6.0/Symbol.pm
161 609 4081 /usr/local/lib/perl5/5.6.0/Tie/Hash.pm
109 390 2479 /usr/local/lib/perl5/5.6.0/strict.pm
79 370 2589 /usr/local/lib/perl5/5.6.0/vars.pm
318 1124 11975 /usr/local/lib/perl5/5.6.0/warnings.pm
30 85 722 /usr/local/lib/perl5/5.6.0/warnings/register.pm
13733 48195 349869 total
Incredible.
Moreover, that requires 116 happy trips through the kernel's namei().
It syscalls open() a remarkable 57 times, 17 of which failed but
leaving 38 that were successful. It also syscalled read() a curiously
identical 57 times, ingesting a total of 180,265 plump bytes. To
top it off, this INCREASES YOUR RESIDENT SET SIZE BY TWO MEGABYTES!
Happy mallocking, Oh, and the answer you're looking for on CGI.pm is:
% wc `perl -MCGI -le 'print for values %INC'`
1368 6920 43710 /usr/local/lib/perl5/5.6.0/overload.pm
6481 26122 200840 /usr/local/lib/perl5/5.6.0/CGI.pm
7849 33042 244550 total
You have 16 trips through namei, 7 successful opens, 2 unsuccessful ones,
and 213k of data read in.
The following numbers show memory sizes (virtual and resident) for
v5.6 of Perl on four different operating systems, The three calls
each are without any modules, with just -MCGI, and with -MIO (never
with both):
OpenBSD FreeBSD Redhat Solaris
vsz rss vsz rss vsz rss vsz rss
Raw Perl 736 772 832 1208 2412 980 2928 2272
w/ CGI 1220 1464 1308 1828 2972 1768 3616 3232
w/ IO 2292 2580 2456 3016 4080 2868 5384 4976
Anybody who's thinking of choosing one of these might do well to
stare at those numbers for a while.
--tom
Re: what's the apache mod_perl speedup factor?
Posted by Chip Turner <ch...@zfx.com>.
Tom Christiansen <tc...@chthon.perl.com> writes:
> I would like to console people against using the fancy IO
> modules, or at least, not to do so without knowing what they're
> getting into. Look at where we are now:
>
> % wc `perl -MIO -e 'print join("\n", sort values %INC, "")'`
[snip]
> The following numbers show memory sizes (virtual and resident) for
> v5.6 of Perl on four different operating systems, The three calls
> each are without any modules, with just -MCGI, and with -MIO (never
> with both):
>
> OpenBSD FreeBSD Redhat Solaris
> vsz rss vsz rss vsz rss vsz rss
> Raw Perl 736 772 832 1208 2412 980 2928 2272
> w/ CGI 1220 1464 1308 1828 2972 1768 3616 3232
> w/ IO 2292 2580 2456 3016 4080 2868 5384 4976
>
> Anybody who's thinking of choosing one of these might do well to
> stare at those numbers for a while.
This is mitigated somewhat by loading the modules once on a cold start
and letting them propogate to child httpd's via fork. This helps with
the memory and startup time. It's unfortunate that those modules are
so large, but with perl and websites the tradeoff is usually memory
for performance. Since it's easier to double the RAM of a system than
to double the CPU speed, many consider it a fair trade. :)
Of course, I suspect you knew that, but maybe not everyone does.
I am curious; do you advocate not using such modules, or do you
advocate a simpler API of some sorts? Perl sucks memory, no two ways
about it. CGI.pm is huge and tries to do everything, which is rarely
a good thing. IO provides a needed, though costly, OO interface to
most system calls. What alternatives are there really besides
rewriting and breaking those modules up, as has partially been done
with some Apache modules vs CGI.pm. I'm not aware of any similar
attacks on IO.
Chip
--
Chip Turner chip@ZFx.com
ZFx, Inc. www.zfx.com
PGP key available at wwwkeys.us.pgp.net