Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 1581 invoked by uid 6000); 18 Dec 1997 20:46:05 -0000 Received: (qmail 1575 invoked from network); 18 Dec 1997 20:46:04 -0000 Received: from twinlark.arctic.org (204.62.130.91) by taz.hyperreal.org with SMTP; 18 Dec 1997 20:46:04 -0000 Received: (qmail 14681 invoked by uid 500); 18 Dec 1997 20:50:30 -0000 Date: Thu, 18 Dec 1997 12:50:30 -0800 (PST) From: Dean Gaudet To: Apache list Subject: Re: On avoiding stat() In-Reply-To: Message-ID: X-Comment: Visit http://www.arctic.org/~dgaudet/legal for information regarding copyright and disclaimer. Organization: Transmeta Corp. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Actually no... I'm not telling the whole truth... you could implement everything in terms of uris, make sure that r->filename is some non-existant file, r->finfo.st_mode = 0, and totally skip all of apache's filesystem handling. This would be similar to how you would map a url-space onto a database in apache. Dean On Thu, 18 Dec 1997, Dean Gaudet wrote: > You're ignoring files which are automatically updated by external > processes -- which is the norm for all the large servers I deal with. The > files are created on an internal host, then mirrored to N webservers via > rdist or rsync. > > At any rate, no, there's no way to get rid of the stat(). It's all tied > up with how apache decides that your module will handle the request. A > possible future optimization would be a 5 or 10 second stat() cache in > multithreaded servers. > > Dean > > On Thu, 18 Dec 1997, Igor Tatarinov wrote: > > > If the author of the page requests it, it will be reloaded and I should > > be able to detect it. If somebody else requests a stale page, it can > > send a stale copy (this assumes I do stat the file every once in a while, > > say every 30 min). > > > > In fact, this means that I will never have a stale copy if the author > > takes a look at the final version of his/her masterpiece. And this is > > typically the case, I'd guess. > > > > am I missing something? > > igor > > > > Dean Gaudet wrote: > > > > > > You need to stat() the file regardless. How else do you determine if the > > > file in your cache is stale? Even on non-IMS requests you need to stat(). > > > Otherwise you have to implement full HTTP/1.1 proxy semantics, which is > > > non-trivial and not worth saving the stat() call imho. > > > > > > Dean > > > > > > On Thu, 18 Dec 1997, Igor Tatarinov wrote: > > > > > > > Hi all! > > > > > > > > As you might remember, I am trying to add a document cache to apache that > > > > would (hopefully) decrease the number of I/Os and save some CPU cycles by > > > > avoiding open/mmap/close > > > > > > > > So I got a question: is there any way to avoid the stat() call. I know that > > > > Apache needs to make it to mmap the file but if I already got the file in > > > > the cache and know its size, there is no reason to stat() the file. Of > > > > course, the file may have been updated but this happens not often and I > > > > could probably check for "If-Modified-Since" and stat the file only if > > > > reload was requested. > > > > > > > > any ideas? > > > > > > > > thanks, > > > > igor > > > > > > > > -- > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > Igor Tatarinov, graduate student, Computer Science Dept, NDSU > > > > e-mail: tatarino@prairie.nodak.edu or itat@acm.org > > > > http://www.cs.ndsu.nodak.edu/~tatarino > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > > -- > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Igor Tatarinov, graduate student, Computer Science Dept, NDSU > > e-mail: tatarino@prairie.nodak.edu or itat@acm.org > > http://www.cs.ndsu.nodak.edu/~tatarino > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > >