You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ian Holsman <li...@holsman.net> on 2003/11/20 03:50:28 UTC

[Fwd: cvs commit: httpd-test/specweb99/specweb99-2.0 mod_specweb99.c]

this commit reminds me..
weren't we going to do something similiar to this in 2.1 for the default 
file handler? (replace the 'stat' with a 'fstat')

Will .. do you remember the whole details? it was something about 
putting the handle into the request_rec or something

-------- Original Message --------
Subject: cvs commit: httpd-test/specweb99/specweb99-2.0 mod_specweb99.c
Date: 19 Nov 2003 20:55:58 -0000
From: gregames@apache.org
Reply-To: test-dev@httpd.apache.org
Organization: Holsman.NET
Newsgroups: server.http.apache.testing.cvs

gregames    2003/11/19 12:55:58

   Modified:    specweb99/specweb99-2.0 mod_specweb99.c
   Log:
   customadscan:  use apr_file_info_get (a.k.a fstat) rather than apr_stat
   for about a 7% improvement in conforming connections.

   The box is an aging RS/6000 with a single 375 MHz ppc604e, .5G of RAM,
   AIX 5.2

   Revision  Changes    Path
   1.30      +3 -3      httpd-test/specweb99/specweb99-2.0/mod_specweb99.c

   Index: mod_specweb99.c
   ===================================================================
   RCS file: /home/cvs/httpd-test/specweb99/specweb99-2.0/mod_specweb99.c,v
   retrieving revision 1.29
   retrieving revision 1.30
   diff -u -d -b -u -r1.29 -r1.30
   --- mod_specweb99.c	7 Aug 2003 21:21:57 -0000	1.29
   +++ mod_specweb99.c	19 Nov 2003 20:55:58 -0000	1.30
   @@ -882,11 +882,11 @@
        X = apr_psprintf(r->pool, "%1d", (adid % 36) / 9);
        Y = apr_psprintf(r->pool, "%1d", adid % 9);

   -    if ((rv = apr_stat(&s, fname, APR_FINFO_SIZE, r->pool)) != 
APR_SUCCESS)
   -        return;
   -
        rv = apr_file_open(&f, fname, APR_READ, APR_OS_DEFAULT, r->pool);
        if (rv != APR_SUCCESS)
   +        return;
   +
   +    if ((rv = apr_file_info_get(&s, APR_FINFO_SIZE, f)) != APR_SUCCESS)
            return;

        len = s.size;






Re: [Fwd: cvs commit: httpd-test/specweb99/specweb99-2.0 mod_specweb99.c]

Posted by gr...@apache.org.
Ian Holsman wrote:
> this commit reminds me..
> weren't we going to do something similiar to this in 2.1 for the default 
> file handler? (replace the 'stat' with a 'fstat')
> 
> Will .. do you remember the whole details? it was something about 
> putting the handle into the request_rec or something

I think that would be a great idea for a couple of reasons* but never got around 
to working out an implementation.  The problem is that it involves the core, 
apr, at least the default handler, and perhaps other 3rd party handlers (who 
knows? not me).

Greg

*reasons:
- performance.  saves a path walk in the kernel, which can contribute to lock 
contention at least on Linux SMP systems
- get rid of an annoying window/sucky code to compensate.  Our current 
implementation stats the file, saves the info, then later opens the file and 
uses the info which may now be stale.  For example, the file might have been 
replaced by a larger one between stat() and open().  We use the old size, and 
sendfile gets confused.