Very long delay for first write to big filesystem
adilger at dilger.ca
Sat Jan 18 17:09:20 UTC 2014
On Jan 17, 2014, at 9:32, Ken Bass <daytooner at gmail.com> wrote:
> The problem/issue: there is a very long delay when my system does a write to the filesystem. The delay now is over 5 minutes (yes: minutes). This only happens on the first write after booting up the system, and only for large files - 1GB or more. This can be a serious problem since all access to any hard disk is blocked and will hang until the first write begins again.
> The prevailing thought at the time was this was associated with loading into memory the directory information looking for free space, which I would believe now.
It isn't actually directory information that is being loaded, but rather the
block bitmaps from each group, and each one needs a seek to read.
This will take up to 7.5 TB / 128 MB/group / 100 seeks/sec = 600s
if the filesystem is nearly full. After this point, the bitmaps are cached
In memory and allocation is faster.
> The filesystem in question is 7.5TB, with about 4TB used. There are over 250,000 files. I also have another system with 1TB total and 400GB used, with 65,000 files. This system, the smaller one, is beginning to show delays as well, although only a few seconds.
> This problem seems to involve several factors: the total size of the system; the current "fragmentation" of that system; and finally the amount of physical memory available.
> As to the last factor, the 7.5TB system has only 2GB of memory (I didn't think that it would need a lot since it is mostly being used as a file server). The "fragmentation" factor (I am only guessing here) occurs with having many files written and deleted over time.
> So my questions are: is there a solution or work around for this; and is this a bug, or perhaps an undesirable feature. If the latter, should this be reported (somewhere)?
You might consider mounting the filesystem as ext4 instead of ext3.
It will do a slightly better job of finding contiguous free space
and avoid loading bitmaps that do not have enough space, but the
physics of seeking to read bitmaps is still the same.
If you format a new filesystem as ext4 (as opposed to just mounting the
existing filesystem as ext4) you can use a new feature "flex_bg" that
locates the block and inode bitmaps together so that they can be read
without so much seeking. You'd need a spare disk to format and copy
the data over to.
Using ext4 is also more resistant to fragmentation over time.
> Any suggestions, tips, etc. greatly appreciated.
> Ext3-users mailing list
> Ext3-users at redhat.com
More information about the Ext3-users