Reputation: 941
The problem is that I want to guarantee that my file tailing will almost never do disk I/O.
As the files (log files, essentially) are being written to the disk by the java server, I want them to be read and transferred to another device in real-time.
Assuming the target device can suck in as much data as the source server which is generating the log file, and there is no network saturation or similar issues, then, if I am always reading from the end of the file, is it guaranteed that the data I am reading is always from Linux's buffer cache?
Files get rolled over every hour.
Upvotes: 1
Views: 615
Reputation: 533442
You need to ensure you are reading the file before it is discarded from file cache. If you are within a few MB of the where the end of the files is I don't imagine you will have a problem.
On Linux, it appears to me you can safely disk cache about 10% of the total memory. (I have no proof of this however)
Upvotes: 1