httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: mod_disk_cache summarization
Date Tue, 24 Oct 2006 12:22:28 GMT
On Mon, Oct 23, 2006 at 10:11:58PM +0200, Graham Leggett wrote:
> Brian Akins wrote:
> 
> >Can someone please summarize the various patches for mod_disk_cache that 
> >have been floating around in last couple weeks?  I have looked at the 
> >patches but wasn't real sure of the general philosophy/methodology to them.
> 
> In essence, the patches solve the thundering herd problem.

I still think it's fundamentally wrong to try to "fix" that problem in 
this way.  It seems like the cache is being re-implemented to optimize 
for some very specific deployment scenarios, which scares me quite a 
lot.

IMO: for a general purpose cache it is not appropriate to stop and try 
to write the entire response to the cache before serving anything.  
Neither is it appropriate to have any process do the "sleep and stat" 
loop waiting for some other process to finish writing a cache file. And 
certainly having the cache fork threads/processes so it can internally 
cache and serve simultaneously is the most scary idea of all.

The cache can be simple and correct by using the open/O_EXCL logic to 
avoid caching the same URL simultaneously in multiple processes.  In the 
case where the open gives EEXISTS, the cache filters should just get out 
of the way and let the resource be served normally.

I think the only feasible approach to mitigating the "thundering herd" 
expiry problem is to use the fuzzy expiry logic Brian described in his 
talk: offseting the expiry time by some random offset in each process.

Regards,

joe

Mime
View raw message