You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by ColinB <cb...@yahoo.com> on 2003/07/03 10:14:02 UTC

Is statically-compiled mod_perl better?

What is the preferred method of compiling mod_perl - static or dynamic?

I have read that *static* linking is likely to load and execute faster,
but may be wasteful of resources if there are multiple proceses each
with its own copy of the common code.

It therefore seems likely that a statically compiled mod_perl would be
faster, provided that a large number of httpd's are not being run at
the same time.

Is this correct?

It seems that at present it is not possible to build mod_perl 2.0
statically. It can only be built dynamically and loaded using
LoadModule in httpd.conf. This seems strange if the preferred method of
building is static.

Thanks

Colin



__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

Re: Is statically-compiled mod_perl better?

Posted by Stas Bekman <st...@stason.org>.
>>It seems that at present it is not possible to build mod_perl 2.0
>>statically. It can only be built dynamically and loaded using
>>LoadModule in httpd.conf. This seems strange if the preferred method of
>>building is static.

What was right for 1.0 doesn't necessarily right for 2.0. mod_perl 2.0 DSO 
seems to be just fine, besides having linking problems on certain OSes (like 
mac) which will be resolved as soon as an expert of the relevant OS will 
provide us help.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Is statically-compiled mod_perl better?

Posted by "Randal L. Schwartz" <me...@stonehenge.com>.
>>>>> "Ged" == Ged Haywood <ge...@www2.jubileegroup.co.uk> writes:

Ged>   A recent post by Randal seemed to indicate the memory saved
Ged> by using a DSO mod_perl wasn't as large as one might think - check the
Ged> archives.

And I've confirmed that observation at least on Solaris and OpenBSD.
You can build a static mod_perl-enabled binary.  Just be sure to have:

        ClearModuleList
        AddModule mod_mime.c
        ...

and add only the modules that you're using.  Modules that don't get
"add"-ed appear to take up no data space... just becoming part of the
shared single binary that is being accessed.

(You can get the list with 'httpd -l' and a bit of text massaging.)

My front proxy processes are a mere 1.5 Meg right now, running
basically mod_ssl, mod_rewrite, and mod_proxy, and it's the same
binary as my backend mod_perl work processes, running about 10 to 15
Meg a piece.

No more DSO.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: Is statically-compiled mod_perl better?

Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi there,

On Thu, 3 Jul 2003, ColinB wrote:

> What is the preferred method of compiling mod_perl - static or dynamic?

Static.  (But that's just my opinion after years of experience and
watching people running into trouble with DSO mod_perl on this List. :)

> I have read that *static* linking is likely to load and execute faster,
> but may be wasteful of resources if there are multiple proceses each
> with its own copy of the common code.

In normal circumstances the speed of loading is unlikely to be an issue.
If you're using mod_perl 1.x on Linux/Unix/whatever then unless you're
using 'httpd -X' or a very strange configuration there will be multiple
processes.  A recent post by Randal seemed to indicate the memory saved
by using a DSO mod_perl wasn't as large as one might think - check the
archives.

> It therefore seems likely that a statically compiled mod_perl would be
> faster, provided that a large number of httpd's are not being run at
> the same time.
> 
> Is this correct?

There are many factors to consider, but the speed difference between
static and DSO isn't often talked about here so you can draw your own
conclusions.  Check out the tuning section of the Guide, the archives.

> It seems that at present it is not possible to build mod_perl 2.0
> statically. It can only be built dynamically and loaded using
> LoadModule in httpd.conf. This seems strange if the preferred method of
> building is static.

True.  That's because it's still in development.  Check the archives...

73,
Ged.