[lug] Polling a file under linux

Tkil tkil at scrye.com
Mon Apr 21 12:36:15 MDT 2003


>>>>> "Rob" == Rob Judd <rjudd at mlug.missouri.edu> writes:

Rob> 1. read the contents of the file before every connection
Rob> 2. stat the file before every connection

Rob> both of these are rather expensive, especially if connections are
Rob> made several times a second.

Um, given that they'll probably be in disk cache, I'll wager that
these are both very much cheaper than opening up a socket connection
to an external host.

Advice?  Use the simple implementation above, and see if it's a
performance bottleneck.

As for avoiding the partially-written files, you can either use a
well-formedness constraint of some sort, or require changes to the
file be done with "atomic renames".

t.



More information about the LUG mailing list