Graham Leggett wrote:
This is very cool. On my list of things to do was to handle something
similar for serving from the cache as well - again to avoid a thundering
herd against backend servers while a file is being cached.
I have the thought that we could also serve files that have "recently
expired" (recent being configurable) if the object was being cached.
Psudocode:
if(expired < (now - recent)) {
if(stat(tmpfile) {
if(mtime_is_resonable) {
serve_old_file;
} else {
unlimk(tempfile)
}
}
}
This would also allow only one request through to "refresh" the object
and protect against a "hung" worker (bad backend server, database, whatever)
--
Brian Akins
Lead Systems Engineer
CNN Internet Technologies