You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1997/06/17 21:56:53 UTC

Re: NT and modules

Ya know... perhaps we are being stupid here, but most UNIX systems 
have shared library capability. We are already creating modules 
like mod_proxy as a .a that is being linked to the server. Why 
couldn't we do the same with modules by creating a shared lib? 
Seems that if nothing else, this could really reduce the memory 
usage of hundreds of server processes?


> Alexei Kosut wrote:
> > Anyway, my point is that we should fix up mod_dld (or an equivalent)
> > for NT and include it standard in the NT built of Apache 1.3. AFAIK,
> > the problem with mod_dld in Unix is the lack of a standard dynamic
> > library-loading facility. NT has one (unless I'm vastly mistaken), so
> > let's make use of it. It'll be much more useful with NT than on Unix,
> > and will allow people to distribute NT modules for 1.3 that will be
> > useful to the people running it - who won't have the ability to
> > recompile.
> > 
> 
> I agree with you completely about loading modules in as DLLs. It
> should be pretty easy. Actually, I think this would be a better way
> to do modules on the Unix's that support shared libraries too - don't
> need to muck around with the build process to add a module.
> 
> +1
> 
> > I know nothing about NT programming, but it doesn't sound too
> > difficult - mod_dld (which uses gdld) seems to basically be about
> > three lines of code - find a library file, link to it, and reconfigure
> > the server. I think it's worthwhile to make an nt/mod_dld.c and
> > include it (by default).
> > 
> > Anyone (especially someone versed with NT development) else have any
> > thoughts on this?
> > 
> > --
> > ________________________________________________________________________
> > Alexei Kosut <ak...@nueva.pvt.k12.ca.us>      The Apache HTTP Server
> > URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/
> 
> -- 
> 
> ---------------------------------------------------------------------
> Ambarish Malpani
> Architect					       (408) 738-2040
> ValiCert, Inc.				      http://www.valicert.com
> 333 W. El Camino Real, Suite 270
> Sunnyvale, CA 94087




Re: NT and modules

Posted by Chuck Murcko <ch...@topsail.org>.
Alexei Kosut wrote:
> 
> On Tue, 17 Jun 1997, Randy Terbush wrote:
> 
> > Ya know... perhaps we are being stupid here, but most UNIX systems
> > have shared library capability. We are already creating modules
> > like mod_proxy as a .a that is being linked to the server. Why
> > couldn't we do the same with modules by creating a shared lib?
> > Seems that if nothing else, this could really reduce the memory
> > usage of hundreds of server processes?
> 
> I'd love to see this done. We have a module (mod_dld.c) that links
> object files into the server at runtime using gdld. If someone wants
> to modify this to work with shared libraries in a way that works on
> many Unices, that'd be great. The last part seems to be the sticking
> point, if I recall correctly. A few years ago, when mod_dld was first
> written, I recall most Unix OSes doing this differently (if at
> all). Maybe that's changed, or maybe it was just wrong.
> 
> Regardless, this has always been on my Apache 2.0 list - not shared
> libs per se, but just the ability to have modules loaded at runtime
> instead of at compile-time.
> 
It's not that hard to build shared libs with gcc. It's all the native
compilers that will pose an interesting problem there.
-- 
chuck
Chuck Murcko
The Topsail Group, West Chester PA USA
chuck@topsail.org

Re: NT and modules

Posted by Alexei Kosut <ak...@nueva.pvt.k12.ca.us>.
On Wed, 18 Jun 1997, Rasmus Lerdorf wrote:

> > I don't see that. If mod_dld works on your system, "cc -o
> > mod_whatever.c" will built a module, and "LoadModule whatever_module
> > mod_whatever.o" will install it at runtime.
> 
> It is slightly more complex that just doing a cc -o to build the module
> though.  You have to build a shared library.  This is pretty hairy on a
> bunch of compilers.

IIRC, not the way mod_dld.c works right now. It just loads normal,
ordinary, object files. Or non-shared libraries.

-- 
________________________________________________________________________
Alexei Kosut <ak...@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/


Re: NT and modules

Posted by Rasmus Lerdorf <ra...@lerdorf.on.ca>.
> I don't see that. If mod_dld works on your system, "cc -o
> mod_whatever.c" will built a module, and "LoadModule whatever_module
> mod_whatever.o" will install it at runtime.

It is slightly more complex that just doing a cc -o to build the module
though.  You have to build a shared library.  This is pretty hairy on a
bunch of compilers.

If we are going to make an effort on this front, we might as well go all
the way.  Let modules get loaded and unloaded on a per-request basis, not
just at runtime.

For example.  I might have a page that doesn't get hit very often, but it
requires mod_perl and Oracle tie-ins.  Next to it I might have another
page written for mod_php.  And in the meantime 99% of my hits are just
static HTML hits that don't need either.  It would be cool to be able to
load and unload mod_php and mod_perl when necessary.

-Rasmus


Re: NT and modules

Posted by Alexei Kosut <ak...@nueva.pvt.k12.ca.us>.
On Wed, 18 Jun 1997, Rasmus Lerdorf wrote:

> I don't really see any benefit to this though.  In a pre-forking
> multi-process environment you get absolutely no performance benefit 
> from dynamically linking in modules at runtime.  The only benefit is in
> the convenience of not having to recompile to add a module.  This
> convenience comes at the expense of a much more difficult compile of each
> module.

IMHO, this convenience is worth it. Especially (and remember where
this thread started) in the personal computer market, where OSes don't
come with compilers, and no one would want to compile a server
anyway. I'm not saying that we should make it so people can't compile
modules into the server. For freeware Unix modules (like yours) that's
fine. However, for Windows, it's not. And for commercial modules, it's
not: If I don't want to give away my source, it's hard to sell an
Apache module. A working run-time module loader would help. Also, a
coherent API that doesn't change with every release. But I've written
about that before.

> It would be nice to get to the point where Perl is.  Having a standard
> mechanism to build a module and to make it available to Apache.  Then
> doing something like a "Use mod_rewrite" in the httpd.conf file, or even
> per-request in a .htaccess.  mod_dld is a very long way from something
> like that.

I don't see that. If mod_dld works on your system, "cc -o
mod_whatever.c" will built a module, and "LoadModule whatever_module
mod_whatever.o" will install it at runtime.

-- 
________________________________________________________________________
Alexei Kosut <ak...@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/


Re: NT and modules

Posted by Rasmus Lerdorf <ra...@lerdorf.on.ca>.
> I'd love to see this done. We have a module (mod_dld.c) that links
> object files into the server at runtime using gdld. If someone wants
> to modify this to work with shared libraries in a way that works on
> many Unices, that'd be great. The last part seems to be the sticking
> point, if I recall correctly. A few years ago, when mod_dld was first
> written, I recall most Unix OSes doing this differently (if at
> all). Maybe that's changed, or maybe it was just wrong.
> 
> Regardless, this has always been on my Apache 2.0 list - not shared
> libs per se, but just the ability to have modules loaded at runtime
> instead of at compile-time.

I have played a bit with mod_dld, and mod_php's Makefile actually comes
with the option of building mod_php to be loaded dynamically at runtime.

I don't really see any benefit to this though.  In a pre-forking
multi-process environment you get absolutely no performance benefit 
from dynamically linking in modules at runtime.  The only benefit is in
the convenience of not having to recompile to add a module.  This
convenience comes at the expense of a much more difficult compile of each
module.

It would be nice to get to the point where Perl is.  Having a standard
mechanism to build a module and to make it available to Apache.  Then
doing something like a "Use mod_rewrite" in the httpd.conf file, or even
per-request in a .htaccess.  mod_dld is a very long way from something
like that.

-Rasmus


Re: NT and modules

Posted by Alexei Kosut <ak...@nueva.pvt.k12.ca.us>.
On Tue, 17 Jun 1997, Randy Terbush wrote:

> Ya know... perhaps we are being stupid here, but most UNIX systems 
> have shared library capability. We are already creating modules 
> like mod_proxy as a .a that is being linked to the server. Why 
> couldn't we do the same with modules by creating a shared lib? 
> Seems that if nothing else, this could really reduce the memory 
> usage of hundreds of server processes?

I'd love to see this done. We have a module (mod_dld.c) that links
object files into the server at runtime using gdld. If someone wants
to modify this to work with shared libraries in a way that works on
many Unices, that'd be great. The last part seems to be the sticking
point, if I recall correctly. A few years ago, when mod_dld was first
written, I recall most Unix OSes doing this differently (if at
all). Maybe that's changed, or maybe it was just wrong.

Regardless, this has always been on my Apache 2.0 list - not shared
libs per se, but just the ability to have modules loaded at runtime
instead of at compile-time.

-- 
________________________________________________________________________
Alexei Kosut <ak...@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/