[ale] [OT] webserver and atomic actions

Mike Murphy mike at tyderia.net
Wed Nov 12 10:33:34 EST 2003


proftpd has a feature called HiddenStor 
(http://proftpd.linux.co.uk/docs/directives/linked/config_ref_HiddenStor.html) 
basiclly is allows you to upload a file, but it puts it to a different 
name, then mv's it in place when done. I'm sure other ftp servers have 
similar features.

In general, this is a good thing to use/ape. If you copy the file to a 
different name, then mv it (assuming the 2 files are on the same 
physical/logical volume), you should not have a partial file serving 
problem (because, when you mv a file like this, its instantaneous, and 
the new target file of that name -- which is really just a reference to 
an actual file anyway -- is already whole). This should still work if 
you are using NFS or webserver caching as well.

I know personally of a number of *big* websites that use techniques just 
like this to deal with this problem.

Mike


Cade Thacker wrote:
> I have a very simple problem. I have a web page that contains the string
> "36.00", this number is a stock quote. This quote will of course change
> throughout the day. This page is hit at least once per second.
> 
> The quote will be kept in a simple 5 byte text file. Unfortuntely
> everything else (php, servlets, etc) is out of the question to keep it in.
> It has to be a simple text file returned by the web server directly. I
> will run a cron job that will update this file with the new value every 5
> minutes.
> 
> I am worried that when the file is updated, that a client could pull a
> partially file(or empty file).
> 
> Any thoughts on how to make sure that a client always gets a full file?
> Should I use two file with symbolic links? Link points to file1, update
> file two, switch link, five minutes later, update file1 switch link back
> to file1? Is the linking action atomic enough?
> 
> Does this make sense?
> 
> Thanks in advance for your help.
> 
> --cade
> 
> On Linux vs Windows
> ==================
> Remember, amateurs built the Ark, Professionals built the Titanic!
> ==================
> 
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale

-- 

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mike Murphy
781 Inman Mews Drive Atlanta GA 30307
Landline: 404-653-1070
Mobile: 404-545-6234
Email: mike at tyderia.net
Email Pager: pagemike at tyderia.net
AIM: mmichael453
JDAM: 33:45:14.0584N  84:21:43.038W
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+



More information about the Ale mailing list