This message was sent from Geocrawler.com by "Sergio Salvi" <[EMAIL PROTECTED]>
Be sure to reply to that address.

Hi!

I'm developing some handlers with mod_perl and I'm
very concerned about performance. Tracing my
mod_perl httpd server when
requested for the URI "/cgi/myhandler", I've found
too many stat() and lstat() calls. I'm not using
the FollowSymLinks option
(at least, it isn't specified in any Options line
in my conf.). The problem is that this URI,
"/cgi/myhandler", isn't a directory
with a file called "myhandler", it's only a
virtual path that will be handled by mod_perl.

Is there a way to remove the stat() and lstat()
syscalls when using the <Location> directive, as
in this case they're not necessary ?

PS: I've found a simple hack for this: adding an
"Alias /cgi/ /" line will make apache try to
stat("/myhandler") and
then lstat("/myhandler"), reducing the number of
stats from 13 to 2. But it's just a ugly patch...

I'm using Apache 1.3.9 with mod_perl 1.21. My
httpd.conf file:

-------

[snip]

DocumentRoot /home/site/htdocs

<Location />
Options Includes
Order deny,allow
Allow from all
</Location>

<Location /cgi/myhandler>
SetHandler perl-script
PerlHandler My::handler
</Location>

[snip]

-------

The output of strace, when requesting for
"/cgi/myhandler":    
----

read(3, "GET /cgi/myhandler HTTP/1.0rnConne"...,
4096) = 331
SYS_174(0xa, 0xbfffd908, 0xbfffd87c, 0x8, 0xa) = 0
time(NULL) = 947323581
alarm(60) = 60
alarm(0) = 60
SYS_174(0xe, 0, 0xbffff810, 0x8, 0xe) = 0
dup2(17, 2) = 2
SYS_175(0, 0, 0xbffff97c, 0x8, 0) = 0
gettimeofday({947323581, 344158}, NULL) = 0
stat("/home/site/htdocs/cgi/myhandler",
0xbffffa3c) = -1 ENOENT (No such file or
directory)
stat("/home/site/htdocs/cgi", 0xbffffa3c) = -1
ENOENT (No such file or directory)
stat("/home/site/htdocs", {st_mode=0, st_size=0,
...}) = 0
lstat("/home", {st_mode=0, st_size=0, ...}) = 0
lstat("/home/site", {st_mode=0, st_size=0, ...}) =
0
lstat("/home/site/htdocs", {st_mode=0, st_size=0,
...}) = 0
lstat("/home/site/htdocs/cgi", 0xbffff994) = -1
ENOENT (No such file or directory)
stat("/home/site/htdocs/myhandler", 0xbffff8bc) =
-1 ENOENT (No such file or directory)
stat("/home/site/htdocs", {st_mode=0, st_size=0,
...}) = 0
lstat("/home", {st_mode=0, st_size=0, ...}) = 0
lstat("/home/site", {st_mode=0, st_size=0, ...}) =
0
lstat("/home/site/htdocs", {st_mode=0, st_size=0,
...}) = 0
lstat("/home/site/htdocs/myhandler", 0xbffff814) =
-1 ENOENT (No such file or directory)
SYS_175(0, 0, 0xbffff97c, 0x8, 0) = 0

(and the request goes normal after these ENOENT
errors...)

--------

Any help will be very appreciated! :)

Regards,
Sergio Salvi.     

Geocrawler.com - The Knowledge Archive

Reply via email to