Poor Performance WhenNumber of Files > 1M
sandeen at redhat.com
Wed Jun 11 05:33:20 UTC 2008
John Kalucki wrote:
> Performance seems to always map directly to the number of files in the
> ext3 filesystem.
> After some initial run-fast time, perhaps once dirty pages begin to be
> written aggressively, for every 5,000 files added, my files created per
> second tends to drop by about one. So, depending on the variables, say
> with 6 RAID10 spindles, I might start at ~700 files/sec, quickly drop,
> then more slowly drop to ~300 files/sec at perhaps 1 million files, then
> see 299 files/sec for the next 5,000 creations, 298 files/sec, etc. etc.
> As you'd expect, there isn't much CPU utilization, other than iowait,
> and some kjournald activity.
> Is this a known limitation of ext3? Is expecting to write to
> O(10^6)-O(10^7) files in something approaching constant time expecting
> too much from a filesystem? What, exactly, am I stressing to cause this
> unbounded performance degradation?
I think this is a linear search through the block groups for the new
inode allocation, which always starts at the parent directory's block
group; and starts over from there each time. See find_group_other().
So if the parent's group is full and so are the next 1000 block groups,
it will search 1000 groups and find space in the 1001st. On the next
inode allocation it will re-search(!) those 1000 groups, and again find
space in the 1001st. And so on. Until the 1001st is full, and then
it'll search 1001 groups and find space in the 1002nd... etc (If I'm
remembering/reading correctly, but this does jive with what you see.).
I've toyed with keeping track (in the parent's inode) where the last
successful child allocation happened, and start the search there. I'm a
bit leery of how this might age, though... plus I'm not sure if it
should be on-disk or just in memory.... But this behavior clearly needs
some help. I should probably just get it sent out for comment.
More information about the Ext3-users