httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Edmundsson <ni...@acc.umu.se>
Subject Re: mod_disk_cache: making commit_entity() atomic
Date Fri, 17 Sep 2010 11:41:26 GMT
On Thu, 16 Sep 2010, Graham Leggett wrote:

> The alternative is to change the format of the disk cache so that the .data 
> file has a temporary filename, for example XYZ.data.12367 instead of just 
> XYZ.data, and then to key the string "12367" in the header file. The new data 
> file can be written alongside the old one if necessary at leisure, and only 
> when the header file is renamed into place will the new data file come into 
> effect. This avoids locks entirely.

I personally favor designs needs at most O_EXCL style write locking.

Having been bitten by various lock-related issues over the years I'm 
in favor of a explicit-lock-free design if it can be done cleanly and 
with good performance.

If going this route, I'd suggest to put the entire path to the data 
file in the header and not just a uniqifying string (to make it easier 
to split hashing of header and data in the future).


/Nikke
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke@acc.umu.se
---------------------------------------------------------------------------
  Fight War, Not Wars!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Mime
View raw message