httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akins, Brian" <Brian.Ak...@turner.com>
Subject Re: mod-cache-requestor plan
Date Wed, 13 Jul 2005 16:25:11 GMT



On 7/12/05 10:27 PM, "Parin Shah" <parin.soc@gmail.com> wrote:

>
>> Also, one of the flaws of mod_disk_cache (at least the version I am looking
>> at) is that it deletes objects before reloading them.  It is better for many
>> reasons to only replace them.  That's the best way to accomplish what I
>> described above.
> 
> If we implement it the way you suggested, then this problem would
> automatically be solved.


The basic flow of mod_disk_cache should be something like:

Determine cache key.

Does meta and data exist?
    yes -> check for expire, serve it, etc
    
No: insert filter, etc

In filter, open a deterministic tmp file, not the "random ones like in
current. Something like metafile.tmp.  When file is opened, try to open it
exclusively.  That way only one worker is trying to cache file.

After caching rename from tmp to real files.


Also by using such a temp file scheme allows you to possible be "sloppy"
with your expiry times:

Does meta file exist? Yes.
Is meta file "fresh"? No.
Does a tmp file exist? Yes, someone else is "refreshing" it.
Is temp file less than x seconds old? Yes.
Serve "stale" content.

This avoids the "thundering herd" to the backend server/database/whatever
handler.  

Trust me, it works :)



-- 
Brian Akins
Lead Systems Engineer
CNN Internet Technologies



Mime
View raw message