Quote:
Originally Posted by guanx
My thought is to maintain a complete, up-to-date RW filesystem, to which I can fallback without the help of the RO filesystem. The RO filesystem is only there to accelerate file reads. Therefore some files existing on both will have an older version on the RO branch, particularly when they are written to.
|
Okay, I understand. To speedup the overall system by reading from RO whenever possible. But if you use a simple two branched aufs scheme, then you simply cannot avoid sometimes reading an older file from RO.
I'm considering a possible solution, but again it depends on your specifics. So let me make some educated guesses here. I do not know when or how your RO is created. But if initially, the files in RO are all newer than the files in RW. And then, some new files are written into RW. And thusly, some files in RO that were the newest now become oldest. If you situation works like that then ...
An aufs that always reads the newest file would require 3 branches, one RO branch and two RW branches. Where the two RW branches might be on two separate slow partitions, or just two separate folders within one slow partition. Such that the aufs branches, top to bottom would be...
RW1 -- contains only newly written files, but on a slow filesystem. (Top)
RO -- contains some files, on a fast filesystem.
RW2 -- contains the bulk of files, but on a slow filesystem. (Bottom)
Then using this arrangement, aufs will always read the newest file. RW1 is initially empty, and only newly written files will be written there. No files are ever written to RW2, as that would sometimes lead to oldest files being read. And that overall, the use of RO for reading files is maximized, which makes for faster reads on average.
But the downside is that you need two RW branches. And that periodically, you may want to merge the contents of RW1 into RO and/or RW2. Otherwise, its size will just grow and grow...
That said, I know it's not the simple solution you hoped for. Anyway, I'm now headed off to bed :-)
Happy with ur solution... then tick "yes" and mark as Solved!