How Much to Buffer?
Let's do some maths to determine what should be the buffer size to ensure the best performance.
We'll cover the following...
Now arises the following question: how many updates should LFS buffer before writing to disk? The answer, of course, depends on the disk itself, specifically how high the positioning overhead is in comparison to the transfer rate; see the FFS chapter for a similar analysis.
For example, assume that positioning (i.e., rotation and seek overheads) before each write takes roughly seconds. Assume further that the disk transfer rate is . How much should LFS buffer before writing when running on such a disk?
The way to think about this is that every time you write, you pay a fixed overhead of the positioning cost. Thus, how much do you have to write in order to amortize that cost? The more you write, the better (obviously), and the closer you get to achieving peak bandwidth.
To obtain a concrete answer, let’s assume we are writing out MB. The time to write out this chunk of data () is the positioning time plus the time to transfer (), or:
...