httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject mod_disk_cache: making commit_entity() atomic
Date Thu, 16 Sep 2010 00:42:02 GMT
Hi all,

Now that the three ad hoc file writes in mod_disk_cache have been  
grouped together into one place (commit_entity()), the last step is to  
ensure that the three writes happen atomically.

Ideally, the locking of url A should have no effect on url B, so a  
separate lock file per .header/.data file should be needed.

Will a simple apr_file_lock() on a per-URL lock file do the trick, or  
will performance be a killer?

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.

Thoughts?

Regards,
Graham
--


Mime
View raw message