[ale] [OT] webserver and atomic actions

Cade Thacker linux at cade.org
Wed Nov 12 09:53:17 EST 2003


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!
==================





More information about the Ale mailing list