httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@covalent.net>
Subject Re: [PATCH] Allow DocumentRoot within Location blocks
Date Mon, 07 Jan 2002 20:08:57 GMT
From: "Sander van Zoest" <sander@vanZoest.com>
Sent: Monday, January 07, 2002 1:20 PM


> On Mon, 7 Jan 2002, Ryan Bloom wrote:
> 
> Okay with 2.0.28 beta (on FreeBSD 4.4-RELEASE), I have the following config (rest defaults):
> 
> DocumentRoot "/var/tmp/nostats/here"
> <Location /foo/nostat>
>    SetHandler server-status
> </Location>
> 
> I count around 6 stat() calls for this single request in regards to DocumentRoot.
> 
> Here is my ktrace of a request to /foo/nostat:
> ---
<snip>

>  14977 httpd    CALL  stat(0x8124dac,0xbfbff1dc)
>  14977 httpd    NAMI  "/var/tmp/nostats/here/foo/nostat"
>  14977 httpd    RET   stat -1 errno 2 No such file or directory
>  14977 httpd    CALL  lstat(0x8124e6c,0xbfbff1ac)
>  14977 httpd    NAMI  "/var"
>  14977 httpd    RET   lstat 0
>  14977 httpd    CALL  lstat(0x8124e6c,0xbfbff1ac)
>  14977 httpd    NAMI  "/var/tmp"
>  14977 httpd    RET   lstat 0
>  14977 httpd    CALL  lstat(0x8124e6c,0xbfbff1ac)
>  14977 httpd    NAMI  "/var/tmp/nostats"
>  14977 httpd    RET   lstat 0
>  14977 httpd    CALL  lstat(0x8124e6c,0xbfbff1ac)
>  14977 httpd    NAMI  "/var/tmp/nostats/here"
>  14977 httpd    RET   lstat 0
>  14977 httpd    CALL  lstat(0x8124e6c,0xbfbff1ac)
>  14977 httpd    NAMI  "/var/tmp/nostats/here/foo"
>  14977 httpd    RET   lstat -1 errno 2 No such file or directory

Correct.  This is the change in path_info that caused much greater evil before.
We used to stat "/var/tmp/nostats/here/foo/nostat", then start walking backwards,
removing path segments until the file was found.

Unfortunately, the old way, you could have 100's of stats, with a path like;

/a/a/a/a/a/a/.../a/a/a

You get the picture.

So now, if we miss [exact stat], we start our stats from the left.  We can still
optimize away some of these stats by tighter binding to the document_root using
r->canonical_filename (which is known to exist, or at least trusted to exist.)
r->canonical_filename doesn't need to be == r->filename, but we should skip all
stats iff you have set allowsymlinks so there is no better reason to test that
part of the path.

Unfortunately, I commented out that part of the optimization for Unix.  Now I
see more clearly, perhaps we should reintroduce that optimization on Unix as well.
It didn't seem to have a purpose before :)

So you see, no matter HOW we optimize this, why we still want the optimization 
of an 'unset' DocumentRoot :)

Bill




Mime
View raw message