httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Akins <>
Subject Re: [PATCH] mod_cache fixes: #8
Date Mon, 02 Aug 2004 18:17:35 GMT
Justin Erenkrantz wrote:

> post_config's not a bad place for that.  But, I've yet to get a good 
> handle on my thoughts for the storage mechanism that mod_disk_cache is 
> using.  My hunch so far is that it's really inefficient.  (The reading 
> of the headers one-byte at a time with the brain-dead apr_file_gets() 
> just *killed* performance.) 

Could do something like reading the struct first.  Then just read the 
rest of the headers into memoyr and parse them there.  Also having an 
array of headers and just saving the index to the file is more effecient:

psuedo code:

headers = {
  "Cache-Control", "Expires", .... }

then while caching them, to store the Expires header, for example, just 
write 1 (the index of the expires header) and then the value to the 
headers file.  Then parsing is much faster as well.

> And, there might be a way to also save the entire response headers and 
> body and allow a straight sendfile from that.

Don't know if that will work.  Also, you still have to store and parse 
meta data as well.

> Sort of dislike the fact that you must pre-create the dirs.  Yet, I 
> understand the point here.  The extra stat calls might end up being 
> harmful.  Will chew on this and see if the dirs become a bottleneck or 
> not.  -- justin
It is a bottle neck on very busy server when the directories do not 
exist.  Once the server has ran for a while, it doesn't matter as the 
majority of the directories have been made...

Also, is it necessary to try to remove the file even when we are not 
sure it exists?

Brian Akins
Senior Systems Engineer
CNN Internet Technologies

View raw message